[gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION

Result of:
...
$ search="GDB_PY_HANDLE_EXCEPTION ("
$ replace="return gdbpy_handle_gdb_exception (nullptr, "
$ sed -i \
    "s/$search/$replace/" \
    gdb/python/*.c
...

Also remove the now unused GDB_PY_HANDLE_EXCEPTION.

No functional changes.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Tom de Vries
2024-09-24 13:06:32 +02:00
parent 912bc231ab
commit 1ccb6f106a
23 changed files with 129 additions and 136 deletions

View File

@@ -257,7 +257,7 @@ valpy_dereference (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -300,7 +300,7 @@ valpy_referenced_value (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -323,7 +323,7 @@ valpy_reference_value (PyObject *self, PyObject *args, enum type_code refcode)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -369,7 +369,7 @@ valpy_to_array (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -393,7 +393,7 @@ valpy_const_value (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -499,7 +499,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (type == NULL)
@@ -605,7 +605,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return str_obj;
@@ -640,7 +640,7 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
@@ -824,7 +824,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return PyUnicode_Decode (stb.c_str (), stb.size (), host_charset (), NULL);
@@ -869,7 +869,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -1180,7 +1180,7 @@ valpy_getitem (PyObject *self, PyObject *key)
}
catch (const gdb_exception &ex)
{
GDB_PY_HANDLE_EXCEPTION (ex);
return gdbpy_handle_gdb_exception (nullptr, ex);
}
return result;
@@ -1211,7 +1211,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (ftype->code () != TYPE_CODE_FUNC && ftype->code () != TYPE_CODE_METHOD
@@ -1268,7 +1268,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -1293,7 +1293,7 @@ valpy_str (PyObject *self)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return PyUnicode_Decode (stb.c_str (), stb.size (), host_charset (), NULL);
@@ -1312,7 +1312,7 @@ valpy_get_is_optimized_out (PyObject *self, void *closure)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (opt)
@@ -1334,7 +1334,7 @@ valpy_get_is_lazy (PyObject *self, void *closure)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (opt)
@@ -1364,7 +1364,7 @@ valpy_get_bytes (PyObject *self, void *closure)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
value_obj->content_bytes
@@ -1408,7 +1408,7 @@ valpy_fetch_lazy (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
Py_RETURN_NONE;
@@ -1579,7 +1579,7 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -1647,7 +1647,7 @@ valpy_negative (PyObject *self)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -1674,7 +1674,7 @@ valpy_absolute (PyObject *self)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (isabs)
@@ -1729,7 +1729,7 @@ valpy_invert (PyObject *self)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -1856,7 +1856,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
/* In this case, the Python exception has already been set. */
@@ -1895,7 +1895,7 @@ valpy_long (PyObject *self)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (type->is_unsigned ())
@@ -1930,7 +1930,7 @@ valpy_float (PyObject *self)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return PyFloat_FromDouble (d);
@@ -2056,7 +2056,7 @@ convert_value_from_python (PyObject *obj)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return value;
@@ -2080,7 +2080,7 @@ gdbpy_history (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return result;
@@ -2107,7 +2107,7 @@ gdbpy_add_history (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
return nullptr;
@@ -2152,7 +2152,7 @@ gdbpy_convenience_variable (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
if (result == nullptr && !found)
@@ -2198,7 +2198,7 @@ gdbpy_set_convenience_variable (PyObject *self, PyObject *args)
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
return gdbpy_handle_gdb_exception (nullptr, except);
}
Py_RETURN_NONE;