mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-24 14:22:27 +08:00
gdb/python: make the executable_changed event available from Python
This commit makes the executable_changed observable available through the Python API as an event. There's nothing particularly interesting going on here, it just follows the same pattern as many of the other Python events we support. The new event registry is called events.executable_changed, and this emits an ExecutableChangedEvent object which has two attributes, a gdb.Progspace called 'progspace', this is the program space in which the executable changed, and a Boolean called 'reload', which is True if the same executable changed on disk and has been reloaded, or is False when a new executable has been loaded. One interesting thing did come up during testing though, you'll notice the test contains a setup_kfail call. During testing I observed that the executable_changed event would trigger twice when GDB restarted an inferior. However, the ExecutableChangedEvent object is identical for both calls, so the wrong information is never sent out, we just see one too many events. I tracked this down to how the reload_symbols function (symfile.c) takes care to also reload the executable, however, I've split fixing this into a separate commit, so see the next commit for details. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@ -125,3 +125,8 @@ GDB_PY_DEFINE_EVENT_TYPE (connection,
|
||||
"ConnectionEvent",
|
||||
"GDB connection added or removed object",
|
||||
event_object_type);
|
||||
|
||||
GDB_PY_DEFINE_EVENT_TYPE (executable_changed,
|
||||
"ExecutableChangedEvent",
|
||||
"GDB executable changed event",
|
||||
event_object_type);
|
||||
|
Reference in New Issue
Block a user