From: Simon Farre <simon.farre.cx@gmail.com>
To: gdb-patches@sourceware.org
Cc: tom@tromey.com, Simon Farre <simon.farre.cx@gmail.com>
Subject: [PATCH v2] [gdb/dap] Add thread exited event
Date: Tue, 1 Aug 2023 17:36:59 +0200 [thread overview]
Message-ID: <20230801153659.109243-1-simon.farre.cx@gmail.com> (raw)
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
---
gdb/python/lib/gdb/dap/events.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py
index d9ae603dfa4..19838756c74 100644
--- a/gdb/python/lib/gdb/dap/events.py
+++ b/gdb/python/lib/gdb/dap/events.py
@@ -68,16 +68,26 @@ def _bp_deleted(event):
@in_gdb_thread
-def _new_thread(event):
+def thread_event(event, reason):
send_event(
"thread",
{
- "reason": "started",
+ "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")
+
+
_suppress_cont = False
@@ -160,4 +170,5 @@ 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)
--
2.41.0
next reply other threads:[~2023-08-01 15:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 15:36 Simon Farre [this message]
2023-08-01 15:39 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230801153659.109243-1-simon.farre.cx@gmail.com \
--to=simon.farre.cx@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).