From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zack Weinberg To: Frank Pilhofer Cc: egcs@cygnus.com Subject: Re: Call Stack (Reflection) Date: Sun, 31 Jan 1999 23:58:00 -0000 Message-id: <199901181437.JAA19681@blastula.phys.columbia.edu> References: <19990118153008.46624@hera.rbi.informatik.uni-frankfurt.de> X-SW-Source: 1999-01n/msg00692.html On Mon, 18 Jan 1999 15:30:08 +0100, Frank Pilhofer wrote: >On Sun, Jan 17, 1999 at 08:12:22PM +0100, Andreas Jaeger wrote: >> >> Have a look at glibc 2.1 (a test release called glibc-2.0.110 is >> available from ftp://alpha.gnu.org/gnu ). It provides output of the >> backtrace for different architectures. The implementation can be >> found in the debug and sysdeps subdirs (backtrace* functions). >> > > Thanks for the pointer. I have managed to extract the source and to >compile the backtrace code by using dladdr() instead of _dl_addr(). >However, all I see in the backtrace is addresses which do not get >resolved into symbolic names. > Further testing shows that dladdr() succeeds, but returns an empty >file name and the "nearest" symbol name `_start'. Do I have to use >special compile-time or link-time options? At the moment, I use -g >-fno-omit-frame-pointer. dladdr() won't give you anything useful except for exported dynamic symbols in shared objects (i.e. libraries and modules loaded with dlopen()). You want to print out the raw addresses and use addr2line to clean them up. Take a look at debug/catchsegv.sh in the libc code. I wouldn't bother with backtracesyms() at all. zw