Next: Tracebacks From Anywhere in a Program (non-symbolic), Previous: Tracebacks From an Unhandled Exception, Up: Non-Symbolic Traceback
Non-symbolic tracebacks are obtained by using the -E binder argument.
The stack traceback is attached to the exception information string, and can
be retrieved in an exception handler within the Ada program, by means of the
Ada95 facilities defined in Ada.Exceptions
. Here is a simple example:
with Ada.Text_IO; with Ada.Exceptions; procedure STB is use Ada; use Ada.Exceptions; procedure P1 is K : Positive := 1; begin K := K - 1; exception when E : others => Text_IO.Put_Line (Exception_Information (E)); end P1; procedure P2 is begin P1; end P2; begin P2; end STB;
This program will output:
$ stb Exception name: CONSTRAINT_ERROR Message: stb.adb:12 Call stack traceback locations: 0x4015e4 0x401633 0x401644 0x401461 0x4011c4 0x4011f1 0x77e892a4