[multiple changes]

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)".

From-SVN: r254825
This commit is contained in:
Pierre-Marie de Rodat 2017-11-16 15:44:12 +00:00
parent 5f3682ffce
commit a3f9da7084
7 changed files with 140 additions and 11 deletions

View 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

View 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:

View 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:

View 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

View 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;

View 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

View 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.
-- 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 --