forked from Imagelibrary/binutils-gdb
On arm-linux, with test-case gdb.base/scope-hw-watch-disable.exp I run into: ... (gdb) awatch a^M Can't set read/access watchpoint when hardware watchpoints are disabled.^M (gdb) PASS: $exp: unsuccessful attempt to create an access watchpoint rwatch b^M Can't set read/access watchpoint when hardware watchpoints are disabled.^M (gdb) PASS: $exp: unsuccessful attempt to create a read watchpoint continue^M Continuing.^M ^M Program received signal SIGSEGV, Segmentation fault.^M 0xf7ec82c8 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6^M (gdb) FAIL: $exp: continue until exit ... Using "maint info break", we can see that the two failed attempts to set a watchpoint each left behind a stale "watchpoint scope" breakpoint: ... -5 watchpoint scope del y 0xf7ec569a inf 1 -5.1 y 0xf7ec569a inf 1 stop only in stack frame at 0xfffef4f8 -6 watchpoint scope del y 0xf7ec569a inf 1 -6.1 y 0xf7ec569a inf 1 stop only in stack frame at 0xfffef4f8 ... The SIGSEGV is a consequence of the stale "watchpoint scope" breakpoint: the same happens if we: - have can-use-hw-watchpoints == 1, - set one of the watchpoints, and - continue to exit. The problem is missing symbol info on libc which is supposed to tell which code is thumb. After doing "set arm fallback-mode thumb" the SIGSEGV disappears. Extend the test-case to check the "maint info break" command before and after the two failed attempts, to make sure that we catch the stale "watchpoint scope" breakpoints also on x86_64-linux. Fix this in watch_command_1 by moving creation of the "watchpoint scope" breakpoint after the call to update_watchpoint. Tested on x86_64-linux. PR breakpoints/31860 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31860
59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
# Copyright 2023-2024 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Test that GDB displays the correct error message when hardware watchpoints
|
|
# are not supported or explicitly disabled. Test also that GDB terminates
|
|
# successfully after several attempts to insert a hardware watchpoint.
|
|
|
|
standard_testfile
|
|
|
|
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
|
|
return -1
|
|
}
|
|
|
|
gdb_test_no_output "set can-use-hw-watchpoints 0"
|
|
|
|
if {![runto_main]} {
|
|
return -1
|
|
}
|
|
|
|
gdb_test_multiple "maint info break" "maint info break before" {
|
|
-re -wrap "watchpoint.*" {
|
|
fail $gdb_test_name
|
|
}
|
|
-re -wrap "" {
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
gdb_test "awatch a" \
|
|
"Can't set read/access watchpoint when hardware watchpoints are disabled." \
|
|
"unsuccessful attempt to create an access watchpoint"
|
|
gdb_test "rwatch b" \
|
|
"Can't set read/access watchpoint when hardware watchpoints are disabled." \
|
|
"unsuccessful attempt to create a read watchpoint"
|
|
|
|
gdb_test_multiple "maint info break" "maint info break after" {
|
|
-re -wrap "watchpoint.*" {
|
|
fail $gdb_test_name
|
|
}
|
|
-re -wrap "" {
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
# The program continues until termination.
|
|
gdb_continue_to_end
|