From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14454 invoked by alias); 1 Jan 2007 20:35:42 -0000 Received: (qmail 14446 invoked by uid 22791); 1 Jan 2007 20:35:41 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 01 Jan 2007 20:35:35 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1H1Tsb-0005Hr-Gj; Mon, 01 Jan 2007 15:35:33 -0500 Date: Mon, 01 Jan 2007 20:35:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [patch RFC] Re: Notes on a frame_unwind_address_in_block problem Message-ID: <20070101203533.GA20094@nevyn.them.org> Mail-Followup-To: Mark Kettenis , gdb-patches@sourceware.org References: <20060706222157.GA1377@nevyn.them.org> <200607132020.k6DKKCSB023812@elgar.sibelius.xs4all.nl> <20060718183910.GB17864@nevyn.them.org> <20070101191927.GA14930@nevyn.them.org> <200701011954.l01Js85r031019@brahms.sibelius.xs4all.nl> <20070101200248.GA19073@nevyn.them.org> <200701012026.l01KQj6h022478@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200701012026.l01KQj6h022478@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00032.txt.bz2 On Mon, Jan 01, 2007 at 09:26:45PM +0100, Mark Kettenis wrote: > But if you're calling get_frame_func() you've already got a frame, so > you should know everything about it. The place to fix things is > probably get_frame_address_in_block(). For one thing it's probably > not a good idea to return an address that's lower than the code > address in the frame ID. Or perhaps it is enough to look at the > frame's type and simply call frame_pc_unwind for SIGTRAMP_FRAMEs. Hmm, get_frame_func may have been an ill-chosen example. A better one is frame_func_unwind. get_frame_func just wraps frame_func_unwind, and get_frame_address_in_block just wraps frame_unwind_address_in_block. I think that's a generally good thing - it encourages consistency in their results. The unwind variants are used all over GDB, not just during unwinding; this matters e.g. around main, where get_prev_frame might return NULL. And that's why my solution ended up complicated. When you're in frame_func_unwind you have to call frame_unwind_address_in_block, and at that point you might not know the type or even the unwinder of the previous frame. So I made frame_unwind_address_in_block do pretty much what you suggested above, and forbid calling it before we know the type of the previous frame. > > Hmm... I don't think it's possible, but it depends what qualifier you > > meant to put on "all targets". The only way I can see to do it would > > be with hand-written assembly and CFI and stack manipulation. I might > > be able to write a test which worked on all x86-64 systems and > > pretended to have create a signal frame, if that's what you wanted. > > Hmm, sorry yes, a test that would work on all i386 or x86-64 target > was what I actually meant. I can probably do that. I'll try this evening. -- Daniel Jacobowitz CodeSourcery