Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sourceware.org, Jim Blandy <jimb@red-bean.com>
Subject: Re: [RFA/RFC] dwarf2-frame read_reg
Date: Fri, 05 May 2006 19:44:00 -0000	[thread overview]
Message-ID: <20060505194429.GN31029@nevyn.them.org> (raw)
In-Reply-To: <443C7529.7020206@redhat.com>

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


  parent reply	other threads:[~2006-05-05 19:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-12  3:34 Michael Snyder
2006-04-12  4:42 ` Jim Blandy
2006-04-12 18:18   ` Mark Kettenis
2006-04-12 19:15     ` Michael Snyder
2006-04-20 17:21     ` Daniel Jacobowitz
2006-04-20 19:06       ` Michael Snyder
2006-04-20 19:10       ` Mark Kettenis
2006-04-12 19:20   ` Michael Snyder
2006-05-05 19:44 ` Daniel Jacobowitz [this message]
2006-05-17 15:01   ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060505194429.GN31029@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jimb@red-bean.com \
    --cc=msnyder@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox