X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Fcond-eval-mode.exp;h=dad719454afaa5625df243d198a1ee05d907942d;hb=d708bcd102465e520c56e8be3ca4c9097dd389cc;hp=fd45499254ef6ac8e5add86e765864311784123b;hpb=e4ef1b6c3fee295ab41138bf77a82dff16f1d7c3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.exp b/gdb/testsuite/gdb.base/cond-eval-mode.exp index fd45499254..dad719454a 100644 --- a/gdb/testsuite/gdb.base/cond-eval-mode.exp +++ b/gdb/testsuite/gdb.base/cond-eval-mode.exp @@ -15,11 +15,16 @@ # Test 'set breakpoint condition-evaluation' settings -if { [prepare_for_testing break.exp "break" {break.c break1.c}] } { +standard_testfile + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -runto main +if ![runto_main] then { + fail "Can't run to main" + return 0 +} set test_host "set breakpoint condition-evaluation host" set test_auto "set breakpoint condition-evaluation auto" @@ -42,3 +47,106 @@ gdb_test_multiple $test_target $test_target { pass $test_target } } + +# Test setting a condition in a breakpoint. BREAK_COMMAND is the +# break/hwatch command to test. +# +proc test_break { break_command } { + global gdb_prompt + + with_test_prefix "$break_command" { + delete_breakpoints + + gdb_test "$break_command foo" "reakpoint.* at .*" + + # A condition that evals true. + gdb_test "condition \$bpnum cond_global==0" ".*" + + set can_do_cmd 0 + + set test "continue" + gdb_test_multiple $test $test { + -re "You may have requested too many.*$gdb_prompt $" { + pass $test + } + -re "Breakpoint .*, foo .*$gdb_prompt $" { + pass $test + set can_do_cmd 1 + } + } + + if { !$can_do_cmd } { + unsupported "no target support" + return + } + + delete_breakpoints + + gdb_test "$break_command foo" ".*reakpoint .* at .*" + + # A condition that evals false. + gdb_test "condition \$bpnum cond_global==1" ".*" + + gdb_test "b bar" "Breakpoint .* at .*" + + gdb_test "continue" "Breakpoint .*, bar .*" + } +} + +# Test setting conditions in watchpoints. WATCH_COMMAND is the watch +# command to test. +# +proc test_watch { watch_command } { + global gdb_prompt + + with_test_prefix "$watch_command" { + if [target_info exists gdb,no_hardware_watchpoints] { + unsupported "no target support" + return + } + + delete_breakpoints + + gdb_test "$watch_command global" ".*atchpoint .*: global.*" + + # A condition that evals true. + gdb_test "condition \$bpnum cond_global==0" ".*" + + set can_do_cmd 0 + + set test "continue" + gdb_test_multiple $test $test { + -re "You may have requested too many.*$gdb_prompt $" { + pass $test + } + -re "atchpoint .*: global.*$gdb_prompt $" { + pass $test + set can_do_cmd 1 + } + } + + if { !$can_do_cmd } { + unsupported "no target support" + return + } + + delete_breakpoints + + gdb_test "$watch_command global" ".*atchpoint .*: global.*" + + # A condition that evals false. + gdb_test "condition \$bpnum cond_global==1" ".*" + + gdb_test "b bar" "Breakpoint .* at .*" + + gdb_test "continue" "Breakpoint .*, bar .*" + } +} + +foreach break_command { "break" "hbreak" } { + test_break $break_command +} + +foreach watch_command { "watch" "rwatch" "awatch" } { + test_watch $watch_command +}