diff options
Diffstat (limited to 'gdb/python/py-frame.c')
-rw-r--r-- | gdb/python/py-frame.c | 90 |
1 files changed, 36 insertions, 54 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 0eef654..9066f60 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -95,15 +95,14 @@ frapy_is_valid (PyObject *self, PyObject *args) { struct frame_info *frame = NULL; - TRY + try { frame = frame_object_to_frame_info (self); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH if (frame == NULL) Py_RETURN_FALSE; @@ -122,17 +121,16 @@ frapy_name (PyObject *self, PyObject *args) enum language lang; PyObject *result; - TRY + try { FRAPY_REQUIRE_VALID (self, frame); name = find_frame_funname (frame, &lang, NULL); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH if (name) { @@ -157,17 +155,16 @@ frapy_type (PyObject *self, PyObject *args) struct frame_info *frame; enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning. */ - TRY + try { FRAPY_REQUIRE_VALID (self, frame); type = get_frame_type (frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return PyInt_FromLong (type); } @@ -181,15 +178,14 @@ frapy_arch (PyObject *self, PyObject *args) struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */ frame_object *obj = (frame_object *) self; - TRY + try { FRAPY_REQUIRE_VALID (self, frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return gdbarch_to_arch_object (obj->gdbarch); } @@ -203,15 +199,14 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args) struct frame_info *frame = NULL; /* Initialize to appease gcc warning. */ enum unwind_stop_reason stop_reason; - TRY + try { FRAPY_REQUIRE_VALID (self, frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH stop_reason = get_frame_unwind_stop_reason (frame); @@ -227,17 +222,16 @@ frapy_pc (PyObject *self, PyObject *args) CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */ struct frame_info *frame; - TRY + try { FRAPY_REQUIRE_VALID (self, frame); pc = get_frame_pc (frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return gdb_py_long_from_ulongest (pc); } @@ -254,7 +248,7 @@ frapy_read_register (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", ®num_str)) return NULL; - TRY + try { struct frame_info *frame; int regnum; @@ -270,11 +264,10 @@ frapy_read_register (PyObject *self, PyObject *args) if (val == NULL) PyErr_SetString (PyExc_ValueError, _("Unknown register.")); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return val == NULL ? NULL : value_to_value_object (val); } @@ -288,16 +281,15 @@ frapy_block (PyObject *self, PyObject *args) struct frame_info *frame; const struct block *block = NULL, *fn_block; - TRY + try { FRAPY_REQUIRE_VALID (self, frame); block = get_frame_block (frame, NULL); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH for (fn_block = block; fn_block != NULL && BLOCK_FUNCTION (fn_block) == NULL; @@ -330,7 +322,7 @@ frapy_function (PyObject *self, PyObject *args) struct symbol *sym = NULL; struct frame_info *frame; - TRY + try { enum language funlang; @@ -339,11 +331,10 @@ frapy_function (PyObject *self, PyObject *args) gdb::unique_xmalloc_ptr<char> funname = find_frame_funname (frame, &funlang, &sym); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH if (sym) return symbol_to_symbol_object (sym); @@ -362,7 +353,7 @@ frame_info_to_frame_object (struct frame_info *frame) if (frame_obj == NULL) return NULL; - TRY + try { /* Try to get the previous frame, to determine if this is the last frame @@ -382,12 +373,11 @@ frame_info_to_frame_object (struct frame_info *frame) } frame_obj->gdbarch = get_frame_arch (frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { gdbpy_convert_exception (except); return NULL; } - END_CATCH return (PyObject *) frame_obj.release (); } @@ -402,17 +392,16 @@ frapy_older (PyObject *self, PyObject *args) struct frame_info *frame, *prev = NULL; PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */ - TRY + try { FRAPY_REQUIRE_VALID (self, frame); prev = get_prev_frame (frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH if (prev) prev_obj = frame_info_to_frame_object (prev); @@ -435,17 +424,16 @@ frapy_newer (PyObject *self, PyObject *args) struct frame_info *frame, *next = NULL; PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */ - TRY + try { FRAPY_REQUIRE_VALID (self, frame); next = get_next_frame (frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH if (next) next_obj = frame_info_to_frame_object (next); @@ -467,18 +455,17 @@ frapy_find_sal (PyObject *self, PyObject *args) struct frame_info *frame; PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */ - TRY + try { FRAPY_REQUIRE_VALID (self, frame); symtab_and_line sal = find_frame_sal (frame); sal_obj = symtab_and_line_to_sal_object (sal); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return sal_obj; } @@ -523,7 +510,7 @@ frapy_read_var (PyObject *self, PyObject *args) } } - TRY + try { struct block_symbol lookup_sym; FRAPY_REQUIRE_VALID (self, frame); @@ -534,12 +521,11 @@ frapy_read_var (PyObject *self, PyObject *args) var = lookup_sym.symbol; block = lookup_sym.block; } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { gdbpy_convert_exception (except); return NULL; } - END_CATCH if (!var) { @@ -556,17 +542,16 @@ frapy_read_var (PyObject *self, PyObject *args) return NULL; } - TRY + try { FRAPY_REQUIRE_VALID (self, frame); val = read_var_value (var, block, frame); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return value_to_value_object (val); } @@ -578,17 +563,16 @@ frapy_select (PyObject *self, PyObject *args) { struct frame_info *fi; - TRY + try { FRAPY_REQUIRE_VALID (self, fi); select_frame (fi); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH Py_RETURN_NONE; } @@ -601,15 +585,14 @@ gdbpy_newest_frame (PyObject *self, PyObject *args) { struct frame_info *frame = NULL; - TRY + try { frame = get_current_frame (); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return frame_info_to_frame_object (frame); } @@ -622,15 +605,14 @@ gdbpy_selected_frame (PyObject *self, PyObject *args) { struct frame_info *frame = NULL; - TRY + try { frame = get_selected_frame ("No frame is currently selected."); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception_RETURN_MASK_ALL &except) { GDB_PY_HANDLE_EXCEPTION (except); } - END_CATCH return frame_info_to_frame_object (frame); } |