This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: backtrace() missing some frames on 32bit x86_64-linux?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: FX Coudert <fxcoudert at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 12 Aug 2007 13:15:02 +0200
- Subject: Re: backtrace() missing some frames on 32bit x86_64-linux?
- References: <5DAAEFCC-48BD-4ABC-AF93-F94FE96C8D88@gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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