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
20 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile debug]} {
24 if ![runto_main
] then {
25 fail
"can't run to main"
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
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
46 -re
"^$test_target\r\n$gdb_prompt $" {
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
} {
71 with_test_prefix
"$break_command" {
74 gdb_test
"$break_command foo" "reakpoint.* at .*"
76 # A condition that evals true.
77 gdb_test
"condition \$bpnum cond_global==0" ".*"
82 gdb_test_multiple $test $test
{
83 -re
"You may have requested too many.*$gdb_prompt $" {
86 -re
"Breakpoint .*, foo .*$gdb_prompt $" {
93 unsupported
"no target support"
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
113 proc test_watch
{ watch_command
} {
116 with_test_prefix
"$watch_command" {
117 if [target_info
exists gdb
,no_hardware_watchpoints
] {
118 unsupported
"no target support"
124 gdb_test
"$watch_command global" ".*atchpoint .*: global.*"
126 # A condition that evals true.
127 gdb_test
"condition \$bpnum cond_global==0" ".*"
132 gdb_test_multiple $test $test
{
133 -re
"You may have requested too many.*$gdb_prompt $" {
136 -re
"atchpoint .*: global.*$gdb_prompt $" {
142 if { !$can_do_cmd
} {
143 unsupported
"no target support"
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