forked from Imagelibrary/binutils-gdb
[gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often
I found a few more places where we can use GDB_PY_HANDLE_EXCEPTION. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -199,8 +199,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
gdbpy_ref<> pc_obj = gdb_py_object_from_ulongest (pc);
|
||||
|
||||
@@ -640,8 +640,7 @@ bppy_get_commands (PyObject *self, void *closure)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
return host_string_to_python_string (stb.c_str ()).release ();
|
||||
|
||||
@@ -431,8 +431,7 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return nullptr;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -389,8 +389,7 @@ frame_info_to_frame_object (const frame_info_ptr &frame)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
return (PyObject *) frame_obj.release ();
|
||||
@@ -538,8 +537,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
if (!var)
|
||||
|
||||
@@ -59,8 +59,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
|
||||
/* This readline callback is called without the GIL held. */
|
||||
gdbpy_gil gil;
|
||||
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
/* Detect EOF (Ctrl-D). */
|
||||
|
||||
@@ -168,8 +168,7 @@ gdbpy_execute_mi_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return nullptr;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
return uiout.result ().release ();
|
||||
|
||||
@@ -318,8 +318,7 @@ recpy_bt_insn_decoded (PyObject *self, void *closure)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
return PyBytes_FromString (strfile.string ().c_str ());
|
||||
|
||||
@@ -670,7 +670,6 @@ gdbpy_start_recording (PyObject *self, PyObject *args)
|
||||
{
|
||||
const char *method = NULL;
|
||||
const char *format = NULL;
|
||||
PyObject *ret = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "|ss", &method, &format))
|
||||
return NULL;
|
||||
@@ -678,14 +677,12 @@ gdbpy_start_recording (PyObject *self, PyObject *args)
|
||||
try
|
||||
{
|
||||
record_start (method, format, 0);
|
||||
ret = gdbpy_current_recording (self, args);
|
||||
return gdbpy_current_recording (self, args);
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Implementation of gdb.current_recording (self) -> gdb.Record. */
|
||||
|
||||
@@ -74,8 +74,7 @@ py_print_bpstat (bpstat *bs, enum gdb_signal stop_signal)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return nullptr;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
gdbpy_ref<> dict = uiout.result ();
|
||||
|
||||
@@ -415,8 +415,7 @@ gdbpy_register_tui_window (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return nullptr;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
||||
@@ -2056,8 +2056,7 @@ convert_value_from_python (PyObject *obj)
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
gdbpy_convert_exception (except);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -972,8 +972,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
|
||||
catch (const gdb_exception &ex)
|
||||
{
|
||||
/* We know this will always throw. */
|
||||
gdbpy_convert_exception (ex);
|
||||
return NULL;
|
||||
GDB_PY_HANDLE_EXCEPTION (ex);
|
||||
}
|
||||
|
||||
if (!sals.empty ())
|
||||
|
||||
Reference in New Issue
Block a user