diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-25 15:45:54 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-25 15:45:54 +0000 |
commit | 79ae0850a079170195499f18490618345e58310f (patch) | |
tree | 01a0df925ef00a4b2b3cf09639bcea155292d0c2 /gcc/ada | |
parent | 7f3bd769780f3a8b135e9184225915339aa810d9 (diff) | |
download | gcc-79ae0850a079170195499f18490618345e58310f.tar.gz |
2014-02-25 Eric Botcazou <ebotcazou@adacore.com>
* sigtramp.h: Fix minor inaccuracy.
2014-02-25 Ben Brosgol <brosgol@adacore.com>
* gnat_ugn.texi: Added description of kill command.
2014-02-25 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi (Address_Clauses): Add a section discussing the
problem of address clauses causing unexpected initialization,
including the effect of Initialize_Scalars.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208144 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 102 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 14 | ||||
-rw-r--r-- | gcc/ada/sigtramp.h | 2 |
4 files changed, 131 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d401ee557bd..2cedac3d86d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2014-02-25 Eric Botcazou <ebotcazou@adacore.com> + + * sigtramp.h: Fix minor inaccuracy. + +2014-02-25 Ben Brosgol <brosgol@adacore.com> + + * gnat_ugn.texi: Added description of kill command. + +2014-02-25 Robert Dewar <dewar@adacore.com> + + * gnat_rm.texi (Address_Clauses): Add a section discussing the + problem of address clauses causing unexpected initialization, + including the effect of Initialize_Scalars. + 2014-02-25 Robert Dewar <dewar@adacore.com> * errout.adb: Various changes for better msgs for anonmous access diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index a815b3b03dd..a3f1217b981 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -6684,6 +6684,11 @@ is expected when a value of this type is read from the stream. Note that the value written always includes the bounds, even for Unbounded_String'Write, since Unbounded_String is not an array type. +Note that the @code{Stream_Convert} pragma is not effective in the case of +a derived type of a non-limited tagged type. If such a type is specified then +the pragma is silently ignored, and the default implementation of the stream +attributes is used instead. + @node Pragma Style_Checks @unnumberedsec Pragma Style_Checks @findex Style_Checks @@ -15557,6 +15562,103 @@ in the above example) in this case. This means that the overlay works "as expected", in that a modification to one of the variables will affect the value of the other. +Note that when address clause overlays are used in this way, there is an +issue of unintentional initialization, as shown by this example: + +@smallexample @c ada +package Overwrite_Record is + type R is record + A : Character := 'C'; + B : Character := 'A'; + end record; + X : Short_Integer := 3; + Y : R; + for Y'Address use X'Address; + | +>>> warning: default initialization of "Y" may + modify "X", use pragma Import for "Y" to + suppress initialization (RM B.1(24)) + +end Overwrite_Record; +@end smallexample + +@noindent +Here the default initialization of @code{Y} will clobber the value +of @code{X}, which justifies the warning. The warning notes that +this effect can be eliminated by adding a @code{pragma Import} +which suppresses the initialization: + +@smallexample @c ada +package Overwrite_Record is + type R is record + A : Character := 'C'; + B : Character := 'A'; + end record; + X : Short_Integer := 3; + Y : R; + for Y'Address use X'Address; + pragma Import (Ada, Y); +end Overwrite_Record; +@end smallexample + +@noindent +Note that the use of @code{pragma Initialize_Scalars} may cause variables to +be initialized when they would not otherwise have been in the absence +of the use of this pragma. This may cause an overlay to have this +unintended clobbering effect. The compiler avoids this for scalar +types, but not for composite objects (where in general the effect +of @code{Initialize_Scalars} is part of the initialization routine +for the composite object: + +@smallexample @c ada +pragma Initialize_Scalars; +with Ada.Text_IO; use Ada.Text_IO; +procedure Overwrite_Array is + type Arr is array (1 .. 5) of Integer; + X : Arr := (others => 1); + A : Arr; + for A'Address use X'Address; + | +>>> warning: default initialization of "A" may + modify "X", use pragma Import for "A" to + suppress initialization (RM B.1(24)) + +begin + if X /= Arr'(others => 1) then + Put_Line ("X was clobbered"); + else + Put_Line ("X was not clobbered"); + end if; +end Overwrite_Array; +@end smallexample + +@noindent +The above program generates the warning as shown, and at execution +time, prints @code{X was clobbered}. If the @code{pragma Import} is +added as suggested: + +@smallexample @c ada +pragma Initialize_Scalars; +with Ada.Text_IO; use Ada.Text_IO; +procedure Overwrite_Array is + type Arr is array (1 .. 5) of Integer; + X : Arr := (others => 1); + A : Arr; + for A'Address use X'Address; + pragma Import (Ada, A); +begin + if X /= Arr'(others => 1) then + Put_Line ("X was clobbered"); + else + Put_Line ("X was not clobbered"); + end if; +end Overwrite_Array; +@end smallexample + +@noindent +then the program compiles without the waraning and when run will generate +the output @code{X was not clobbered}. + @node Effect of Convention on Representation @section Effect of Convention on Representation @cindex Convention, effect on representation diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 8ce48bd8aa6..b484665eab4 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -21299,6 +21299,20 @@ examined to the frame of its callee (the reverse of the previous command), Inspect the frame with the given number. The value 0 denotes the frame of the current breakpoint, that is to say the top of the call stack. +@item kill +Kills the child process in which the program is running under GDB. +This may be useful for several purposes: +@itemize @bullet +@item +It allows you to recompile and relink your program, since on many systems +you cannot regenerate an executable file while it is running in a process. +@item +You can run your program outside the debugger, on systems that do not +permit executing a program outside GDB while breakpoints are set +within GDB. +@item +It allows you to debug a core dump rather than a running process. +@end itemize @end table @noindent diff --git a/gcc/ada/sigtramp.h b/gcc/ada/sigtramp.h index 59287f157fe..cf5f4707ee3 100644 --- a/gcc/ada/sigtramp.h +++ b/gcc/ada/sigtramp.h @@ -66,7 +66,7 @@ extern "C" { The unwinder will unwind frames 0, 1 and 2 as usual. But the CFI of frame 3 is set up as if the caller of frame 3 was frame 6 so, when frame 3 is unwound, the unwinder ends up in frame 6 directly. It's possible to do so - since the kernel has saved the context of frame 3 and passed it on to + since the kernel has saved the context of frame 6 and passed it on to __gnat_sigtramp. */ #ifdef __cplusplus |