comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: GNAT compiler versions and addr2line
Date: Thu, 23 Aug 2018 18:21:26 +0100
Date: 2018-08-23T18:21:26+01:00	[thread overview]
Message-ID: <lyd0u9m221.fsf@pushface.org> (raw)
In-Reply-To: plkjfj$9ef$1@dont-email.me

Brian Drummond <brian@shapes.demon.co.uk> writes:

> Basically Debian changed its policy (possibly for security reasons)
> regarding Address Space Randomisation and position-independent
> executables - not sure exactly what, perhaps they turned on PIE by
> default, to allow address space randomisation. I've seen all those
> 5555s in addresses so treated... (not so random, then?)
>
> Anyway, apparently addr2line doesn't work so well with random
> addresses...

On the Mac, we used to use -no_pie (in fact, I think it was the default,
not sure) but nowadays pie is enabled and we see

   $ ~/tmp/raiser

   Execution of /Users/simon/tmp/raiser terminated by unhandled exception
   raised PROGRAM_ERROR : raiser.adb:3 explicit raise
   Load address: 0x103df0000                         <==========
   Call stack traceback locations:
   0x103df0cc1 0x103df0c64

and the equivalent of addr2line, atos, lets us specify the actual load
address with -l:

   $ atos -o ~/tmp/raiser -l 0x103df0000 0x103df0cc1 0x103df0c64
   _ada_raiser (in raiser) (raiser.adb:3)
   main (in raiser) (b~raiser.adb:158)

AdaCore provided the VxWorks port with a utility vxaddr2line (??)
which was a shell wrapper round the powerpc-wrs-vxworks-addr2line; I
never looked into it, but I suppose it fixed up the addresses reported
in the stack dump (which were AFAICR relative to address 0) by adding
the actual load address passed as the first address argument.

Something similar might be done on Debian, but of course you'd have to
know tha actual load address .. determined at runtime .. so it means a
change to GNAT to report the load address in the stack dump.

Or you could build with pie disabled (but the .so's are pie), or run
with pie disabled; suggestion on StackOverflow to 'run under "setarch
x86_64 -R"', no idea whether that's useful.

  reply	other threads:[~2018-08-23 17:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 13:01 GNAT compiler versions and addr2line Phil
2018-08-22 13:50 ` 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 [this message]
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