From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5556 invoked by alias); 5 May 2006 19:44:37 -0000 Received: (qmail 5545 invoked by uid 22791); 5 May 2006 19:44:35 -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; Fri, 05 May 2006 19:44:31 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1Fc6E1-00019p-1u; Fri, 05 May 2006 15:44:29 -0400 Date: Fri, 05 May 2006 19:44:00 -0000 From: Daniel Jacobowitz To: Michael Snyder Cc: gdb-patches@sourceware.org, Jim Blandy Subject: Re: [RFA/RFC] dwarf2-frame read_reg Message-ID: <20060505194429.GN31029@nevyn.them.org> Mail-Followup-To: Michael Snyder , gdb-patches@sourceware.org, Jim Blandy References: <443C7529.7020206@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <443C7529.7020206@redhat.com> 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-05/txt/msg00089.txt.bz2 On Tue, Apr 11, 2006 at 08:34:01PM -0700, 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. > 2006-04-11 Michael Snyder > > * dwarf2-frame.c (read_reg): Use register type instead of > builtin_data_pointer_type to extract register's value. I think the thread consensus was to do the attached. I've tested it on x86_64, and I'm fairly confident in it. Any concerns? (Concerns that come with test results for some other platform are the best kind!) -- Daniel Jacobowitz CodeSourcery 2006-05-05 Daniel Jacobowitz * dwarf2-frame.c: Include "value.h". (read_reg): Use unpack_long and register_type. * Makefile.in (dwarf2-frame.o): Update. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.811 diff -u -p -r1.811 Makefile.in --- Makefile.in 23 Apr 2006 14:15:01 -0000 1.811 +++ Makefile.in 5 May 2006 19:41:34 -0000 @@ -1907,7 +1907,8 @@ dwarf2expr.o: dwarf2expr.c $(defs_h) $(s dwarf2-frame.o: dwarf2-frame.c $(defs_h) $(dwarf2expr_h) $(elf_dwarf2_h) \ $(frame_h) $(frame_base_h) $(frame_unwind_h) $(gdbcore_h) \ $(gdbtypes_h) $(symtab_h) $(objfiles_h) $(regcache_h) \ - $(gdb_assert_h) $(gdb_string_h) $(complaints_h) $(dwarf2_frame_h) + $(gdb_assert_h) $(gdb_string_h) $(complaints_h) $(dwarf2_frame_h) \ + $(value_h) dwarf2loc.o: dwarf2loc.c $(defs_h) $(ui_out_h) $(value_h) $(frame_h) \ $(gdbcore_h) $(target_h) $(inferior_h) $(ax_h) $(ax_gdb_h) \ $(regcache_h) $(objfiles_h) $(exceptions_h) $(elf_dwarf2_h) \ Index: dwarf2-frame.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v retrieving revision 1.59 diff -u -p -r1.59 dwarf2-frame.c --- dwarf2-frame.c 5 Apr 2006 20:01:19 -0000 1.59 +++ dwarf2-frame.c 5 May 2006 19:41:35 -0000 @@ -32,6 +32,7 @@ #include "symtab.h" #include "objfiles.h" #include "regcache.h" +#include "value.h" #include "gdb_assert.h" #include "gdb_string.h" @@ -214,7 +215,13 @@ read_reg (void *baton, int reg) buf = alloca (register_size (gdbarch, regnum)); frame_unwind_register (next_frame, regnum, buf); - return extract_typed_address (buf, builtin_type_void_data_ptr); + + /* Convert the register to an integer. This returns a LONGEST + rather than a CORE_ADDR, but unpack_pointer does the same thing + under the covers, and this makes more sense for non-pointer + registers. Maybe read_reg and the associated interfaces should + deal with "struct value" instead of CORE_ADDR. */ + return unpack_long (register_type (gdbarch, regnum), buf); } static void