From 3acd9a692ddaf8f24d6d34cb5ccb7c26d057e9b3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 3 Jun 2022 07:59:49 -0600 Subject: Make 'import gdb.events' work Pierre-Marie noticed that, while gdb.events is a Python module, it can't be imported. This patch changes how this module is created, so that it can be imported, while also ensuring that the module is always visible, just as it was in the past. This new approach required one non-obvious change -- when running gdb.base/warning.exp, where --data-directory is intentionally not found, the event registries can now be nullptr. Consequently, this patch probably also requires https://sourceware.org/pipermail/gdb-patches/2022-June/189796.html Note that this patch obsoletes https://sourceware.org/pipermail/gdb-patches/2022-June/189797.html --- gdb/python/python-internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 5ff9989..5d296a7 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -521,8 +521,6 @@ int gdbpy_initialize_eventregistry (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; int gdbpy_initialize_event (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; -int gdbpy_initialize_py_events (void) - CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; int gdbpy_initialize_arch (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; int gdbpy_initialize_registers () @@ -543,6 +541,8 @@ void gdbpy_finalize_micommands (); int gdbpy_initialize_disasm () CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; +PyMODINIT_FUNC gdbpy_events_mod_func (); + /* A wrapper for PyErr_Fetch that handles reference counting for the caller. */ class gdbpy_err_fetch -- cgit v1.1