From: Phil Muldoon <pmuldoon@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch][python] PR python/16324 (frame_id_eq check invalid)
Date: Wed, 26 Feb 2014 08:49:00 -0000 [thread overview]
Message-ID: <530DAA99.6090209@redhat.com> (raw)
This patch removes an invalid call to frame_id_eq. As the bug
reporter noted, a frame_id_eq on two null_frame_ids will always return
False (not True as expected in code). Add an assert over a Python
error because this scenario is fatal (a null_frame_id should never be the
result from a valid frame). A null_frame_id can be returned if the
frame fetching function was passed a NULL (already checked earlier in
the code), or if the frame is the SENTINEL (which it can't be, we are
traversing the opposite way to encounter that).
In the case of this check, GDB itself will have somehow corrupted the
frame stack, in which case, the only thing to do is exit. I normally
don't do this level of paranoia checking, but I wanted to respect the
original author's intention.
OK?
Cheers,
Phil
--
2014-02-26 Phil Muldoon <pmuldoon@redhat.com>
PR python/16324
* python/py-finishbreakpoint.c (bpfinishpy_init): Assert on
frame_id_p failing from a valid frame. Remove old frame_id_eq
check.
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 712a9ee..15952e3 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -207,9 +207,12 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
else
{
frame_id = get_frame_id (prev_frame);
- if (frame_id_eq (frame_id, null_frame_id))
- PyErr_SetString (PyExc_ValueError,
- _("Invalid ID for the `frame' object."));
+
+ /* If prev_frame != NULL, and get_frame_id cannot return
+ the frame_id, there is nothing more to be done. At
+ this point, assert that a valid frame id is
+ returned. */
+ gdb_assert (frame_id_p (frame_id) != 0);
}
}
}
next reply other threads:[~2014-02-26 8:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 8:49 Phil Muldoon [this message]
2014-02-26 11:12 ` Pedro Alves
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=530DAA99.6090209@redhat.com \
--to=pmuldoon@redhat.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