Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch][python] PR python/16324 (frame_id_eq check invalid)
@ 2014-02-26  8:49 Phil Muldoon
  2014-02-26 11:12 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Muldoon @ 2014-02-26  8:49 UTC (permalink / raw)
  To: gdb-patches


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);
         }
     }
     }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-26 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26  8:49 [patch][python] PR python/16324 (frame_id_eq check invalid) Phil Muldoon
2014-02-26 11:12 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox