1 # Copyright
2012-2023 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 # The allow_hw_watchpoint_tests checks
if watchpoints are supported by the
19 # processor.
On PowerPC
, the check runs a small test
program under gdb
20 # to determine
if the Power processor supports HW watchpoints. The check
21 # must be done before starting the test so as to not disrupt the execution
24 set allow_hw_watchpoint_tests_p
[allow_hw_watchpoint_tests
]
28 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile debug]} {
36 set test_host
"set breakpoint condition-evaluation host"
37 set test_auto
"set breakpoint condition-evaluation auto"
38 set test_target
"set breakpoint condition-evaluation target"
40 gdb_test_no_output $test_host
41 gdb_test_no_output $test_auto
43 #
If target
-side condition evaluation is not supported
, this warning will be
45 set warning
"warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead."
47 gdb_test_multiple $test_target $test_target
{
48 -re
"$warning\r\n$gdb_prompt $" {
49 unsupported $test_target
53 -re
"^$test_target\r\n$gdb_prompt $" {
58 # We now know that the target supports target
-side conditional
59 # evaluation. Now make sure we can force
-disable the
60 # ConditionalBreakpoints RSP feature.
61 if [gdb_is_target_remote
] {
63 "set remote conditional-breakpoints-packet off" \
64 "Support for the 'ConditionalBreakpoints' packet on the current remote target is set to \"off\"."
66 gdb_test $test_target
"$warning" \
67 "set breakpoint condition-evaluation target, with support disabled"
69 # Confirm we can re
-enable it.
71 "set remote conditional-breakpoints-packet on" \
72 "Support for the 'ConditionalBreakpoints' packet on the current remote target is set to \"on\"."
74 gdb_test_no_output $test_target
"restore $test_target"
77 # Test setting a condition in a breakpoint. BREAK_COMMAND is the
78 #
break/hwatch command to test.
80 proc test_break
{ break_command
} {
83 with_test_prefix
"$break_command" {
86 gdb_test
"$break_command foo" "reakpoint.* at .*"
88 # A condition that evals true.
89 gdb_test
"condition \$bpnum cond_global==0" ".*"
94 gdb_test_multiple $test $test
{
95 -re
"You may have requested too many.*$gdb_prompt $" {
98 -re
"Breakpoint .*, foo .*$gdb_prompt $" {
104 if { !$can_do_cmd
} {
105 unsupported
"no target support"
111 gdb_test
"$break_command foo" ".*reakpoint .* at .*"
113 # A condition that evals false.
114 gdb_test
"condition \$bpnum cond_global==1" ".*"
116 gdb_test
"b bar" "Breakpoint .* at .*"
118 gdb_test
"continue" "Breakpoint .*, bar .*"
122 # Test setting conditions in watchpoints. WATCH_COMMAND is the
watch
125 proc test_watch
{ watch_command
} {
127 global allow_hw_watchpoint_tests_p
129 with_test_prefix
"$watch_command" {
130 if {!$allow_hw_watchpoint_tests_p
} {
131 unsupported
"no target support"
137 gdb_test
"$watch_command global" ".*atchpoint .*: global.*"
139 # A condition that evals true.
140 gdb_test
"condition \$bpnum cond_global==0" ".*"
145 gdb_test_multiple $test $test
{
146 -re
"You may have requested too many.*$gdb_prompt $" {
149 -re
"atchpoint .*: global.*$gdb_prompt $" {
155 if { !$can_do_cmd
} {
156 unsupported
"no target support"
162 gdb_test
"$watch_command global" ".*atchpoint .*: global.*"
164 # A condition that evals false.
165 gdb_test
"condition \$bpnum cond_global==1" ".*"
167 gdb_test
"b bar" "Breakpoint .* at .*"
169 gdb_test
"continue" "Breakpoint .*, bar .*"
173 foreach break_command
{ "break" "hbreak" } {
174 test_break $break_command
177 foreach watch_command
{ "watch" "rwatch" "awatch" } {
178 test_watch $watch_command