[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.base / cond-eval-mode.exp
blob80b5add16a8e4624b3af6e37fca7f3182472fd48
1 # Copyright 2012-2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test 'set breakpoint condition-evaluation' settings
18 standard_testfile
20 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
21 return -1
24 if ![runto_main] then {
25 fail "can't run to main"
26 return 0
29 set test_host "set breakpoint condition-evaluation host"
30 set test_auto "set breakpoint condition-evaluation auto"
31 set test_target "set breakpoint condition-evaluation target"
33 gdb_test_no_output $test_host
34 gdb_test_no_output $test_auto
36 # If target-side condition evaluation is not supported, this warning will be
37 # displayed.
38 set warning "warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead."
40 gdb_test_multiple $test_target $test_target {
41 -re "$warning\r\n$gdb_prompt $" {
42 unsupported $test_target
43 return -1
46 -re "^$test_target\r\n$gdb_prompt $" {
47 pass $test_target
51 # We now know that the target supports target-side conditional
52 # evaluation. Now make sure we can force-disable the
53 # ConditionalBreakpoints RSP feature.
54 if [gdb_is_target_remote] {
55 gdb_test_no_output "set remote conditional-breakpoints-packet off"
57 gdb_test $test_target "$warning" \
58 "set breakpoint condition-evaluation target, with support disabled"
60 # Confirm we can re-enable it.
61 gdb_test_no_output "set remote conditional-breakpoints-packet on"
62 gdb_test_no_output $test_target "restore $test_target"
65 # Test setting a condition in a breakpoint. BREAK_COMMAND is the
66 # break/hwatch command to test.
68 proc test_break { break_command } {
69 global gdb_prompt
71 with_test_prefix "$break_command" {
72 delete_breakpoints
74 gdb_test "$break_command foo" "reakpoint.* at .*"
76 # A condition that evals true.
77 gdb_test "condition \$bpnum cond_global==0" ".*"
79 set can_do_cmd 0
81 set test "continue"
82 gdb_test_multiple $test $test {
83 -re "You may have requested too many.*$gdb_prompt $" {
84 pass $test
86 -re "Breakpoint .*, foo .*$gdb_prompt $" {
87 pass $test
88 set can_do_cmd 1
92 if { !$can_do_cmd } {
93 unsupported "no target support"
94 return
97 delete_breakpoints
99 gdb_test "$break_command foo" ".*reakpoint .* at .*"
101 # A condition that evals false.
102 gdb_test "condition \$bpnum cond_global==1" ".*"
104 gdb_test "b bar" "Breakpoint .* at .*"
106 gdb_test "continue" "Breakpoint .*, bar .*"
110 # Test setting conditions in watchpoints. WATCH_COMMAND is the watch
111 # command to test.
113 proc test_watch { watch_command } {
114 global gdb_prompt
116 with_test_prefix "$watch_command" {
117 if [target_info exists gdb,no_hardware_watchpoints] {
118 unsupported "no target support"
119 return
122 delete_breakpoints
124 gdb_test "$watch_command global" ".*atchpoint .*: global.*"
126 # A condition that evals true.
127 gdb_test "condition \$bpnum cond_global==0" ".*"
129 set can_do_cmd 0
131 set test "continue"
132 gdb_test_multiple $test $test {
133 -re "You may have requested too many.*$gdb_prompt $" {
134 pass $test
136 -re "atchpoint .*: global.*$gdb_prompt $" {
137 pass $test
138 set can_do_cmd 1
142 if { !$can_do_cmd } {
143 unsupported "no target support"
144 return
147 delete_breakpoints
149 gdb_test "$watch_command global" ".*atchpoint .*: global.*"
151 # A condition that evals false.
152 gdb_test "condition \$bpnum cond_global==1" ".*"
154 gdb_test "b bar" "Breakpoint .* at .*"
156 gdb_test "continue" "Breakpoint .*, bar .*"
160 foreach break_command { "break" "hbreak" } {
161 test_break $break_command
164 foreach watch_command { "watch" "rwatch" "awatch" } {
165 test_watch $watch_command