From: Tom de Vries Date: Mon, 8 Dec 2025 15:38:28 +0000 (+0100) Subject: [gdb/testsuite] Fix FAIL in gdb.multi/remote-with-running-inferior.exp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=39326a5071e0e803d70b6bc4d07a2b35abbf19f0;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix FAIL in gdb.multi/remote-with-running-inferior.exp Occasionally, with test-case gdb.multi/remote-with-running-inferior.exp I run into: ... (gdb) continue^M Continuing.^M ^M Thread 1.1 "remote-with-run" hit Breakpoint 1.1, main () at \ remote-with-running-inferior.c:31^M 31 for (int i = 0; i < 30; ++i)^M (gdb) PASS: $exp: target_non_stop=auto: non_stop=off: \ continue to breakpoint: continue to breakpoint in breakpt bt 1^M (gdb) FAIL: $exp: target_non_stop=auto: non_stop=off: \ check inferior 1 is in breakpt ... The problem is a race between: - inferior 1 reaching main, and - gdb setting a breakpoint on main. If the breakpoint on main is set before inferior 1 reaches main, the breakpoint triggers for inferior 1, which the test-case doesn't expect. Fix this by setting the breakpoint on main only for inferior 2. Tested on x86_64-linux. PR testsuite/33621 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33621 --- diff --git a/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp b/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp index 43842ba7062..f33f60d0ea8 100644 --- a/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp +++ b/gdb/testsuite/gdb.multi/remote-with-running-inferior.exp @@ -126,7 +126,8 @@ proc run_test { target_non_stop non_stop } { # Allow inferior 2 to reach main. The confirms that inferior 2 can be # set running again. - gdb_breakpoint main + gdb_test "break main inferior 2" \ + "Breakpoint $::decimal at .*" gdb_continue_to_breakpoint "breakpoint in main" gdb_test "bt 1" \ "#0\\s+main \\(\\) at\[^\r\n\]+" \