diff options
author | Tom de Vries <tdevries@suse.de> | 2024-08-27 09:20:18 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-08-27 09:20:18 +0200 |
commit | 2f8cd40c37ac59451ac48223346f513c0ee03165 (patch) | |
tree | dad23f7ab259b5dcd52b2f94b13dbdca96385b20 | |
parent | b5070480d74eca8d5fdf8e7a605df2f0edc9f37a (diff) | |
download | gdb-2f8cd40c37ac59451ac48223346f513c0ee03165.zip gdb-2f8cd40c37ac59451ac48223346f513c0ee03165.tar.gz gdb-2f8cd40c37ac59451ac48223346f513c0ee03165.tar.bz2 |
[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>
-rw-r--r-- | gdb/python/py-arch.c | 3 | ||||
-rw-r--r-- | gdb/python/py-breakpoint.c | 3 | ||||
-rw-r--r-- | gdb/python/py-connection.c | 3 | ||||
-rw-r--r-- | gdb/python/py-frame.c | 6 | ||||
-rw-r--r-- | gdb/python/py-gdb-readline.c | 3 | ||||
-rw-r--r-- | gdb/python/py-mi.c | 3 | ||||
-rw-r--r-- | gdb/python/py-record-btrace.c | 3 | ||||
-rw-r--r-- | gdb/python/py-record.c | 7 | ||||
-rw-r--r-- | gdb/python/py-stopevent.c | 3 | ||||
-rw-r--r-- | gdb/python/py-tui.c | 3 | ||||
-rw-r--r-- | gdb/python/py-value.c | 3 | ||||
-rw-r--r-- | gdb/python/python.c | 3 |
12 files changed, 14 insertions, 29 deletions
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c index c6f5662..178efab 100644 --- a/gdb/python/py-arch.c +++ b/gdb/python/py-arch.c @@ -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); diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 7401397..19e244f 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -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 (); diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c index dcca76b..79e2767 100644 --- a/gdb/python/py-connection.c +++ b/gdb/python/py-connection.c @@ -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); } } diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index bbb42af..7f617fa 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -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) diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c index 92287ee..14a76b4 100644 --- a/gdb/python/py-gdb-readline.c +++ b/gdb/python/py-gdb-readline.c @@ -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). */ diff --git a/gdb/python/py-mi.c b/gdb/python/py-mi.c index bc95e86..0a63654 100644 --- a/gdb/python/py-mi.c +++ b/gdb/python/py-mi.c @@ -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 (); diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c index 68b474c..30d0e83 100644 --- a/gdb/python/py-record-btrace.c +++ b/gdb/python/py-record-btrace.c @@ -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 ()); diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c index 2e0834c..759bf30 100644 --- a/gdb/python/py-record.c +++ b/gdb/python/py-record.c @@ -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. */ diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c index be26bc1..47f81bd 100644 --- a/gdb/python/py-stopevent.c +++ b/gdb/python/py-stopevent.c @@ -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 (); diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c index 984fa9b..3bcd02d 100644 --- a/gdb/python/py-tui.c +++ b/gdb/python/py-tui.c @@ -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; diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 4980076..37d5716 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -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; diff --git a/gdb/python/python.c b/gdb/python/python.c index 043c221..a2ce1f6 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -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 ()) |