]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2017-11-16 Gary Dismukes <dismukes@adacore.com>
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Nov 2017 15:44:12 +0000 (15:44 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Nov 2017 15:44:12 +0000 (15:44 +0000)
* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst, sem_ch6.adb,
sem_elab.adb: Minor editorial corrections.
* gnat_ugn.texi: Regenerate.

2017-11-16  Joel Brobecker  <brobecker@adacore.com>

* doc/gnat_ugn/gnat_utility_programs.rst (GNAT UGN): Add
gnatsymbolize documentation.
* gnat_ugn.texi: Regenerate.

2017-11-16  Steve Baird  <baird@adacore.com>

* sem_ch3.adb (Build_Derived_Record_Type): Replace all uses of
"Scope (Parent_Type)" with "Scope (Parent_Base)".

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254825 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/doc/gnat_ugn/elaboration_order_handling_in_gnat.rst
gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_elab.adb

index 26457f12c176f37fe316c789fe206d915351fda5..8a7b64963d6dca6e55c715d15dcf963c4ebf870b 100644 (file)
@@ -1,3 +1,20 @@
+2017-11-16  Gary Dismukes  <dismukes@adacore.com>
+
+       * doc/gnat_ugn/elaboration_order_handling_in_gnat.rst, sem_ch6.adb,
+       sem_elab.adb: Minor editorial corrections.
+       * gnat_ugn.texi: Regenerate.
+
+2017-11-16  Joel Brobecker  <brobecker@adacore.com>
+
+       * doc/gnat_ugn/gnat_utility_programs.rst (GNAT UGN): Add
+       gnatsymbolize documentation.
+       * gnat_ugn.texi: Regenerate.
+
+2017-11-16  Steve Baird  <baird@adacore.com>
+
+       * sem_ch3.adb (Build_Derived_Record_Type): Replace all uses of
+       "Scope (Parent_Type)" with "Scope (Parent_Base)".
+
 2017-11-16  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * opt.ads: Elaboration warnings are now on by default. Add a comment
index 57acf53879c4f87fc9a470bbe212221ede63f7e2..d8c9aef5e15b76ba32be021187c0d10af2585a40 100644 (file)
@@ -1687,7 +1687,7 @@ the elaboration order chosen by the binder.
     14. end Selective_Suppression;
 
   Note that suppressing elaboration warnings does not eliminate run-time
-  checks. The example above will still fail at runtime with an ABE.
+  checks. The example above will still fail at run time with an ABE.
 
 .. _Summary_of_Procedures_for_Elaboration_Control:
 
index 855bb8f3d4d64ab418eeb00ef86122173049c869..1122b70b1588c8414a7fb03db48f54559b3fcc0e 100644 (file)
@@ -22,6 +22,7 @@ This chapter describes a number of utility programs:
   * :ref:`The_GNAT_Pretty-Printer_gnatpp`
   * :ref:`The_Body_Stub_Generator_gnatstub`
   * :ref:`The_Unit_Test_Generator_gnattest`
+  * :ref:`The_Backtrace_Symbolizer_gnatsymbolize`
 
   It also describes how several of these tools can be used in conjunction
   with project files: :ref:`Using_Project_Files_with_GNAT_Tools`
@@ -5012,6 +5013,116 @@ Alternatively, you may run the script using the following command line:
     aspects, and complex variable initializations that use Subprogram'Access,
     may result in elaboration circularities in the generated harness.
 
+
+.. only:: PRO or GPL
+
+  .. _The_Backtrace_Symbolizer_gnatsymbolize:
+
+  Translating Code Addresses into Source Locations with ``gnatsymbolize``
+  =======================================================================
+
+  .. index:: ! gnatsymbolize
+
+  ``gnatsymbolize`` is a program which translates addresses into
+  their corresponding filename, line number, and function names.
+
+  Running ``gnatsymbolize``
+  -------------------------
+
+  ::
+
+       $ gnatsymbolize filename [ addresses ]
+
+  For instance, consider the following Ada program:
+
+     .. code-block:: ada
+
+        package Pck is
+           Global_Val : Integer := 0;
+           procedure Call_Me_First;
+        end Pck;
+
+        with GNAT.IO; use GNAT.IO;
+        with GNAT.Traceback; use GNAT.Traceback;
+        with GNAT.Debug_Utilities;
+        package body Pck is
+           procedure Call_Me_Third is
+              TB : Tracebacks_Array (1 .. 5);
+              TB_len : Natural;
+           begin
+              Global_Val := Global_Val + 1;
+
+              Call_Chain (TB, TB_Len);
+              for K in 1 .. TB_Len loop
+                 Put_Line (GNAT.Debug_Utilities.Image_C (TB (K)));
+              end loop;
+           end Call_Me_Third;
+
+           procedure Call_Me_Second is
+           begin
+              Call_Me_Third;
+           end Call_Me_Second;
+
+           procedure Call_Me_First is
+           begin
+              Call_Me_Second;
+           end Call_Me_First;
+        end Pck;
+        with Pck; use Pck;
+
+        procedure Foo is
+        begin
+           Global_Val := 123;
+           Call_Me_First;
+        end Foo;
+
+  This program, when built and run, prints a list of addresses which
+  correspond to the traceback when inside function ``Call_Me_Third``.
+  For instance, on x86_64 GNU/Linux:
+
+    ::
+
+       $ gnatmake -g -q foo.adb
+       $ ./foo
+       0x0000000000402561
+       0x00000000004025EF
+       0x00000000004025FB
+       0x0000000000402611
+       0x00000000004024C7
+
+  ``gnatsymbolize`` can be used to translate those addresses into
+  code locations as follow:
+
+    ::
+
+       $ gnatsymbolize foo 0x0000000000402561 0x00000000004025EF \
+           0x00000000004025FB 0x0000000000402611 0x00000000004024C7
+       Pck.Call_Me_Third at pck.adb:12
+       Pck.Call_Me_Second at pck.adb:20
+       Pck.Call_Me_First at pck.adb:25
+       Foo at foo.adb:6
+       Main at b~foo.adb:184
+
+  Requirements for Correct Operation
+  ----------------------------------
+
+  The translation is performed by reading the DWARF debugging
+  information produced by the compiler for each unit. All units
+  for which the translation is to be done must therefore be compiled
+  such that DWARF debugging information is produced. In most cases,
+  this is done by simply compiling with ``-g``.
+
+  This program provides a functionality similar to ``addr2line``.
+  It has fewer options to tailor its output, but has been designed
+  to require fewer of the DWARF sections to be present in the
+  executable. In particular, the following sections can be
+  stripped from the executable without impact to ``gnatsymbolize``'s
+  functionality:
+
+    * ``.debug_str``
+    * ``.debug_ranges``
+
+
 .. only:: PRO or GPL
 
    .. _Using_Project_Files_with_GNAT_Tools:
index 43ef24596d42e7fdb7e364c6e8c97c873eacf2c7..261b410edd121d4a0b5471d5617b78ba7c731a27 100644 (file)
@@ -18918,6 +18918,7 @@ $ perl gnathtml.pl [ switches ] files
 
 
 
+
 @c -- Example: A |withing| unit has a |with| clause, it |withs| a |withed| unit
 
 @node GNAT and Program Execution,Platform-Specific Information,GNAT Utility Programs,Top
@@ -29003,7 +29004,7 @@ using @code{pragma Warnings (Off)}.
 @end example
 
 Note that suppressing elaboration warnings does not eliminate run-time
-checks. The example above will still fail at runtime with an ABE.
+checks. The example above will still fail at run time with an ABE.
 @end table
 
 @node Summary of Procedures for Elaboration Control,Inspecting the Chosen Elaboration Order,Elaboration-related Compiler Switches,Elaboration Order Handling in GNAT
index 5ff3ed12215efe812c78f741a0de3326f28f7606..7edac03f230f41cd3f548657676cdc509b900668 100644 (file)
@@ -8519,11 +8519,11 @@ package body Sem_Ch3 is
       --  type, mark it accordingly.
 
       if Is_Private_Type (Parent_Type) then
-         if Scope (Parent_Type) = Scope (Derived_Type) then
+         if Scope (Parent_Base) = Scope (Derived_Type) then
             null;
 
-         elsif In_Open_Scopes (Scope (Parent_Type))
-           and then In_Private_Part (Scope (Parent_Type))
+         elsif In_Open_Scopes (Scope (Parent_Base))
+           and then In_Private_Part (Scope (Parent_Base))
          then
             null;
 
@@ -9126,7 +9126,7 @@ package body Sem_Ch3 is
          elsif Has_Unknown_Discriminants (Parent_Type)
            and then
             (not Has_Discriminants (Parent_Type)
-              or else not In_Open_Scopes (Scope (Parent_Type)))
+              or else not In_Open_Scopes (Scope (Parent_Base)))
          then
             Set_Has_Unknown_Discriminants (Derived_Type);
          end if;
index 764a6f66c88905f21c9132b4cc8a5d0d9a21fdba..01c1b5484e003b81e77b53f0510ec5fe98f4b5f5 100644 (file)
@@ -4902,7 +4902,7 @@ package body Sem_Ch6 is
 
       --  Proceed with analysis. Do not emit a cross-reference entry if the
       --  specification comes from an expression function, because it may be
-      --  the completion of a previous declaration. It is not, the cross-
+      --  the completion of a previous declaration. If it is not, the cross-
       --  reference entry will be emitted for the new subprogram declaration.
 
       if Nkind (Parent (N)) /= N_Expression_Function then
index b34523f31f23bc888be092ec0af212808b0e2a9d..23e6a107f6944426ce9a083f470a490242923d4c 100644 (file)
@@ -442,7 +442,7 @@ package body Sem_Elab is
    --
    --  -gnateL  turn off info messages on generated Elaborate[_All] pragmas
    --
-   --           The complimentary switch for -gnatel.
+   --           The complementary switch for -gnatel.
    --
    --  -gnatw.f turn on warnings for suspicious Subp'Access
    --
@@ -452,16 +452,16 @@ package body Sem_Elab is
    --
    --  -gnatw.F turn off warnings for suspicious Subp'Access
    --
-   --           The complimentary switch for -gnatw.f.
+   --           The complementary switch for -gnatw.f.
    --
    --  -gnatwl  turn on warnings for elaboration problems
    --
    --           The ABE mechanism produces warnings on detected ABEs along with
-   --           traceback showing the graph of the ABE.
+   --           traceback showing the graph of the ABE.
    --
    --  -gnatwL  turn off warnings for elaboration problems
    --
-   --           The complimentary switch for -gnatwl.
+   --           The complementary switch for -gnatwl.
 
    ---------------------------
    -- Adding a new scenario --