Ulrich Drepper <drepper(a)cygnus.com> writes:
wmperry(a)aventail.com (William M. Perry) writes:
> But does it work? :) I thought this would be nifty to use in our server,
> and I just tried it. I just threw in this code in the midst of it
> processing a connection:
>
> {
> void *array[250];
> int n = backtrace(array,250);
>
> backtrace_symbols_fd(array,n,fileno(stderr));
> }
>
> All I got was:
>
> [0x805d3f7]
> [0x805c21e]
> [0x805c994]
> [0x805c9fc]
> [0x805b40a]
> /lib/libc.so.6(__libc_start_main+0xeb)[0x401cfcb3]
> [0x8051ab1]
Which is the correct information. Do you know how program loading works?
An ELF file has parts which are loaded and those which are not. And
debugging info is never loaded. Therefore the backtrace functions have
no access to the function names etc.
But if you look at the catchsegv script coming with glibc 2.1 you'll
see how to get the missing informaiton.
Ah, I did not know catchsegv existed... that looks much better. Thanks for
the info.
-Bill P.