[v2] Fix DAP Stop & Continue event bugs
Commit Message
Removed type annotation as it broke gdbpy.
Fixes a bug in the stop and continue event handlers in the DAP code.
Event handlers used the `gdb.selected_thread` which may or may not be
null at the time the event handler is called. It may also return the
wrong thread. The event parameter holds the necessary data.
---
gdb/python/lib/gdb/dap/events.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
>>>>> "Simon" == Simon Farre via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> Removed type annotation as it broke gdbpy.
Simon> Fixes a bug in the stop and continue event handlers in the DAP code.
Simon> Event handlers used the `gdb.selected_thread` which may or may not be
Simon> null at the time the event handler is called. It may also return the
Simon> wrong thread. The event parameter holds the necessary data.
Thank you. This is ok.
Tom
@@ -91,7 +91,7 @@ def _cont(event):
send_event(
"continued",
{
- "threadId": gdb.selected_thread().global_num,
+ "threadId": event.inferior_thread.global_num,
"allThreadsContinued": True,
},
)
@@ -139,7 +139,7 @@ def _on_stop(event):
log("entering _on_stop: " + repr(event))
global _expected_stop
obj = {
- "threadId": gdb.selected_thread().global_num,
+ "threadId": event.inferior_thread.global_num,
"allThreadsStopped": True,
}
if isinstance(event, gdb.BreakpointEvent):