]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix FAIL in gdb.multi/remote-with-running-inferior.exp
authorTom de Vries <tdevries@suse.de>
Mon, 8 Dec 2025 15:38:28 +0000 (16:38 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 8 Dec 2025 15:38:28 +0000 (16:38 +0100)
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

gdb/testsuite/gdb.multi/remote-with-running-inferior.exp

index 43842ba706256b4b863eabf648c24cca5faa4217..f33f60d0ea8dc0ac57cd88df56e0287bd6c47e5d 100644 (file)
@@ -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\]+" \