[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: backtrace of all stack frames, without debugger




On Thu, 13 Sep 2001, Nadav Har'El wrote:

> Ok, so that's a nice and useful trick. But I want to improve it to show the
> code addresses of all function calls on the stack frames, not just the last
> call.

the answer is in the question. look at /usr/include/execinfo.h . the
ufnctions are there. one problem i noticed is that on a redhat 6.2 system,
with an unpatched glibc, the translation of symbol addresses to symbol
names does not work for symbols located directly in the binary file, even
if i compile with 'gcc -rdynamic' as mentioned on various mailing lists
whose messages were located via google.

so you can invoke 'backtrace', then output the output via
'backtrace_symbols_fd', and finally, let the user run an external script
that uses 'addr2line --functions' to perform the address-to-symbol
translation.

ofcourse, if 'backtrace_symbols_fd' does perform proper translation on
your system, then your life is surely easier.

--
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy


=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il