From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30194 invoked by alias); 19 Oct 2007 12:40:36 -0000 Received: (qmail 30179 invoked by uid 22791); 19 Oct 2007 12:40:34 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 19 Oct 2007 12:40:30 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 44728982CA; Fri, 19 Oct 2007 12:40:28 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id C9E6D980A7; Fri, 19 Oct 2007 12:40:27 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1Iir9O-00081e-Su; Fri, 19 Oct 2007 08:40:26 -0400 Date: Fri, 19 Oct 2007 12:40:00 -0000 From: Daniel Jacobowitz To: Ulrich Weigand Cc: gdb@sourceware.org, Mark Kettenis Subject: Re: [RFC] Using values to handle unwinding Message-ID: <20071019124026.GA30095@caradoc.them.org> Mail-Followup-To: Ulrich Weigand , gdb@sourceware.org, Mark Kettenis References: <20071017160350.GA26804@caradoc.them.org> <200710191210.l9JCA71T027874@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200710191210.l9JCA71T027874@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00169.txt.bz2 On Fri, Oct 19, 2007 at 02:10:07PM +0200, Ulrich Weigand wrote: > I think this is an excellent idea. I'm wondering how this plays with > special conversions needed for certain registers, see e.g. the > discussion we had last December that led to introduction of the > value_from_register gdbarch callback. > > For example, while we do have ways of performing special conversions > on the registers themselves, there is no straightforward way to do so > for unwound register contents. Maybe if we're going to using values > to represent those, we could allow the architecture to perform type- > specific conversions on those (this should e.g. allow me to eliminate > a specical pseudo on the SPU that I'm using to hold the properly > converted unwound stack pointer register contents). I see we ended up with both "gdbarch_value_from_register" and "gdbarch_register_to_value". That's unfortunately confusing :-( The patch I posted should make things neither better nor worse, because reading a variable from a register (hardware or saved in a frame) will still call value_from_register. We'll get the raw bytes by using the value method but call gdbarch_value_from_register and get_frame_register_bytes for the final value. So everything works the same as before. Perhaps we can adjust value_from_register to convert one struct value * representing a register's contents to another representing its value in a particular type? It's a machine-dependent variant of a cast. > B.t.w. there's another change in the patch: the elimination of the > prev_pc unwinder method. Could you explain the reason why this is > now no longer necessary? Sorry, I should have separated that out. There is only one definition of prev_pc anywhere. Here it is: static CORE_ADDR sentinel_frame_prev_pc (struct frame_info *next_frame, void **this_prologue_cache) { struct gdbarch *gdbarch = get_frame_arch (next_frame); return gdbarch_unwind_pc (gdbarch, next_frame); } And here's the call, with comments removed for brevity: if (this_frame->unwind->prev_pc != NULL) /* A per-frame unwinder, prefer it. */ pc = this_frame->unwind->prev_pc (this_frame->next, &this_frame->prologue_cache); else if (gdbarch_unwind_pc_p (get_frame_arch (this_frame))) pc = gdbarch_unwind_pc (get_frame_arch (this_frame), this_frame); So, as you can see, there's no longer any need for the hook in current targets. -- Daniel Jacobowitz CodeSourcery