On 2026/1/23 下午10:30, Miao Wang wrote:
On Wed, 21 Jan 2026 14:47:19 -0500 Sergio Durigan Junior <[email protected]>
wrote:
OK, then let's wait for the loongarch64 builders to be redeployed and
see if that solves the issue.
Hi, I managed to reproduce the error in qemu emulated virtual machine, which
lacks the support of hardware watch point.
Could you please check whether CONFIG_HAVE_HW_BREAKPOINT is set in your
kernel config? It is usually set by default via the defconfig.
The failed test case breakpoint-in-ro-region.exp attempts to set the memory
region of the debugged program read-only and force the use of hard breakpoint.
The test bench itself takes the case where breakpoint is not supported into
account, but failed to notice the slight difference of the output when using
gdbserver. That's why the test runs well with normal gdb but fails with
gdb server.
The attached patch can fix the above issue. However, I have no idea why on
the buildd environment, hardware breakpoints cannot be set by gdb.
If disable CONFIG_PERF_EVENTS, then it will not set
CONFIG_HAVE_HW_BREAKPOINT due to
select HAVE_HW_BREAKPOINT if PERF_EVENTS
in arch/loongarch/Kconfig of the Linux kernel code, I can reproduce the
following problem:
Running target native-gdbserver
Using
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/boards/../boards/native-gdbserver.exp
as board description file for target.
Using
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/boards/../boards/gdbserver-base.exp
as board description file for target.
Using
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/boards/../boards/local-board.exp
as board description file for target.
Using
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/config/gdbserver.exp
as tool-and-target-specific interface file.
Running
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
...
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw
on: step in ro region
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw
on: thread advanced
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw
on: step in ro region
FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw
on: thread advanced
1. Here are the gdb log messages with current code:
(1) Only gdb
make check-gdb TESTS="gdb.base/breakpoint-in-ro-region.exp"
```
(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)
```
(2) Using gdbserver
make check-gdb RUNTESTFLAGS="--target_board=native-gdbserver"
TESTS="gdb.base/breakpoint-in-ro-region.exp"
```
(gdb) hbreak *0x120000628^M
Hardware assisted breakpoint 3 at 0x120000628: file
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c,
line 22.^M
Warning:^M
Cannot insert hardware breakpoint 3:Remote failure reply: 01.^M
^M
(gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: probe hbreak support
(support)
si^M
Note: automatically using hardware breakpoints for read-only addresses.^M
Warning:^M
Cannot insert hardware breakpoint 0:Remote failure reply: 01.^M
^M
(gdb) FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off:
auto-hw on: step in ro region
```
The "hbreak" and "si" test cases are not correct for gdbserver.
It should check "Cannot insert hardware breakpoint" for "hbreak" and "si".
Here are the diff with small change of your patch:
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
index c29d2f8654e..a077427f31f 100644
--- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
+++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
@@ -182,6 +182,9 @@ gdb_test_multiple "hbreak *$main_lo" $test {
-re "No hardware breakpoint support.*$gdb_prompt $" {
pass "$test (no support)"
}
+ -re "Cannot insert hardware breakpoint.*$gdb_prompt $" {
+ pass "$test (no support)"
+ }
-re "$gdb_prompt $" {
pass "$test (support)"
set supports_hbreak 1
@@ -215,7 +218,7 @@ 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 $" {
+ -re "Cannot insert hardware breakpoint.*$gdb_prompt $" {
gdb_assert {!$hw_step && $auto_hw == "on" &&
!$supports_hbreak} \
"$test (cannot insert hw break)"
}
2. Here are the gdb log messages with the above changes:
(1) Only gdb
make check-gdb TESTS="gdb.base/breakpoint-in-ro-region.exp"
```
(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)
```
(2) Using gdbserver
make check-gdb RUNTESTFLAGS="--target_board=native-gdbserver"
TESTS="gdb.base/breakpoint-in-ro-region.exp"
```
(gdb) hbreak *0x120000628^M
Hardware assisted breakpoint 3 at 0x120000628: file
/home/fedora/build/gdb/testsuite/../../../gdb/gdb/testsuite/gdb.base/breakpoint-in-ro-region.c,
line 22.^M
Warning:^M
Cannot insert hardware breakpoint 3:Remote failure reply: 01.^M
^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:Remote failure reply: 01.^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)
```
IMO the problem is related with the Linux kernel config
CONFIG_HAVE_HW_BREAKPOINT which is set by default in the
newer kernel used by Debian official ISO:
https://cdimage.debian.org/cdimage/ports/snapshots/2025-12-06/debian-13.0.0-loong64-NETINST-1.iso
So in order to avoid the problem, one way is to redeploy the above ISO
for the builder, the other way is to modify the GDB test case.
Please send a patch for GDB or let me know that you don't plan to do it
and I'll do it.
Thanks,
Tiezhu