Commit | Line | Data |
---|---|---|
61baf725 | 1 | # Copyright 2009-2017 Free Software Foundation, Inc. |
1f3b5d1b PP |
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 | ||
b800ec70 UW |
16 | if {[skip_hw_watchpoint_tests]} { |
17 | return 0 | |
1f3b5d1b PP |
18 | } |
19 | ||
822bd149 TT |
20 | standard_testfile .c |
21 | ||
1f3b5d1b | 22 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
84c93cd5 | 23 | untested "failed to compile" |
1f3b5d1b PP |
24 | return -1 |
25 | } | |
26 | ||
27 | # Start with a fresh gdb. | |
28 | ||
822bd149 | 29 | clean_restart ${binfile} |
1f3b5d1b PP |
30 | |
31 | if ![runto_main] then { | |
bc6c7af4 | 32 | fail "can't run to main" |
1f3b5d1b PP |
33 | return 0 |
34 | } | |
35 | ||
36 | gdb_test "break [gdb_get_line_number "break here"]" \ | |
37 | ".*Breakpoint.* at .*" \ | |
38 | "set breakpoint" | |
39 | ||
40 | gdb_test "watch x" ".*Hardware watchpoint.*" "set watchpoint" | |
41 | gdb_test "continue" ".*break here.*" "breakpoint hit" | |
42 | gdb_test "continue" ".*Hardware watchpoint.*Old value = 0.*New value = 42.*" \ | |
43 | "watchpoint hit" | |
44 | gdb_test "continue" ".*break here.*" "breakpoint hit 2" | |
27d3a1a2 | 45 | gdb_test_no_output "set var x = 1" |
1f3b5d1b PP |
46 | gdb_test "continue" ".*Hardware watchpoint.*Old value = 1.*New value = 42.*" \ |
47 | "watchpoint hit 2" |