Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevin@buettner.to>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 4/5] Make gdb.PendingFrame.read_register handle "user" registers
Date: Wed, 02 Nov 2016 22:23:00 -0000	[thread overview]
Message-ID: <20161102152332.29708966@pinnacle.lan> (raw)
In-Reply-To: <20161102151111.2462c806@pinnacle.lan>

[ FYI, Pedro has already OK'd this one.  It's unchanged from the version
  in the earlier series, but is included here for completeness. ]

The C function, pending_framepy_read_register(), which implements
the python interface gdb.PendingFrame.read_register does not handle
the so called "user" registers like "pc".  An assertion error is
triggered due to the user registers having numbers larger than or
equal to gdbarch_num_regs(gdbarch).

With the VALUE_FRAME_ID tweak in place, the call to
get_frame_register_value() can simply be replaced by a call to
value_of_register(), which handles both real registers as well as the
user registers.

gdb/ChangeLog:
    
    	* python/py-unwind.c (pending_framepy_read_register): Use
    	value_of_register() instead of get_frame_register_value().
---
 gdb/python/py-unwind.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index cc685ae..6740034 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -412,7 +412,12 @@ pending_framepy_read_register (PyObject *self, PyObject *args)
 
   TRY
     {
-      val = get_frame_register_value (pending_frame->frame_info, regnum);
+      /* Fetch the value associated with a register, whether it's
+	 a real register or a so called "user" register, like "pc",
+	 which maps to a real register.  In the past,
+	 get_frame_register_value() was used here, which did not
+	 handle the user register case.  */
+      val = value_of_register (regnum, pending_frame->frame_info);
       if (val == NULL)
         PyErr_Format (PyExc_ValueError,
                       "Cannot read register %d from frame.",


  parent reply	other threads:[~2016-11-02 22:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 22:11 [PATCH v2 0/5] Prevent more recursion in python based unwinders Kevin Buettner
2016-11-02 22:14 ` [PATCH v2 1/5] Extend test gdb.python/py-recurse-unwind.exp Kevin Buettner
2016-11-09 13:59   ` Pedro Alves
2016-11-16 18:52     ` Kevin Buettner
2016-11-16 22:46       ` Sergio Durigan Junior
2016-11-17 15:27         ` Kevin Buettner
2016-11-02 22:16 ` [PATCH v2 3/5] Distinguish sentinel frame from null frame Kevin Buettner
2016-11-02 22:20   ` Kevin Buettner
2016-11-09 14:48   ` Pedro Alves
2016-11-16 18:54     ` Kevin Buettner
2016-11-02 22:19 ` [PATCH v2 3/5] Change meaning of VALUE_FRAME_ID; rename to VALUE_NEXT_FRAME_ID Kevin Buettner
2016-11-09 14:48   ` Pedro Alves
2016-11-16 19:08     ` Kevin Buettner
2016-11-02 22:23 ` Kevin Buettner [this message]
2016-11-16 19:08   ` [PATCH v2 4/5] Make gdb.PendingFrame.read_register handle "user" registers Kevin Buettner
2016-11-02 22:26 ` [PATCH v2 5/5] Stash frame id of current frame before stashing frame id for previous frame Kevin Buettner
2016-11-09 14:48   ` Pedro Alves
2016-11-16 19:07     ` Kevin Buettner

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=20161102152332.29708966@pinnacle.lan \
    --to=kevin@buettner.to \
    --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