]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Adjust gdb.base/bp-cond-failure.exp for Cygwin
authorPedro Alves <pedro@palves.net>
Tue, 5 Sep 2023 12:24:17 +0000 (13:24 +0100)
committerPedro Alves <pedro@palves.net>
Mon, 9 Jun 2025 16:27:11 +0000 (17:27 +0100)
Currently on Cygwin, I get:

 Running /home/alves/gdb/src/gdb/testsuite/gdb.base/bp-cond-failure.exp ...
 FAIL: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: multi-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: single-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=short: cond_eval=auto: multi-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=short: cond_eval=auto: single-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=int: cond_eval=auto: multi-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=int: cond_eval=auto: single-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=long long: cond_eval=auto: multi-loc: continue
 FAIL: gdb.base/bp-cond-failure.exp: access_type=long long: cond_eval=auto: single-loc: continue

On GNU/Linux, we see:

 Breakpoint 2.1, foo () at .../src/gdb/testsuite/gdb.base/bp-cond-failure.c:21
 21        return 0;     /* Multi-location breakpoint here.  */
 (gdb) PASS: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: multi-loc: continue

While on Cygwin, we see:

 Thread 1 "bp-cond-failure" hit Breakpoint 2.1, foo () at .../src/gdb/testsuite/gdb.base/bp-cond-failure.c:21
 21        return 0;     /* Multi-location breakpoint here.  */
 (gdb) FAIL: gdb.base/bp-cond-failure.exp: access_type=char: cond_eval=auto: multi-loc: continue

The difference is the "Thread 1" part in the beginning of the quoted
output.  It appears on Cygwin, but not on Linux.  That's because on
Cygwin, all inferiors are multi-threaded, because both Windows and the
Cygwin runtime spawn a few helper threads.

Fix this by adjusting the gdb.base/bp-cond-failure.exp testcase to
work with either single- or multi-threaded inferiors.

The testcase passes cleanly for me after this.

Approved-by: Kevin Buettner <kevinb@redhat.com>
Change-Id: I5ff11d06ac1748d044cef025f1e78b8f84ad3349

gdb/testsuite/gdb.base/bp-cond-failure.exp

index d6454549b484bf36fd4bf7995d125ec70a099707..4d03e7bc5fea712d7cf7c13a3a303bf690fd911d 100644 (file)
@@ -75,7 +75,7 @@ proc run_test { cond_eval access_type bpexpr nloc } {
                 "Error in testing condition for breakpoint ${bp_num}.2:" \
                 "Cannot access memory at address 0x0" \
                 "" \
-                "Breakpoint ${bp_num}.2, foo \\(c=49 ...\\) at \[^\r\n\]+:\[0-9\]+" \
+                "(Thread \[^\r\n\]+ hit )?Breakpoint ${bp_num}.2, foo \\(c=49 ...\\) at \[^\r\n\]+:\[0-9\]+" \
                 "${::decimal}\\s+\[^\r\n\]+ breakpoint here\\. \[^\r\n\]+"]
     } else {
        gdb_test "continue" \
@@ -84,7 +84,7 @@ proc run_test { cond_eval access_type bpexpr nloc } {
                 "Error in testing condition for breakpoint ${bp_num}:" \
                 "Cannot access memory at address 0x0" \
                 "" \
-                "Breakpoint ${bp_num}, bar \\(\\) at \[^\r\n\]+:\[0-9\]+" \
+                "(Thread \[^\r\n\]+ hit )?Breakpoint ${bp_num}, bar \\(\\) at \[^\r\n\]+:\[0-9\]+" \
                 "${::decimal}\\s+\[^\r\n\]+ breakpoint here\\. \[^\r\n\]+"]
     }
 }