From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10072 invoked by alias); 13 Nov 2005 18:36:29 -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 10043 invoked by uid 22791); 13 Nov 2005 18:36:26 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sun, 13 Nov 2005 18:36:26 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1EbMiG-00016L-6q; Sun, 13 Nov 2005 13:36:24 -0500 Date: Sun, 13 Nov 2005 18:57:00 -0000 From: Daniel Jacobowitz To: Andrew STUBBS Cc: gdb-patches@sources.redhat.com Subject: Re: [SH][PATCH] Disable ABI frame sniffer Message-ID: <20051113183624.GE3599@nevyn.them.org> Mail-Followup-To: Andrew STUBBS , gdb-patches@sources.redhat.com References: <43722DEF.8060300@st.com> <20051110013122.GB11334@nevyn.them.org> <437321EE.7010904@st.com> <20051110133905.GB21420@nevyn.them.org> <43735A1D.6010406@st.com> <20051110231336.GB3195@nevyn.them.org> <4374863D.60601@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4374863D.60601@st.com> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-11/txt/msg00173.txt.bz2 On Fri, Nov 11, 2005 at 11:53:33AM +0000, Andrew STUBBS wrote: > >See Mark's reply for more on this. Had you said what your problem > >really was, we could have saved a couple of back-and-forth exchanges; > >I'm extremely familiar with the problem of finding clean ways to > >terminate the backtrace. > > OK, I'm listening. If we can get it so that both the 0xdeadbeef frames > (one which comes from the dwarf unwinder - see my posting yesterday) are > ignored then that would be a bonus. What we need is to examine the alternatives for cleanly marking the end of a stack frame - there are quite a few - and find one which will work for your situation. Here's the easiest, in that it only requires changing one of the three pieces of software involved (runtime, compiler, debugger): Instead of whatever C language routine you use to start threads, start them using an assembly wrapper. Have it set up a non-unwindable frame using DWARF2 CFI as mentioned in one of my earlier postings in this thread. You can do this easily by marking the return address column as undefined. Then have it call the C thread start routine. GDB will cleanly terminate the backtrace right there You'll have one more frame in your stack, but it will be a real frame. Other alternatives: - Add a GCC attribute to mark a function as "never called directly, not backtraceable" in the CFI. Annotate the runtime library to mark the thread start routine with this attribute. I'm not real fond of this solution, though. - Add a way for a sniffer to indicate "I do recognize how to unwind this frame, but I recognize it as the end of the stack" to solve the current off-by-one problem. This could be quite nice... -- Daniel Jacobowitz CodeSourcery, LLC