[binutils-gdb] [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp

Tom de Vries vries@sourceware.org
Fri Nov 20 13:27:31 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d90db3989b9d49a76849003cf459c07cbb19c227

commit d90db3989b9d49a76849003cf459c07cbb19c227
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Nov 20 14:27:27 2026 +0100

    [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp
    
    With a gdb 17.2 based package and test-case gdb.base/kill-during-detach.exp, I
    ran into:
    ...
    (gdb) python kill_and_detach()
    FAIL: exit_p=false: checkpoint_p=false: python kill_and_detach() (timeout)
    ...
    
    I didn't manage to reproduce this, but I have seen this more often.
    
    This may either be a regular testsuite timeout, or a problem with gdb.
    
    It could be a regular testsuite timeout.  The command that is issued:
    ...
    def kill_and_detach():
       os.kill(inf_pid, signal.SIGKILL)
       time.sleep(1)
       gdb.execute("detach")
    ...
    does two things (with a sleep of 1 in between) that would normally get their
    own timeout window.
    
    Let's address this by adding a timeout factor of 2.
    
    Then there's the problem that we don't see any output after the timeout.  So
    we add a simple command after the command to drain some more output.
    
    If the problem is a testsuite timeout, the timeout factor may be sufficient to
    fix this.  And if it's a gdb problem, we might get more information the next
    time we run into this.
    
    Tested on x86_64-linux.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34935

Diff:
---
 gdb/testsuite/gdb.base/kill-during-detach.exp | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/kill-during-detach.exp b/gdb/testsuite/gdb.base/kill-during-detach.exp
index f5e3a902211..27584581a9b 100644
--- a/gdb/testsuite/gdb.base/kill-during-detach.exp
+++ b/gdb/testsuite/gdb.base/kill-during-detach.exp
@@ -126,10 +126,23 @@ proc run_test { exit_p checkpoint_p } {
 	# NOTE: The 'checkpoint' system in GDB appears to be a little
 	# iffy.  This detach does seem to restore the checkpoint, but
 	# it leaves the inferior stuck in a running state.
-	gdb_test_no_output "python kill_and_detach()"
+
+	# Double the timeout, to account for the fact that we're doing two
+	# things in kill_and_detach.
+	with_timeout_factor 2 {
+	    gdb_test_no_output "python kill_and_detach()"
+	}
     } else {
-	gdb_test "python kill_and_detach()" \
-	    "\\\[Inferior $::decimal \[^\r\n\]+ detached\\\]"
+	# Double the timeout, to account for the fact that we're doing two
+	# things in kill_and_detach.
+	with_timeout_factor 2 {
+	    gdb_test "python kill_and_detach()" \
+		[subst_vars {\[Inferior $::decimal [^\r\n]+ detached\]}]
+	}
+
+	# Do a simple command to drain late output of the previous command in
+	# case it timed out.
+	gdb_test "info inferiors" "<null>.*"
     }
 }


More information about the Gdb-cvs mailing list