From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH v3 07/11] Windows gdb: extra thread info => show exiting
Date: Wed, 29 Apr 2026 21:15:03 +0100 [thread overview]
Message-ID: <20260429201507.480870-8-pedro@palves.net> (raw)
In-Reply-To: <20260429201507.480870-1-pedro@palves.net>
Now that we have easy access to each thread's last event, we can
easily include some extra info in "info threads" output related to
each thread's last event.
This patch makes us show whether the thread is exiting, or causing a
whole-process exit. This is useful when multiple threads hit events
at the same time, and the thread/process exit events are still pending
until the user re-resumes the program.
This is similar to how linux-thread-db.c also shows "Exiting" in its
target_extra_thread_info implementation.
This will be relied on by the testcase added by the following patch.
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I493b7ea3e14574dc972b1341eb5062fbbfda1521
commit-id:51b6d728
---
gdb/windows-nat.c | 21 +++++++++++++++++++++
gdb/windows-nat.h | 2 ++
2 files changed, 23 insertions(+)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 6f3803c887b..638e87f6f60 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -3345,6 +3345,27 @@ windows_nat_target::thread_name (struct thread_info *thr)
return th->thread_name ();
}
+/* Implementation of the target_ops::extra_thread_info method. */
+
+const char *
+windows_nat_target::extra_thread_info (thread_info *info)
+{
+ windows_thread_info *th = windows_process->find_thread (info->ptid);
+
+ if (!th->suspended)
+ return nullptr;
+
+ if (th->pending_status.kind () == TARGET_WAITKIND_THREAD_EXITED
+ || th->last_event.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT)
+ return "exiting";
+ else if (th->pending_status.kind () == TARGET_WAITKIND_EXITED
+ || th->pending_status.kind () == TARGET_WAITKIND_SIGNALLED
+ || th->last_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
+ return "exiting process";
+
+ return nullptr;
+}
+
/* Implementation of the target_ops::supports_non_stop method. */
bool
diff --git a/gdb/windows-nat.h b/gdb/windows-nat.h
index 5ef68dff274..2d6981ada0b 100644
--- a/gdb/windows-nat.h
+++ b/gdb/windows-nat.h
@@ -214,6 +214,8 @@ struct windows_nat_target : public inf_child_target
bool thread_alive (ptid_t ptid) override;
+ const char *extra_thread_info (thread_info *info) override;
+
std::string pid_to_str (ptid_t) override;
void interrupt () override;
--
2.53.0
next prev parent reply other threads:[~2026-04-29 20:16 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 20:14 [PATCH v3 00/11] Windows non-stop mode Pedro Alves
2026-04-29 20:14 ` [PATCH v3 01/11] Windows gdb+gdbserver: Check whether DBG_REPLY_LATER is available Pedro Alves
2026-04-29 20:14 ` [PATCH v3 02/11] linux-nat: Factor out get_detach_signal code to common code Pedro Alves
2026-04-29 20:14 ` [PATCH v3 03/11] Windows GDB: make windows_thread_info be private thread_info data Pedro Alves
2026-04-29 20:15 ` [PATCH v3 04/11] Introduce windows_nat::event_code_to_string Pedro Alves
2026-04-29 20:15 ` [PATCH v3 05/11] Windows gdb: Add non-stop support Pedro Alves
2026-04-29 20:15 ` [PATCH v3 06/11] Windows gdb: Watchpoints while running (internal vs external stops) Pedro Alves
2026-04-29 20:15 ` Pedro Alves [this message]
2026-04-29 20:15 ` [PATCH v3 08/11] Add gdb.threads/leader-exit-schedlock.exp Pedro Alves
2026-04-29 20:15 ` [PATCH v3 09/11] infrun: with AS+NS, prefer process exit over thread exit Pedro Alves
2026-05-06 10:01 ` Bouhaouel, Mohamed
2026-05-08 21:37 ` Pedro Alves
2026-05-11 11:58 ` Bouhaouel, Mohamed
2026-04-29 20:15 ` [PATCH v3 10/11] Windows gdb: Always non-stop (default to "maint set target-non-stop on") Pedro Alves
2026-04-29 20:15 ` [PATCH v3 11/11] Mention Windows non-stop support in NEWS Pedro Alves
2026-04-30 5:55 ` [PATCH v3 00/11] Windows non-stop mode Eli Zaretskii
2026-04-30 10:13 ` Pedro Alves
2026-04-30 11:14 ` Eli Zaretskii
2026-04-30 12:01 ` Pedro Alves
2026-04-30 14:15 ` [PATCH] Clarify "maint set target-non-stop" in GDB manual (Re: [PATCH v3 00/11] Windows non-stop mode) Pedro Alves
2026-04-30 15:09 ` Eli Zaretskii
2026-04-30 16:18 ` [PATCH v2] " Pedro Alves
2026-04-30 16:27 ` Eli Zaretskii
2026-04-30 16:33 ` Pedro Alves
2026-04-30 17:45 ` [PATCH v3 00/11] Windows non-stop mode Pedro Alves
2026-05-08 18:43 ` Tom Tromey
2026-05-08 21:27 ` Pedro Alves
2026-05-22 0:22 ` Pedro Alves
2026-06-02 19:00 ` 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=20260429201507.480870-8-pedro@palves.net \
--to=pedro@palves.net \
--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