1# Copyright 2009-2023 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16if {[skip_hw_watchpoint_tests]} { 17 return 0 18} 19 20standard_testfile .c 21 22if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { 23 untested "failed to compile" 24 return -1 25} 26 27# Start with a fresh gdb. 28 29clean_restart ${binfile} 30 31if {![runto_main]} { 32 return 0 33} 34 35gdb_test "break [gdb_get_line_number "break here"]" \ 36 ".*Breakpoint.* at .*" \ 37 "set breakpoint" 38 39gdb_test "watch x" ".*Hardware watchpoint.*" "set watchpoint" 40gdb_test "continue" ".*break here.*" "breakpoint hit" 41gdb_test "continue" ".*Hardware watchpoint.*Old value = 0.*New value = 42.*" \ 42 "watchpoint hit" 43gdb_test "continue" ".*break here.*" "breakpoint hit 2" 44gdb_test_no_output "set var x = 1" 45gdb_test "continue" ".*Hardware watchpoint.*Old value = 1.*New value = 42.*" \ 46 "watchpoint hit 2" 47