Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: [OB] Simplify dwarf2-frame.c:read_addr_from_reg. (was: [RFA] Rename "read_reg" into "read_addr_from_reg" in struct dwarf_expr_context_funcs)
Date: Mon, 18 Nov 2013 12:39:00 -0000	[thread overview]
Message-ID: <528A02E5.7070309@redhat.com> (raw)
In-Reply-To: <20131117030202.GA3481@adacore.com>

On 11/17/2013 03:02 AM, Joel Brobecker wrote:
> Thanks! Patch now pushed.

I've pushed this obvious patch too.

-------
Simplify dwarf2-frame.c:read_addr_from_reg.

Since 'struct dwarf_expr_context_funcs::read_addr_from_reg' is now
only used for addresses, we can make it use unpack_pointer.  And since
we now have 'struct dwarf_expr_context_funcs'::get_reg_value, there's
no need for speculation about using values here.

Tested on x86_64 Fedora 17.

gdb/
2013-11-18  Pedro Alves  <palves@redhat.com>

	* dwarf2-frame.c (read_addr_from_reg): Remove stale comment and
	use unpack_pointer.
---

 gdb/ChangeLog      |    5 +++++
 gdb/dwarf2-frame.c |    7 +------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 53de4fb..7fc09e0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-18  Pedro Alves  <palves@redhat.com>
+
+	* dwarf2-frame.c (read_addr_from_reg): Remove stale comment and
+	use unpack_pointer.
+
 2013-11-18  Joel Brobecker  <brobecker@adacore.com>
 
 	* mi/mi-main.c (mi_cmd_list_features): Add "language-options"
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index b53c015..cd4f47c 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -298,12 +298,7 @@ read_addr_from_reg (void *baton, int reg)
   buf = alloca (register_size (gdbarch, regnum));
   get_frame_register (this_frame, regnum, buf);
 
-  /* 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_addr_from_reg and the associated interfaces
-     should deal with "struct value" instead of CORE_ADDR.  */
-  return unpack_long (register_type (gdbarch, regnum), buf);
+  return unpack_pointer (register_type (gdbarch, regnum), buf);
 }
 
 /* Implement struct dwarf_expr_context_funcs' "get_reg_value" callback.  */


      reply	other threads:[~2013-11-18 12:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 15:21 [RFA] Fix DW_OP_GNU_regval_type with FP registers Joel Brobecker
2013-11-14 20:12 ` Pedro Alves
2013-11-14 21:02 ` Tom Tromey
2013-11-15 12:19   ` Joel Brobecker
2013-11-15 14:54     ` Pedro Alves
2013-11-16  5:46       ` [RFA] Rename "read_reg" into "read_addr_from_reg" in struct dwarf_expr_context_funcs Joel Brobecker
2013-11-17  3:02         ` Pedro Alves
2013-11-17  9:43           ` pushed: " Joel Brobecker
2013-11-18 12:39             ` Pedro Alves [this message]

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=528A02E5.7070309@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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