This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: %ebp-based backtrace patch
- From: Michael Matz <matz at suse dot de>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Mark Kettenis <kettenis at gnu dot org>
- Date: Tue, 7 Jul 2009 14:15:19 +0200 (CEST)
- Subject: Re: RFC: %ebp-based backtrace patch
- References: <20090706183316.GA26074@caradoc.them.org> <y0mzlbhy3m8.fsf@fche.csb>
Hi,
On Mon, 6 Jul 2009, Frank Ch. Eigler wrote:
> Daniel Jacobowitz <drow@false.org> writes:
>
> > A number of Linux distributions are carrying the attached patch from
> > Michael Matz. [...]
> > https://bugzilla.novell.com/show_bug.cgi?id=390722#c25
> >[...]
> > * i386-tdep.c (i386_frame_cache): Assume anonymous functions use
> > a frame pointer.
> >[...]
>
> Could gdb partially disassemble such functions to check
> whether %ebp is likely being used as this heuristic expects?
Nope. We don't know the function borders. But there's another heuristic
that could potentially be useful: check if %ebp points not too far away
from %esp (and has a higher value). That way we would at least reject
functions that use %ebp to hold some low integer values.
Then we of course have the problem again of having to rely on %esp-4
containing the return address. That assumption doesn't really hold very
often. In fact it holds _only_ for frameless functions, of which there
aren't that many on x86. So we're screwed either way.
Ciao,
Michael.