This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Unwinding CFI gcc practice of assumed `same value' regs
Hi,
On Tue, 12 Dec 2006, Andrew Haley wrote:
> > > In practice, %ebp either points to a call frame -- not necessarily
> > > the most recent one -- or is null. I don't think that having an
> > > optional frame pointer mees you can use %ebp for anything random at
> > > all, but we need to make a clarification request of the ABI.
> >
> > I don't see that as feasible. If %ebp/%rbp may be used as a general
> > callee-saved register, then it can hold any value.
>
> Sure, we already know that, as has been clear. The question is *if*
> %rbp may be used as a general callee-saved register that can hold any
> value.
Yes of course it was meant to be used such. The ABI actually only gives a
recommendation that %rbp should be zero in the outermost frame, it's not a
must. The ABI _requires_ proper .eh_frame descriptors when unwinding is
desired; so it's useless (and wrong) for any unwinder to look at %rbp and
determine if it should stop.
Alternatively (though not sanctioned by the ABI) all functions through
which unwinding is desired but for which no unwind info is created _have_
to use %rbp as frame pointer and not as general register. In that case
the zeroing of %rbp would be a usable stop condition for functions without
unwind info. But that's already outside the ABI.
Ciao,
Michael.