From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Fix timeout in gdb.base/foll-fork-syscall.exp
Date: Sun, 1 Nov 2026 11:31:54 +0100 [thread overview]
Message-ID: <20261101103154.392746-1-tdevries@suse.de> (raw)
With a gdb 17.2 based package, and test-case gdb.base/foll-fork-syscall.exp, I
ran into:
...
(gdb) continue
Continuing.
[Detaching after fork from child process 30816]
Breakpoint 2, main (argc=1, argv=0x7fffffffd648) at foll-fork-syscall.c:27
27 if (pid == 0) /* set breakpoint here */
(gdb) I am the child
FAIL: $exp: follow-fork-mode=parent: detach-on-fork=on: test_catch_syscall: \
continue to breakpoint after fork (timeout)
continue
Continuing.
I am the parent
Catchpoint 5 (call to syscall chdir), 0x00007ffff7ed4cc7 in chdir () from /lib64/libc.so.6
(gdb) PASS: $exp: follow-fork-mode=parent: detach-on-fork=on: test_catch_syscall: \
continue to chdir syscall
...
I can reliably reproduce this on trunk using the readmore target board with
READMORE_SLEEP=2000 and this change in gdb.base/foll-fork-syscall.c:
...
- printf ("I am the child\n");
+ {
+ sleep (1);
+ printf ("I am the child\n");
+ }
...
With a longer delay before the printf, the timeout moves to the following test.
The breakpoint only triggers in the fork parent, not in the fork child, so the
"I am the child" message can happen at any moment following the fork.
Fix this using -no-prompt-anchor in two gdb_tests.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34925
---
gdb/testsuite/gdb.base/foll-fork-syscall.exp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/foll-fork-syscall.exp b/gdb/testsuite/gdb.base/foll-fork-syscall.exp
index a283631f458..53096144596 100644
--- a/gdb/testsuite/gdb.base/foll-fork-syscall.exp
+++ b/gdb/testsuite/gdb.base/foll-fork-syscall.exp
@@ -120,11 +120,18 @@ proc_with_prefix test_catch_syscall {follow-fork-mode detach-on-fork} {
append expected_re " process.*"
}
append expected_re "Breakpoint .*set breakpoint here.*"
- gdb_test "continue" $expected_re "continue to breakpoint after fork"
+
+ # Use -no-prompt-anchor in the following tests to account for an
+ # "I am the child" message which may occur at any moment following the
+ # fork, for follow-fork-mode=parent and detach-on-fork=on. Likewise for
+ # an "I am the parent" message and follow-fork-mode=child.
+ gdb_test -no-prompt-anchor continue $expected_re \
+ "continue to breakpoint after fork"
# Next stop should be the syscall catchpoint.
set expected_re ".*Catchpoint . \\(call to syscall chdir\\).*"
- gdb_test continue $expected_re "continue to chdir syscall"
+ gdb_test -no-prompt-anchor continue $expected_re \
+ "continue to chdir syscall"
}
# Check for follow-fork support.
base-commit: ef8962f3da549ae3cdea29c4a89452c4561c824b
--
2.51.0
reply other threads:[~2026-11-01 10:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261101103154.392746-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