[SH][PATCH] Disable ABI frame sniffer

Mark Kettenis mark.kettenis@xs4all.nl
Fri Nov 11 00:10:00 GMT 2005


> Date: Thu, 10 Nov 2005 14:33:01 +0000
> From: Andrew STUBBS <andrew.stubbs@st.com>
> 
> Daniel Jacobowitz wrote:
> > Quite on the contrary, my experience is that in most programs you'll
> > need it at least a couple of times, e.g. to get out of bits of libc or
> > linker-generated code.
> 
> Bare-machine (or OS21) sh-elf doesn't use glibc with all its 
> complications. We use newlib and we always compile it with debug info 
> and CFI so there is it should never need to fall back.

But can you guarantee that other people won't need the fallback?

> > For any frame with CFI, the CFI is used in preference.  If you don't
> > want the fallback unwinder to come into play, if as you claim you
> > really don't need it, then find out why it's being triggered in the
> > first place.
> 
> The problem only occurs in threads (unless 'set backtrace pastmain' is 
> set, in which case it happens in any program) when the backtrace falls 
> off the end of the program. There are no more frames because there's no 
> more stack, but there's no way to know that unless you assume the CFI 
> and program run out at the same time.

Ah there's your real problem.  The unwinder walks off the stack and at
that point concludes the stack is thrashed.  This is a recurring
problem on many platforms, especially when threads are involved.  It
might be possible to detect the end of the stack on your platform and
teach the fallback unwinder about it.  That might involve some changes
to the threads library and/or crt0 though, to make it mark the end of
the stack properly.  It'd also be great to have a way to encode the
end of the stack in CFI.  Unfortunately there has been quite a bit of
talk about this, but nobody has implemeneted anything yet.

So I mostly agree with Daniel, and think your patch is a bad idea.  Sorry.

Mark



More information about the Gdb-patches mailing list