Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/testsuite] Timeout updates in gdb.base/kill-during-detach.exp
Date: Tue,  3 Nov 2026 09:29:42 +0100	[thread overview]
Message-ID: <20261103082942.3542020-1-tdevries@suse.de> (raw)

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
---
 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>.*"
     }
 }
 

base-commit: 9db3b515b964c1bbdc4d20c1202fbf27719be269
-- 
2.51.0


             reply	other threads:[~2026-11-03  8:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  8:29 Tom de Vries [this message]
2026-11-20 13:28 ` Tom de Vries

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=20261103082942.3542020-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --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