From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Alejandro R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: GNAT compiler versions and addr2line Date: Wed, 22 Aug 2018 17:14:42 +0200 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 22 Aug 2018 15:14:42 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="07088ef5fa0c5bf81aff96d319f10d9c"; logging-data="2383"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zxj+dYRfBEnQCF+mCQuu0" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Cancel-Lock: sha1:MhSullOHxj4AOCo4jQVEZ9lOOdY= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:54216 Date: 2018-08-22T17:14:42+02:00 List-Id: On 22/08/18 15:01, Phil wrote: > 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. I have seen the same up to current 7.3 FSF Ubuntu versions, and still haven't found a workaround :/ Alex. > > 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 , > 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 , 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. > > > >