aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Farre <simon.farre.cx@gmail.com>2023-06-05 14:56:54 +0200
committerSimon Farre <simon.farre.cx@gmail.com>2023-08-01 18:14:59 +0200
commita18b53a8f68bc4fde9bd64b553f4ea500b30c626 (patch)
treeae7c34876f12828f1111c22ab15cef8d925b0dd5
parentb99a9693430a9f04165b1b868f890b622bb1b46c (diff)
downloadbinutils-a18b53a8f68bc4fde9bd64b553f4ea500b30c626.zip
binutils-a18b53a8f68bc4fde9bd64b553f4ea500b30c626.tar.gz
binutils-a18b53a8f68bc4fde9bd64b553f4ea500b30c626.tar.bz2
Add thread exited event
Reports a thread exit according to the DAP spec: https://microsoft.github.io/debug-adapter-protocol/specification#Events_Thread This patch requires the ThreadExitedEvent to be checked in, in order to work. That patch is found here https://sourceware.org/pipermail/gdb-patches/2023-June/200071.html Formatted correctly using black Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30474 Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/python/lib/gdb/dap/events.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py
index c163144..ab36dc5 100644
--- a/gdb/python/lib/gdb/dap/events.py
+++ b/gdb/python/lib/gdb/dap/events.py
@@ -58,23 +58,33 @@ def _bp_created(event):
@in_gdb_thread
-def _bp_deleted(event):
+def thread_event(event, reason):
send_event(
- "breakpoint",
+ "thread",
{
- "reason": "removed",
- "breakpoint": breakpoint_descriptor(event),
+ "reason": reason,
+ "threadId": event.inferior_thread.global_num,
},
)
@in_gdb_thread
def _new_thread(event):
+ thread_event(event, "started")
+
+
+@in_gdb_thread
+def _thread_exited(event):
+ thread_event(event, "exited")
+
+
+@in_gdb_thread
+def _bp_deleted(event):
send_event(
- "thread",
+ "breakpoint",
{
- "reason": "started",
- "threadId": event.inferior_thread.global_num,
+ "reason": "removed",
+ "breakpoint": breakpoint_descriptor(event),
},
)
@@ -173,5 +183,6 @@ gdb.events.breakpoint_created.connect(_bp_created)
gdb.events.breakpoint_modified.connect(_bp_modified)
gdb.events.breakpoint_deleted.connect(_bp_deleted)
gdb.events.new_thread.connect(_new_thread)
+gdb.events.thread_exited.connect(_thread_exited)
gdb.events.cont.connect(_cont)
gdb.events.new_objfile.connect(_new_objfile)