comp.lang.ada
 help / color / mirror / Atom feed
From: Phil <phil-usenet@green-pike.co.uk>
Subject: GNAT compiler versions and addr2line
Date: Wed, 22 Aug 2018 13:01:58 -0000 (UTC)
Date: 2018-08-22T13:01:58+00:00	[thread overview]
Message-ID: <pljms6$jol$1@dont-email.me> (raw)

Hi,

I'm having problems getting useful debugging data from some GNAT
versions.  If I use the Debian FSF version (6.3.0), I get very little
useful unless running inside gdb.  In particular, the trace addresses
don't resolve to anything through addr2line.

Given this test program:
    $ cat foo.adb
    procedure Foo is

       procedure Able is
       begin
	  raise Constraint_Error with "It broke";
       end Able;

       procedure Baker is
       begin
	  Able;
       end Baker;

    begin
       Baker;
    end Foo;

Check the compiler version:

    $ gnatmake --version
    GNATMAKE 6.3.0
    […]

Build with debug info and binder argument -E:

    $ gnatmake -g foo -bargs -E
    […]

Run and try to use addr2line to get more information:
    $ ./foo
    Execution terminated by unhandled exception
    raised CONSTRAINT_ERROR : It broke
    Call stack traceback locations:
    0x55654f763530 0x55654f763566 0x55654f76354c 0x55654f7634e8 0x7f11a88292df 0x55654f763238 0xfffffffffffffffe

    $ addr2line -e foo -f 0x55654f763530 0x55654f763566 0x55654f76354c 0x55654f7634e8 0x7f11a88292df 0x55654f763238 0xfffffffffffffffe
    ??
    ??:0
    […and repeats ??, ??:0…]

Now, gdb using “catch exception” and “bt” will show some debugging:
    (gdb) bt
    #0  <__gnat_debug_raise_exception> (e=0x5555557560c0 <constraint_error>, 
	message=...) at s-excdeb.adb:40
    #1  0x00007ffff797603e in ada.exceptions.complete_occurrence (
	x=x@entry=0x555555757050) at a-except.adb:925
    #2  0x00007ffff797604d in ada.exceptions.complete_and_propagate_occurrence (
	x=x@entry=0x555555757050) at a-except.adb:936
    #3  0x00007ffff79760a0 in <__gnat_raise_exception> (
	e=0x5555557560c0 <constraint_error>, message=...) at a-except.adb:978
    #4  0x0000555555555532 in foo.able () at foo.adb:5
    #5  0x0000555555555568 in foo.baker () at foo.adb:10
    #6  0x000055555555554e in foo () at foo.adb:14
So the debugging data is accessible (somehow).

The same problem occurs with version 7.3.0 (from Debian unstable).  It
works if I use the current AdaCore community version instead:

    $ gnatmake --version
    GNATMAKE Community 2018 (20180524-73)
    $ ./foo 

    Execution of ./foo terminated by unhandled exception
    raised CONSTRAINT_ERROR : It broke
    Call stack traceback locations:
    0x4024e4 0x402519 0x402500 0x402473 0x7fb92acb72df 0x4020b8 0xfffffffffffffffe
    $ addr2line -e foo -f 0x4024e4 0x402519 0x402500 0x402473 0x7fb92acb72df 0x4020b8 0xfffffffffffffffe
    foo__able
    /tmp/ada/foo.adb:5
    foo__baker
    /tmp/ada/foo.adb:10
    _ada_foo
    /tmp/ada/foo.adb:14
    main
    /tmp/ada/b~foo.adb:185
    […]


I started looking at this because of problems using GNAT.Traceback.Symbolic
(the 6.3.0 version has a stub version isn't useful).  Getting
addr2line working would be very helpful.  I assume (hope!) it's a
PBCAK issue — does anyone have a suggestion for getting addr2line
working with the Debian/FSF versions? Am I missing something on the
command line?

TIA,

Phil.





             reply	other threads:[~2018-08-22 13:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 13:01 Phil [this message]
2018-08-22 13:50 ` GNAT compiler versions and addr2line Egil H H
2018-08-22 14:39   ` Phil
2018-08-22 14:15 ` gautier_niouzes
2018-08-22 14:41   ` Phil
2018-08-22 15:14 ` Alejandro R. Mosteo
2018-08-22 18:21   ` Phil
2018-08-22 19:43     ` Anh Vo
2018-08-22 20:30       ` Randy Brukardt
2018-08-23 18:00       ` Phil
2018-08-22 17:40 ` Jeffrey R. Carter
2018-08-22 21:10 ` Brian Drummond
2018-08-23 17:21   ` Simon Wright
2018-08-23 17:50   ` Phil
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox