* py-finishbreakpoint.c (bpfinishpy_init): Reorganize to call

frame_object_to_frame_info inside TRY_CATCH.
This commit is contained in:
Tom Tromey
2013-02-28 19:21:44 +00:00
parent e60bb1dd35
commit dd5fa3e772
2 changed files with 39 additions and 35 deletions

View File

@@ -1,3 +1,8 @@
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> 2013-02-28 Tom Tromey <tromey@redhat.com>
* py-block.c (gdbpy_block_for_pc): Call block_for_pc inside * py-block.c (gdbpy_block_for_pc): Call block_for_pc inside

View File

@@ -173,30 +173,33 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
&frame_obj, &internal)) &frame_obj, &internal))
return -1; return -1;
/* Default frame to gdb.newest_frame if necessary. */ TRY_CATCH (except, RETURN_MASK_ALL)
if (!frame_obj) {
frame_obj = gdbpy_newest_frame (NULL, NULL); /* Default frame to newest frame if necessary. */
if (frame_obj == NULL)
frame = get_current_frame ();
else else
Py_INCREF (frame_obj);
frame = frame_object_to_frame_info (frame_obj); frame = frame_object_to_frame_info (frame_obj);
Py_DECREF (frame_obj);
if (frame == NULL) if (frame == NULL)
goto invalid_frame; {
PyErr_SetString (PyExc_ValueError,
TRY_CATCH (except, RETURN_MASK_ALL) _("Invalid ID for the `frame' object."));
}
else
{ {
prev_frame = get_prev_frame (frame); prev_frame = get_prev_frame (frame);
if (prev_frame == 0) if (prev_frame == 0)
{ {
PyErr_SetString (PyExc_ValueError, _("\"FinishBreakpoint\" not " \ PyErr_SetString (PyExc_ValueError,
"meaningful in the outermost "\ _("\"FinishBreakpoint\" not "
"meaningful in the outermost "
"frame.")); "frame."));
} }
else if (get_frame_type (prev_frame) == DUMMY_FRAME) else if (get_frame_type (prev_frame) == DUMMY_FRAME)
{ {
PyErr_SetString (PyExc_ValueError, _("\"FinishBreakpoint\" cannot "\ PyErr_SetString (PyExc_ValueError,
_("\"FinishBreakpoint\" cannot "
"be set on a dummy frame.")); "be set on a dummy frame."));
} }
else else
@@ -207,6 +210,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
_("Invalid ID for the `frame' object.")); _("Invalid ID for the `frame' object."));
} }
} }
}
if (except.reason < 0) if (except.reason < 0)
{ {
gdbpy_convert_exception (except); gdbpy_convert_exception (except);
@@ -305,11 +309,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
self_bpfinish->py_bp.bp->pspace = current_program_space; self_bpfinish->py_bp.bp->pspace = current_program_space;
return 0; 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 /* Called when GDB notices that the finish breakpoint BP_OBJ is out of