aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/lib
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-06-03 07:59:49 -0600
committerTom Tromey <tromey@adacore.com>2022-07-05 10:28:39 -0600
commit3acd9a692ddaf8f24d6d34cb5ccb7c26d057e9b3 (patch)
tree19216ecf8b1235823b9251f84710982be599e5f8 /gdb/python/lib
parent736918239b16cc2ff57bfc64a982f2f0afc8c0f6 (diff)
downloadgdb-3acd9a692ddaf8f24d6d34cb5ccb7c26d057e9b3.zip
gdb-3acd9a692ddaf8f24d6d34cb5ccb7c26d057e9b3.tar.gz
gdb-3acd9a692ddaf8f24d6d34cb5ccb7c26d057e9b3.tar.bz2
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
Diffstat (limited to 'gdb/python/lib')
-rw-r--r--gdb/python/lib/gdb/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index a52f6b4..17ee6a1 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -27,6 +27,11 @@ else:
from _gdb import *
+# Historically, gdb.events was always available, so ensure it's
+# still available without an explicit import.
+import _gdbevents as events
+sys.modules['gdb.events'] = events
+
class _GdbFile(object):
# These two are needed in Python 3