* 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
+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
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:
* :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`
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:
+
@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
@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
-- 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;
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;
-- 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
--
-- -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
--
--
-- -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.
+ -- a 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 --