2011-10-27 Phil Muldoon <pmuldoon@redhat.com>

* python/py-breakpoint.c (bppy_set_enabled): Use TRY_CATCH.
	(bppy_set_task): Ditto.
	(bppy_delete_breakpoint): Ditto.
	* python/py-symbol.c (gdbpy_lookup_symbol): Ditto.
	(gdbpy_lookup_global_symbol): Ditto.
	* python/py-lazy-string.c (stpy_convert_to_value): Ditto.
	* python/py-frame.c (frapy_is_valid): Ditto.
	(frame_info_to_frame_object): Ditto.
	* python/py-type.c (typy_lookup_type): Ditto.
	(typy_getitem): Ditto.
	(typy_has_key): Ditto.
	(typy_richcompare): Use TRY_CATCH.  Do not return Py_NE on error.
This commit is contained in:
Phil Muldoon 2011-10-27 09:14:27 +00:00
parent d848dec6d9
commit 76dce0be7b
6 changed files with 133 additions and 50 deletions

View file

@ -101,9 +101,15 @@ frapy_str (PyObject *self)
static PyObject *
frapy_is_valid (PyObject *self, PyObject *args)
{
struct frame_info *frame;
struct frame_info *frame = NULL;
volatile struct gdb_exception except;
TRY_CATCH (except, RETURN_MASK_ALL)
{
frame = frame_object_to_frame_info ((frame_object *) self);
}
GDB_PY_HANDLE_EXCEPTION (except);
frame = frame_object_to_frame_info ((frame_object *) self);
if (frame == NULL)
Py_RETURN_FALSE;
@ -276,6 +282,7 @@ PyObject *
frame_info_to_frame_object (struct frame_info *frame)
{
frame_object *frame_obj;
volatile struct gdb_exception except;
frame_obj = PyObject_New (frame_object, &frame_object_type);
if (frame_obj == NULL)
@ -285,23 +292,27 @@ frame_info_to_frame_object (struct frame_info *frame)
return NULL;
}
/* Try to get the previous frame, to determine if this is the last frame
in a corrupt stack. If so, we need to store the frame_id of the next
frame and not of this one (which is possibly invalid). */
if (get_prev_frame (frame) == NULL
&& get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON
&& get_next_frame (frame) != NULL)
TRY_CATCH (except, RETURN_MASK_ALL)
{
frame_obj->frame_id = get_frame_id (get_next_frame (frame));
frame_obj->frame_id_is_next = 1;
}
else
{
frame_obj->frame_id = get_frame_id (frame);
frame_obj->frame_id_is_next = 0;
}
frame_obj->gdbarch = get_frame_arch (frame);
/* Try to get the previous frame, to determine if this is the last frame
in a corrupt stack. If so, we need to store the frame_id of the next
frame and not of this one (which is possibly invalid). */
if (get_prev_frame (frame) == NULL
&& get_frame_unwind_stop_reason (frame) != UNWIND_NO_REASON
&& get_next_frame (frame) != NULL)
{
frame_obj->frame_id = get_frame_id (get_next_frame (frame));
frame_obj->frame_id_is_next = 1;
}
else
{
frame_obj->frame_id = get_frame_id (frame);
frame_obj->frame_id_is_next = 0;
}
frame_obj->gdbarch = get_frame_arch (frame);
}
GDB_PY_HANDLE_EXCEPTION (except);
return (PyObject *) frame_obj;
}