backtrace() missing some frames on 32bit x86_64-linux?

Jakub Jelinek jakub@redhat.com
Sun Aug 12 11:09:00 GMT 2007


On Sat, Aug 11, 2007 at 12:07:26AM +0100, FX Coudert wrote:
> Hi glibc hackers,
> 
> The GNU Fortran runtime library (part of GCC) uses backtrace() on  
> glibc systems to provide backtraces of different kinds of errors.  
> When used from a signal handler, I've experienced a case where the  
> backtrace is missing a frame when compiled and linked as 32bit, but  
> is OK as 64bit. The following short C testcase reproduces this (glibc  
> 2.3.6 on linux 2.6.18, amd64):

If you don't compile it as 32-bit with -fasynchronous-unwind-tables,
that must be expected.
For -m64 -fa-u-t is the default (and x86_64 backtrace() only uses
unwind info, nothing else).
i?86 32-bit backtrace() uses unwind info as long as the unwind info
is present and then falls back to the old method of following saved
frame pointer and return address on the stack.  That method
works for -fno-omit-frame-pointer 32-bit code, but doesn't for
signal frames nor for -fomit-frame-pointer code.  If your testcase
isn't compiled with -fa-u-t, then handler is the first frame in the
backtrace() that doesn't have unwind info, so backtrace() stops there
using unwind info and the rest is done using the simple method.

	Jakub



More information about the Libc-alpha mailing list