From 76dce0be7b6b831559f41f69e85fc1e8f9d28343 Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Thu, 27 Oct 2011 09:14:27 +0000 Subject: 2011-10-27 Phil Muldoon * 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. --- gdb/python/py-frame.c | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'gdb/python/py-frame.c') diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 398ce84..e192ffa 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -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) - { - frame_obj->frame_id = get_frame_id (get_next_frame (frame)); - frame_obj->frame_id_is_next = 1; - } - else + TRY_CATCH (except, RETURN_MASK_ALL) { - 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; } -- cgit v1.1