Adding line numbers to backtrace()

Philip Prindeville philipp_subx@redfish-solutions.com
Fri Aug 24 23:00:00 GMT 2012


On 8/24/12 4:45 PM, Andreas Schwab wrote:
> Mike Frysinger <vapier@gentoo.org> writes:
>
>> the symbol table doesn't have line information, only the DWARF stuff does.  i'm 
>> not sure if we have DWARF parsers already in the C library ...
> The debugging sections are not loaded, so this cannot work.  Use
> addr2line(1) instead.
>
> Andreas.
>

I need it in a library (actually, a C++ toolkit called Poco). So I'd have to cut & paste the lines from addr2line to do the equivalent work. I was just hoping that all of that functionality was already all in one place.

Poco calls backtrace(), but it only gets the addresses, obviously. The addresses I then pass to dladdr() for file/function name/offset information from the address.

I can lift code from addr2line to extract the line numbers...

Just more work than I was wanting to do.

-Philip



More information about the Libc-alpha mailing list