From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 09/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, thread IDs
Date: Mon, 25 May 2026 20:18:27 +0100 [thread overview]
Message-ID: <20260525191829.984105-10-pedro@palves.net> (raw)
In-Reply-To: <20260525191829.984105-1-pedro@palves.net>
This commit fixes a couple issues in gdb.python/py-events.exp for
Cygwin and MinGW:
1) - GDB prints Windows thread IDs in hex:
(gdb) thread
[Current thread is 1 (Thread 9528.0xa9c)]
The current code assumes decimal, so we only (incorrectly) extract the
"0" after the dot.
2) - Thread and process ID number spaces are different.
The current code assumes that the extracted thread ID is the same
number as the extracted process ID, which is not true on Windows.
Also tested on x86_64-unknown-linux-gnu.
Change-Id: Iebcc07c3ad0845b548334c0d5177b3ab9e9350cf
commit-id: 8009478e
---
gdb/testsuite/gdb.python/py-events.exp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 16a290c31c2..b07eb2ec9b0 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -76,17 +76,23 @@ delete_breakpoints
# Test inferior call events
set process_id "invalid"
+set thread_id "invalid"
gdb_test_multiple "thread" "get current thread" {
-re -wrap "process ($decimal).*" {
set process_id $expect_out(1,string)
+ set thread_id $process_id
pass $gdb_test_name
}
-re -wrap "Thread $hex \\(LWP ($decimal)\\).*" {
set process_id $expect_out(1,string)
+ set thread_id $process_id
pass $gdb_test_name
}
- -re -wrap "Thread $decimal\.($decimal).*" {
+ -re -wrap "Thread ($decimal)\.($hex|$decimal).*" {
set process_id $expect_out(1,string)
+ set thread_id $expect_out(2,string)
+ # Convert from hex to decimal.
+ set thread_id [expr {$thread_id}]
pass $gdb_test_name
}
}
@@ -99,9 +105,9 @@ gdb_test_multiple "print do_nothing" "get address of do_nothing" {
}
set expected [list "event type: pre-call"]
-lappend expected "ptid: \\($process_id, $process_id, 0\\)" "address: $addr"
+lappend expected "ptid: \\($process_id, $thread_id, 0\\)" "address: $addr"
lappend expected "event type: post-call"
-lappend expected "ptid: \\($process_id, $process_id, 0\\)" "address: $addr"
+lappend expected "ptid: \\($process_id, $thread_id, 0\\)" "address: $addr"
gdb_test_sequence "call do_nothing()" "" $expected
# Test register changed event
--
2.53.0
next prev parent reply other threads:[~2026-05-25 19:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 19:18 [PATCH v2 00/11] Fix a few Cygwin/MinGW problems Pedro Alves
2026-05-25 19:18 ` [PATCH v2 01/11] Adjust gdb.base/exitsignal.exp for MinGW, trigger fault Pedro Alves
2026-05-25 19:18 ` [PATCH v2 02/11] Adjust gdb.base/exitsignal.exp for MinGW, second-chance SIGSEGV Pedro Alves
2026-05-26 11:18 ` Eli Zaretskii
2026-05-27 12:56 ` Pedro Alves
2026-05-25 19:18 ` [PATCH v2 03/11] Adjust gdb.base/exitsignal.exp for MinGW, separate program names Pedro Alves
2026-05-27 21:59 ` Thiago Jung Bauermann
2026-06-12 14:00 ` Pedro Alves
2026-05-25 19:18 ` [PATCH v2 04/11] gdb.base/exitsignal.exp: Exit with non-zero Pedro Alves
2026-05-25 19:18 ` [PATCH v2 05/11] gdb.base/exitsignal.exp: Test attaching too Pedro Alves
2026-05-25 19:18 ` [PATCH v2 06/11] gdb/testsuite: Add mechanism to compile Windows native programs on Cygwin Pedro Alves
2026-05-25 19:18 ` [PATCH v2 07/11] Windows gdb+gdbserver: Share exit status logic Pedro Alves
2026-05-25 19:18 ` [PATCH v2 08/11] Windows gdb+gdbserver: Decode Cygwin ExitProcess codes Pedro Alves
2026-05-26 11:31 ` Eli Zaretskii
2026-05-27 13:58 ` Pedro Alves
2026-05-27 14:12 ` Eli Zaretskii
2026-05-27 22:00 ` Thiago Jung Bauermann
2026-05-25 19:18 ` Pedro Alves [this message]
2026-05-25 19:18 ` [PATCH v2 10/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, no fork Pedro Alves
2026-05-25 19:18 ` [PATCH v2 11/11] Adjust gdb.python/py-events.exp for Cygwin/MinGW, "info proc" => "inferior" Pedro Alves
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=20260525191829.984105-10-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/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