mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
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
This commit is contained in:
@ -118,7 +118,9 @@ gdbpy_initialize_eventregistry (void)
|
||||
bool
|
||||
evregpy_no_listeners_p (eventregistry_object *registry)
|
||||
{
|
||||
return PyList_Size (registry->callbacks) == 0;
|
||||
/* REGISTRY can be nullptr if gdb failed to find the data directory
|
||||
at startup. */
|
||||
return registry == nullptr || PyList_Size (registry->callbacks) == 0;
|
||||
}
|
||||
|
||||
static PyMethodDef eventregistry_object_methods[] =
|
||||
|
Reference in New Issue
Block a user