Re: RFC: %ebp-based backtrace patch

Michael Matz
2009-07-07T12:15:33Z

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.