* [PATCH v1] Fix DAP Stop & Continue event bugs
@ 2023-05-31 13:59 Simon Farre
0 siblings, 0 replies; only message in thread
From: Simon Farre @ 2023-05-31 13:59 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Farre
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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py
index d9ae603dfa4..bd46c233e1c 100644
--- a/gdb/python/lib/gdb/dap/events.py
+++ b/gdb/python/lib/gdb/dap/events.py
@@ -82,7 +82,7 @@ _suppress_cont = False
@in_gdb_thread
-def _cont(event):
+def _cont(event: gdb.events.ContinueEvent):
global _suppress_cont
if _suppress_cont:
log("_suppress_cont case")
@@ -91,7 +91,7 @@ def _cont(event):
send_event(
"continued",
{
- "threadId": gdb.selected_thread().global_num,
+ "threadId": event.inferior_thread.global_num,
"allThreadsContinued": True,
},
)
@@ -135,11 +135,11 @@ class ExecutionInvoker(Invoker):
@in_gdb_thread
-def _on_stop(event):
+def _on_stop(event: gdb.events.StopEvent):
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):
--
2.40.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-31 13:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 13:59 [PATCH v1] Fix DAP Stop & Continue event bugs Simon Farre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).