[binutils-gdb/gdb-17-branch] gdb: Make test result accurate in breakpoint-in-ro-region.exp
Tiezhu Yang
yangtiezhu@sourceware.org
Fri Feb 13 10:16:14 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eaf673ca75c2ed7f86d0bbbce1150efa4d8ebb8c
commit eaf673ca75c2ed7f86d0bbbce1150efa4d8ebb8c
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
Date: Sat Jan 31 16:24:06 2026 +0800
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 <yangtiezhu@loongson.cn>
Approved-By: Tom Tromey <tom@tromey.com>
Diff:
---
gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
index 4b060b8dcd2..e4e8b9b04de 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"} \
More information about the Gdb-cvs
mailing list