* [PATCH] [gdb/testsuite] Fix leader-exit and non-ldr-exc-2 with gdbserver
@ 2026-11-08 14:09 Josip Seketa
0 siblings, 0 replies; only message in thread
From: Josip Seketa @ 2026-11-08 14:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom de Vries
Since commit 1fba9bb362c ("[gdb/testsuite] Fix race in
gdb.threads/leader-exit.exp"), these two tests wait for the "Thread
exited" message while the inferior is running, and interrupt it when
that appears.
gdbserver only reports a thread exit if GDB asks for it, which it does
not do here, so GDB prints that message when the target next stops.
The message never comes, the wait times out, and the tests give up at
that point:
FAIL: gdb.threads/leader-exit.exp: continue to thread exited (timeout)
FAIL: gdb.threads/leader-exit.exp: thread exited
With gdbserver, interrupt the target first, after giving the leader some
time to exit, and then look for the message. Nothing changes for
native.
---
With native-gdbserver and native-extended-gdbserver these two tests go
from 2 passes and 8 failures to 29 passes, also with target-non-stop on.
The unix board stays at 29. Under load from 12 spinning processes: 348
passes in 12 rounds, on master alone as well.
The test waits a fixed 1 second, so a very slow machine could still see
the leader alive. The alternative would be for the inferior to wait
until the leader is a zombie, which is Linux-specific.
The test before 1fba9bb362c passed on these boards, so this is what
that commit changed for them, not a problem in gdbserver.
I have no FSF copyright assignment. This is my own work, not my
employer's.
gdb/testsuite/gdb.threads/leader-exit.exp | 19 ++++++++++++++++---
gdb/testsuite/gdb.threads/non-ldr-exc-2.exp | 19 ++++++++++++++++---
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/leader-exit.exp b/gdb/testsuite/gdb.threads/leader-exit.exp
index fb2f6980c2a..80baffe3465 100644
--- a/gdb/testsuite/gdb.threads/leader-exit.exp
+++ b/gdb/testsuite/gdb.threads/leader-exit.exp
@@ -30,14 +30,27 @@ if {![runto_main]} {
return
}
-# Wait for the "Thread exited" message.
+# Wait for the "Thread exited" message. gdbserver only reports a
+# thread exit if GDB asks for that, which it does not do here, so
+# there GDB sees the exit when the target stops. Then give the
+# leader some time to exit, and interrupt the target.
set re_thread_exited {\[Thread [^\r\n]+ exited\]}
set saw_thread_exited 0
+set interrupt_first [target_is_gdbserver]
gdb_test_multiple "continue" "continue to thread exited" {
+ -re "Continuing\\.\r\n" {
+ if { $interrupt_first } {
+ after 1000
+ send_gdb "\003"
+ }
+ exp_continue
+ }
-re $re_thread_exited {
set saw_thread_exited 1
- # Get a prompt.
- send_gdb "\003"
+ if { !$interrupt_first } {
+ # Get a prompt.
+ send_gdb "\003"
+ }
exp_continue
}
-re -wrap "" {
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index 3f465e10159..0132a310408 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -39,14 +39,27 @@ proc do_test { lock_sched nonstop } {
return -1
}
- # Wait for the "Thread exited" message.
+ # Wait for the "Thread exited" message. gdbserver only reports a
+ # thread exit if GDB asks for that, which it does not do here, so
+ # there GDB sees the exit when the target stops. Then give the
+ # leader some time to exit, and interrupt the target.
set re_thread_exited {\[Thread [^\r\n]+ exited\]}
set saw_thread_exited 0
+ set interrupt_first [target_is_gdbserver]
gdb_test_multiple "continue" "continue to thread exited" {
+ -re "Continuing\\.\r\n" {
+ if { $interrupt_first } {
+ after 1000
+ send_gdb "\003"
+ }
+ exp_continue
+ }
-re $re_thread_exited {
set saw_thread_exited 1
- # Get a prompt.
- send_gdb "\003"
+ if { !$interrupt_first } {
+ # Get a prompt.
+ send_gdb "\003"
+ }
exp_continue
}
-re -wrap "" {
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-08 14:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 14:09 [PATCH] [gdb/testsuite] Fix leader-exit and non-ldr-exc-2 with gdbserver Josip Seketa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox