]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.mi/pr11022.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / pr11022.exp
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
16 if {[skip_hw_watchpoint_tests]} {
17 return 0
18 }
19
20 load_lib mi-support.exp
21 set MIFLAGS "-i=mi"
22
23 standard_testfile .c
24
25 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
26 untested "failed to compile"
27 return
28 }
29
30 proc test_memory_changed_observer { mi_command } {
31 with_test_prefix "${mi_command}" {
32 global srcfile binfile
33
34 mi_clean_restart $binfile
35 mi_runto_main
36
37 set line_number [gdb_get_line_number "break here"]
38 mi_gdb_test "-break-insert ${srcfile}:${line_number}" \
39 {\^done,bkpt=.number="2",type="breakpoint".*\}} \
40 "set breakpoint"
41
42 mi_gdb_test "watch x" ".*" "set watchpoint"
43
44 mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*" ".*" \
45 { "" "disp=\"keep\"" } "breakpoint hit"
46
47 mi_execute_to "exec-continue" "watchpoint-trigger" "main" "" ".*" ".*" \
48 { "" "wpt=\{number=\"3\",exp=\"x\"\},value=\{old=\"0\",new=\"42\"\}" } \
49 "watchpoint hit"
50
51 mi_execute_to "exec-continue" "breakpoint-hit" "main" "" ".*" ".*" \
52 { "" "disp=\"keep\"" } "breakpoint hit 2"
53
54 mi_gdb_test "-${mi_command}" {\^done} "set x"
55
56 mi_execute_to "exec-continue" "watchpoint-trigger" "main" "" ".*" ".*" \
57 { "" "wpt=\{number=\"3\",exp=\"x\"\},value=\{old=\"1\",new=\"42\"\}" } \
58 "watchpoint hit 2"
59
60 mi_gdb_exit
61 }
62 }
63
64 test_memory_changed_observer "data-write-memory-bytes &x \"01\""
65 # We want to trigger a target memory write here, so the word size (4 or 8)
66 # is not that important.
67 test_memory_changed_observer "data-write-memory &x x 4 \"01\""