P2;
end STB;
-This program will output:
-
::
+ $ gnatmake stb -g -bargs -E -largs -no-pie
$ stb
raised CONSTRAINT_ERROR : stb.adb:12 range check failed
::
- $ gnatmake -g .\stb -bargs -E
+ $ gnatmake -g stb -bargs -E
$ stb
0040149F in stb.p1 at stb.adb:8
004011F1 in mainCRTStartup at crt1.c:222
77E892A4 in ?? at ??:0
-In the above example the ``.\`` syntax in the ``gnatmake`` command
-is currently required by ``addr2line`` for files that are in
-the current working directory.
-Moreover, the exact sequence of linker options may vary from platform
-to platform.
-The above :switch:`-largs` section is for Windows platforms. By contrast,
-under Unix there is no need for the :switch:`-largs` section.
-Differences across platforms are due to details of linker implementation.
-
-
.. rubric:: Tracebacks From Anywhere in a Program
It is possible to get a symbolic stack traceback
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);
Call_Me_Second;
end Call_Me_First;
end Pck;
+
+ with GNAT.IO; use GNAT.IO;
+ with GNAT.Debug_Utilities;
+ with GNAT.Traceback;
+ with System;
+
with Pck; use Pck;
procedure Foo is
+ LA : constant System.Address := \
+ GNAT.Traceback.Executable_Load_Address;
+
+ use type System.Address;
+
begin
+ if LA /= System.Null_Address then
+ Put_Line ("Load address: " & GNAT.Debug_Utilities.Image_C (LA));
+ end if;
+
Global_Val := 123;
Call_Me_First;
end Foo;
@copying
@quotation
-GNAT User's Guide for Native Platforms , Nov 28, 2022
+GNAT User's Guide for Native Platforms , Dec 01, 2022
AdaCore
P2;
end STB;
@end example
-@end quotation
-
-This program will output:
-
-@quotation
@example
+$ gnatmake stb -g -bargs -E -largs -no-pie
$ stb
raised CONSTRAINT_ERROR : stb.adb:12 range check failed
@end example
@example
-$ gnatmake -g .\stb -bargs -E
+$ gnatmake -g stb -bargs -E
$ stb
0040149F in stb.p1 at stb.adb:8
@end example
@end quotation
-In the above example the @code{.\} syntax in the @code{gnatmake} command
-is currently required by @code{addr2line} for files that are in
-the current working directory.
-Moreover, the exact sequence of linker options may vary from platform
-to platform.
-The above @code{-largs} section is for Windows platforms. By contrast,
-under Unix there is no need for the @code{-largs} section.
-Differences across platforms are due to details of linker implementation.
-
@subsubheading Tracebacks From Anywhere in a Program