summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-02-28 19:21:44 +0000
committerTom Tromey <tromey@redhat.com>2013-02-28 19:21:44 +0000
commitdd5fa3e77282d2ea30ebba9ccaca67a5d978ca9d (patch)
treead24836ca1757aef1cac7633da1a620e3fad7414
parente60bb1dd35da645e3449fda680291abc26e1cc60 (diff)
downloadbinutils-gdb-dd5fa3e77282d2ea30ebba9ccaca67a5d978ca9d.tar.gz
* py-finishbreakpoint.c (bpfinishpy_init): Reorganize to call
frame_object_to_frame_info inside TRY_CATCH.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/python/py-finishbreakpoint.c69
2 files changed, 39 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 77bae9b6cb8..b9c67570d3c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2013-02-28 Tom Tromey <tromey@redhat.com>
+ * py-finishbreakpoint.c (bpfinishpy_init): Reorganize to call
+ frame_object_to_frame_info inside TRY_CATCH.
+
+2013-02-28 Tom Tromey <tromey@redhat.com>
+
* py-block.c (gdbpy_block_for_pc): Call block_for_pc inside
TRY_CATCH.
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 56853088d67..d3d6bfdb897 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -173,39 +173,43 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
&frame_obj, &internal))
return -1;
- /* Default frame to gdb.newest_frame if necessary. */
- if (!frame_obj)
- frame_obj = gdbpy_newest_frame (NULL, NULL);
- else
- Py_INCREF (frame_obj);
-
- frame = frame_object_to_frame_info (frame_obj);
- Py_DECREF (frame_obj);
-
- if (frame == NULL)
- goto invalid_frame;
-
TRY_CATCH (except, RETURN_MASK_ALL)
{
- prev_frame = get_prev_frame (frame);
- if (prev_frame == 0)
- {
- PyErr_SetString (PyExc_ValueError, _("\"FinishBreakpoint\" not " \
- "meaningful in the outermost "\
- "frame."));
- }
- else if (get_frame_type (prev_frame) == DUMMY_FRAME)
- {
- PyErr_SetString (PyExc_ValueError, _("\"FinishBreakpoint\" cannot "\
- "be set on a dummy frame."));
- }
+ /* Default frame to newest frame if necessary. */
+ if (frame_obj == NULL)
+ frame = get_current_frame ();
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."));
- }
+ frame = frame_object_to_frame_info (frame_obj);
+
+ if (frame == NULL)
+ {
+ PyErr_SetString (PyExc_ValueError,
+ _("Invalid ID for the `frame' object."));
+ }
+ else
+ {
+ prev_frame = get_prev_frame (frame);
+ if (prev_frame == 0)
+ {
+ PyErr_SetString (PyExc_ValueError,
+ _("\"FinishBreakpoint\" not "
+ "meaningful in the outermost "
+ "frame."));
+ }
+ else if (get_frame_type (prev_frame) == DUMMY_FRAME)
+ {
+ PyErr_SetString (PyExc_ValueError,
+ _("\"FinishBreakpoint\" cannot "
+ "be set on a dummy frame."));
+ }
+ 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 (except.reason < 0)
{
@@ -305,11 +309,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
self_bpfinish->py_bp.bp->pspace = current_program_space;
return 0;
-
- invalid_frame:
- PyErr_SetString (PyExc_ValueError,
- _("Invalid ID for the `frame' object."));
- return -1;
}
/* Called when GDB notices that the finish breakpoint BP_OBJ is out of