diff options
Diffstat (limited to 'gdb/python/py-inferior.c')
-rw-r--r-- | gdb/python/py-inferior.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index a1042ee..2aa11d3 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -1,6 +1,6 @@ /* Python interface to inferiors. - Copyright (C) 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -30,10 +30,10 @@ #include "py-event.h" #include "py-stopevent.h" #include "progspace-and-thread.h" -#include <unordered_map> +#include "gdbsupport/unordered_map.h" using thread_map_t - = std::unordered_map<thread_info *, gdbpy_ref<thread_object>>; + = gdb::unordered_map<thread_info *, gdbpy_ref<thread_object>>; struct inferior_object { @@ -412,7 +412,7 @@ infpy_threads (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (nullptr, except); } tuple = PyTuple_New (inf_obj->threads->size ()); @@ -578,7 +578,7 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (nullptr, except); } @@ -631,9 +631,9 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw) write_memory_with_notification (addr, buffer, length); } - catch (gdb_exception &ex) + catch (const gdb_exception &ex) { - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (nullptr, ex); } Py_RETURN_NONE; @@ -705,9 +705,9 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) buffer, pattern_size, &found_addr); } - catch (gdb_exception &ex) + catch (const gdb_exception &ex) { - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (nullptr, ex); } if (found) @@ -783,7 +783,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (nullptr, except); } Py_RETURN_NONE; @@ -929,7 +929,7 @@ infpy_set_args (PyObject *self, PyObject *value, void *closure) for (const auto &arg : args) argvec.push_back (arg.get ()); gdb::array_view<char * const> view (argvec.data (), argvec.size ()); - inf->inferior->set_args (view); + inf->inferior->set_args (view, true); } else { @@ -1009,11 +1009,7 @@ gdbpy_selected_inferior (PyObject *self, PyObject *args) static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_inferior (void) { - if (PyType_Ready (&inferior_object_type) < 0) - return -1; - - if (gdb_pymodule_addobject (gdb_module, "Inferior", - (PyObject *) &inferior_object_type) < 0) + if (gdbpy_type_ready (&inferior_object_type) < 0) return -1; gdb::observers::new_thread.attach (add_thread_object, "py-inferior"); |