This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding line numbers to backtrace()


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]