1 # Copyright 2012-2014 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.\r\n"
40 gdb_test_multiple $test_target $test_target {
41 -re "$warning$gdb_prompt $" {
42 unsupported $test_target
46 -re "^$test_target\r\n$gdb_prompt $" {
51 # Test setting a condition in a breakpoint. BREAK_COMMAND is the
52 # break/hwatch command to test.
54 proc test_break { break_command } {
57 with_test_prefix "$break_command" {
60 gdb_test "$break_command foo" "reakpoint.* at .*"
62 # A condition that evals true.
63 gdb_test "condition \$bpnum cond_global==0" ".*"
68 gdb_test_multiple $test $test {
69 -re "You may have requested too many.*$gdb_prompt $" {
72 -re "Breakpoint .*, foo .*$gdb_prompt $" {
79 unsupported "no target support"
85 gdb_test "$break_command foo" ".*reakpoint .* at .*"
87 # A condition that evals false.
88 gdb_test "condition \$bpnum cond_global==1" ".*"
90 gdb_test "b bar" "Breakpoint .* at .*"
92 gdb_test "continue" "Breakpoint .*, bar .*"
96 # Test setting conditions in watchpoints. WATCH_COMMAND is the watch
99 proc test_watch { watch_command } {
102 with_test_prefix "$watch_command" {
103 if [target_info exists gdb,no_hardware_watchpoints] {
104 unsupported "no target support"
110 gdb_test "$watch_command global" ".*atchpoint .*: global.*"
112 # A condition that evals true.
113 gdb_test "condition \$bpnum cond_global==0" ".*"
118 gdb_test_multiple $test $test {
119 -re "You may have requested too many.*$gdb_prompt $" {
122 -re "atchpoint .*: global.*$gdb_prompt $" {
128 if { !$can_do_cmd } {
129 unsupported "no target support"
135 gdb_test "$watch_command global" ".*atchpoint .*: global.*"
137 # A condition that evals false.
138 gdb_test "condition \$bpnum cond_global==1" ".*"
140 gdb_test "b bar" "Breakpoint .* at .*"
142 gdb_test "continue" "Breakpoint .*, bar .*"
146 foreach break_command { "break" "hbreak" } {
147 test_break $break_command
150 foreach watch_command { "watch" "rwatch" "awatch" } {
151 test_watch $watch_command