Using dwfl to enumerate frames of current thread

Ben Gamari ben at smart-cactus.org
Thu Aug 20 15:02:11 UTC 2015


Mark Wielaard <mjw at redhat.com> writes:

> On Thu, 2015-08-20 at 16:13 +0200, Ben Gamari wrote:
>> Mark Wielaard <mjw at redhat.com> writes:
>> > Could you post the binary somewhere?
>> > Then I will take a look at what is going wrong.
>> >
>> It can be found here (sorry for the size),
>> 
>>     http://home.smart-cactus.org/~ben/ghc-stage2
>
> Thanks.
>
>> With binutils I find,
>> 
>>     $ addr2line -e inplace/lib/bin/ghc-stage2 -f 0x12011b8
>>     ghc_Util_maybeReadFuzzzzy_info
>>     /opt/exp/ghc/ghc//compiler/utils/Util.hs:955
>> 
>> If I'm interpretting gdb correctly, elfutils seems to think there is
>> only one CU, which sounds like it could be the issue. By my count there
>> should be over 700,
>> 
>>     $ readelf -e  inplace/lib/bin/ghc-stage2 -w | grep -i  "File Name Table (" | wc -l
>>     742
>
> Still debugging, but the debug_info and line_info seem to be parsed
> correctly. The output is just slightly different between eu-readelf and
> binutils readelf:
>
> $ eu-readelf --debug-dump=info -N ./ghc-stage2 | grep "Compilation unit
> at offset" | wc --lines
> 742
>
> $ eu-readelf --debug-dump=decodedline -N ./ghc-stage2 | grep ^\ CU\  |
> wc --lines
> 742
>
Fair enough. However, I was basing my original statement not on the
output of elfutils' readelf but instead on libdwfl data structures
dumped in gdb.

As you may have realized by now, the problem begins in
dwfl_module_getsrc, which returns DWFL_E_ADDR_OUTOFRANGE.
If you look at the Dwfl_Module that gets passed to dwfl_module_getsrc,
you'll find that mod->ncu == 1 (which is confirmed by traversing the
mod->cu list). This struct me as rather odd.

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20150820/8fa38144/attachment-0001.sig>


More information about the elfutils-devel mailing list