From: Tiezhu Yang Date: Sat, 31 Jan 2026 08:24:06 +0000 (+0800) Subject: gdb: Make test result accurate in breakpoint-in-ro-region.exp X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e04f8748c0193e75460337a32f2b1442a8799c2;p=thirdparty%2Fbinutils-gdb.git gdb: Make test result accurate in breakpoint-in-ro-region.exp Currently, if no support for hardware breakpoints, when executing: make check-gdb TESTS="gdb.base/breakpoint-in-ro-region.exp" the test results of "hbreak" and "si" command are "PASS": ``` (gdb) hbreak *0x120000628^M No hardware breakpoint support in the target.^M (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: probe hbreak support (no support) si^M Note: automatically using hardware breakpoints for read-only addresses.^M Warning:^M Cannot insert hardware breakpoint 0.^M Could not insert hardware breakpoints:^M You may have requested too many hardware breakpoints/watchpoints.^M ^M (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: step in ro region (cannot insert hw break) ``` This is not accurate, obviously it should be "UNSUPPORTED". Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33845 Signed-off-by: Tiezhu Yang Approved-By: Tom Tromey --- diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp index c29d2f8654e..e18563ff6ea 100644 --- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp +++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp @@ -177,10 +177,10 @@ set supports_hbreak 0 set test "probe hbreak support" gdb_test_multiple "hbreak *$main_lo" $test { -re "You may have requested too many.*$gdb_prompt $" { - pass "$test (no support)" + unsupported "$test (no support)" } -re "No hardware breakpoint support.*$gdb_prompt $" { - pass "$test (no support)" + unsupported "$test (no support)" } -re "$gdb_prompt $" { pass "$test (support)" @@ -216,8 +216,11 @@ proc test_single_step { always_inserted auto_hw } { set test "step in ro region" gdb_test_multiple "si" $test { -re "Could not insert hardware breakpoints.*$gdb_prompt $" { - gdb_assert {!$hw_step && $auto_hw == "on" && !$supports_hbreak} \ - "$test (cannot insert hw break)" + if {!$hw_step && $auto_hw == "on" && !$supports_hbreak} { + unsupported "$test (cannot insert hw break)" + } else { + fail "$test (cannot insert hw break)" + } } -re "Cannot set software breakpoint at read-only address $next_insn.*$gdb_prompt $" { gdb_assert {!$hw_step && $auto_hw == "off"} \