[1/2,gdb/python] Use GDB_PY_HANDLE_EXCEPTION more often
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
I found a few more places where we can use GDB_PY_HANDLE_EXCEPTION.
Tested on x86_64-linux.
---
gdb/python/py-arch.c | 3 +--
gdb/python/py-breakpoint.c | 3 +--
gdb/python/py-connection.c | 3 +--
gdb/python/py-frame.c | 6 ++----
gdb/python/py-gdb-readline.c | 3 +--
gdb/python/py-mi.c | 3 +--
gdb/python/py-record-btrace.c | 3 +--
gdb/python/py-record.c | 7 ++-----
gdb/python/py-stopevent.c | 3 +--
gdb/python/py-tui.c | 3 +--
gdb/python/py-value.c | 3 +--
gdb/python/python.c | 3 +--
12 files changed, 14 insertions(+), 29 deletions(-)
base-commit: 28c3bf55f0f9aca8619c6d01be34a02a887c5577
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> I found a few more places where we can use GDB_PY_HANDLE_EXCEPTION.
This is ok. Thank you.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
On 8/23/24 17:52, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> I found a few more places where we can use GDB_PY_HANDLE_EXCEPTION.
>
> This is ok. Thank you.
> Approved-By: Tom Tromey <tom@tromey.com>
Hi Tom,
thanks for the reviews.
I found another spot to use GDB_PY_SET_HANDLE_EXCEPTION, in
python/py-finishbreakpoint.c.
I've pushed the series with that additional change.
Thanks,
- Tom
@@ -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 ())