From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15827 invoked by alias); 20 Apr 2006 17:21:20 -0000 Received: (qmail 15818 invoked by uid 22791); 20 Apr 2006 17:21:20 -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; Thu, 20 Apr 2006 17:21:18 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FWcq8-00053x-Mw; Thu, 20 Apr 2006 13:21:12 -0400 Date: Thu, 20 Apr 2006 17:21:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis Cc: jimb@red-bean.com, msnyder@redhat.com, gdb-patches@sourceware.org Subject: Re: [RFA/RFC] dwarf2-frame read_reg Message-ID: <20060420172112.GK11710@nevyn.them.org> Mail-Followup-To: Mark Kettenis , jimb@red-bean.com, msnyder@redhat.com, gdb-patches@sourceware.org References: <443C7529.7020206@redhat.com> <8f2776cb0604112142i32dcdf0dic8f44f2989311786@mail.gmail.com> <200604121817.k3CIH7nA021495@elgar.sibelius.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604121817.k3CIH7nA021495@elgar.sibelius.xs4all.nl> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes 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 X-SW-Source: 2006-04/txt/msg00284.txt.bz2 On Wed, Apr 12, 2006 at 08:17:07PM +0200, Mark Kettenis wrote: > > Date: Tue, 11 Apr 2006 21:42:01 -0700 > > From: "Jim Blandy" > > > > On 4/11/06, Michael Snyder wrote: > > > I want you guys to vett this change. I was getting wrong results > > > on a target where sizeof (SP) != sizeof (void *). The local func > > > read_reg was calling extract_unsigned_integer with the wrong size. > > > > Well, extract_typed_address requires the type of the register to be > > some sort of pointer. read_reg is given as a callback to the Dwarf > > expression evaluator in dwarf2expr.c, so it could be handed any > > register at all. > > > > How about unpack_long (buf, register_type (gdbarch, regnum))? > > Definitely regression-test this on several platforms... > > This is likely to be wrong for platforms where addresses are signed. It shouldn't be. unpack_long (struct type *type, const gdb_byte *valaddr) { ... case TYPE_CODE_PTR: case TYPE_CODE_REF: /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure whether we want this to be true eventually. */ return extract_typed_address (valaddr, type); which calls POINTER_TO_ADDRESS. And that will be the signed unpack for MIPS, and the unsigned unpack for other targets. So I think unpack_long is a good choice. (I didn't realize that before. I think I have another pending patch that this would be useful for - maybe the psaddr_t one?) -- Daniel Jacobowitz CodeSourcery