Next: , Up: Symbolic Traceback


30.14.2.1 Tracebacks From Exception Occurrences
     with Ada.Text_IO;
     with GNAT.Traceback.Symbolic;
     
     procedure STB is
     
        procedure P1 is
        begin
           raise Constraint_Error;
        end P1;
     
        procedure P2 is
        begin
           P1;
        end P2;
     
        procedure P3 is
        begin
           P2;
        end P3;
     
     begin
        P3;
     exception
        when E : others =>
           Ada.Text_IO.Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E));
     end STB;
     $ gnatmake -g .\stb -bargs -E -largs -lgnat -laddr2line -lintl
     $ stb
     
     0040149F in stb.p1 at stb.adb:8
     004014B7 in stb.p2 at stb.adb:13
     004014CF in stb.p3 at stb.adb:18
     004015DD in ada.stb at stb.adb:22
     00401461 in main at b~stb.adb:168
     004011C4 in __mingw_CRTStartup at crt1.c:200
     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 -largs section is for Windows platforms. By contrast, under Unix there is no need for the -largs section. Differences across platforms are due to details of linker implementation.