This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/RFC] dwarf2-frame read_reg


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  <msnyder@redhat.com>
> 
> 	* 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  <dan@codesourcery.com>

	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]