From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27947 invoked by alias); 10 Nov 2005 23:00:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27757 invoked by uid 22791); 10 Nov 2005 23:00:16 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 10 Nov 2005 23:00:16 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id jAAMxenY023932; Thu, 10 Nov 2005 23:59:40 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id jAAMxexO028317; Thu, 10 Nov 2005 23:59:40 +0100 (CET) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id jAAMxdJC029449; Thu, 10 Nov 2005 23:59:39 +0100 (CET) Date: Fri, 11 Nov 2005 00:10:00 -0000 Message-Id: <200511102259.jAAMxdJC029449@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: andrew.stubbs@st.com CC: drow@false.org, gdb-patches@sources.redhat.com In-reply-to: <43735A1D.6010406@st.com> (message from Andrew STUBBS on Thu, 10 Nov 2005 14:33:01 +0000) Subject: Re: [SH][PATCH] Disable ABI frame sniffer References: <43722DEF.8060300@st.com> <20051110013122.GB11334@nevyn.them.org> <437321EE.7010904@st.com> <20051110133905.GB21420@nevyn.them.org> <43735A1D.6010406@st.com> X-SW-Source: 2005-11/txt/msg00139.txt.bz2 > Date: Thu, 10 Nov 2005 14:33:01 +0000 > From: Andrew STUBBS > > 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