Events
Enables callbacks into functions to be automatically invoked when various events occur to the debuggee (e.g. STOP on SIGINT) by using a decorator.
P = ParamSpec('P')
module-attribute
¶
T = TypeVar('T')
module-attribute
¶
connected = {}
module-attribute
¶
debug = config.add_param('debug-events', False, 'display internal event debugging info')
module-attribute
¶
executing_event = False
module-attribute
¶
gdb_workaround_stop_event = config.add_param('gdb-workaround-stop-event', 0, "Enable asynchronous stop events as a workaround to improve 'commands' functionality.\nNote: This may cause unexpected behavior with pwndbg or gdb.execute.\n\nValues:\n0 - Disable the workaround (default).\n1 - Enable asynchronous stop events; gdb.execute may behave unexpectedly(asynchronously).\n2 - Disable only deadlock detection; deadlocks may still occur.\n ")
module-attribute
¶
paused = defaultdict(bool)
module-attribute
¶
queued_events: Deque[Callable[..., Any]] = deque()
module-attribute
¶
registered: Dict[Any, Dict[HandlerPriority, List[Callable[..., Any]]]] = {gdb.events.exited: {}, gdb.events.cont: {}, gdb.events.new_objfile: {}, gdb.events.stop: {}, gdb.events.start: {}, gdb.events.new_thread: {}, gdb.events.before_prompt: {}, gdb.events.memory_changed: {}, gdb.events.register_changed: {}}
module-attribute
¶
HandlerPriority
¶
StartEvent
¶
after_reload(start=True)
¶
before_prompt(func, **kwargs)
¶
connect(func, event_handler, name='', priority=HandlerPriority.LOW)
¶
cont(func, **kwargs)
¶
exit(func, **kwargs)
¶
invoke_event(event, *args, **kwargs)
¶
log_objfiles(ofile=None)
¶
mem_changed(func, **kwargs)
¶
new_objfile(func, **kwargs)
¶
on_reload()
¶
pause(event_registry)
¶
reg_changed(func, **kwargs)
¶
start(func, **kwargs)
¶
stop(func, **kwargs)
¶
thread(func, **kwargs)
¶
unpause(event_registry)
¶
wrap_safe_event_handler(event_handler, event_type)
¶
Wraps an event handler to ensure it is only executed when the event is safe. Invalid events are queued and executed later when safe.
Note: Avoid using gdb.post_event
because of another bug in gdbserver where the gdb.newest_frame
function may not work properly.
Workaround to fix bug in gdbserver (gdb.events.new_objfile): https://github.com/pwndbg/pwndbg/issues/2576 Workaround to fix bug in gdb (gdb.events.stop): https://github.com/pwndbg/pwndbg/issues/425