1 # Copyright (C) 1998 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
25 # test special commands
31 set srcfile ${testfile}.c
32 set binfile ${objdir}/${subdir}/${testfile}
33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
34 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
38 # are we on a target board
43 if {![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"]} {
48 if [get_compiler_info ${binfile}] {
51 if {[skip_hp_tests $gcc_compiled]} then { continue }
57 gdb_reinitialize_dir $srcdir/$subdir
62 proc watchpoint_command_test {} {
65 if [target_info exists noargs] {
66 verbose "Skipping watchpoint_command_test because of noargs."
70 if { ![runto factorial] } then { gdb_suppress_tests }
71 # Don't depend upon argument passing, since most simulators don't currently
72 # support it. Bash value variable to be what we want.
73 gdb_test "p value=6" "" "set value to 6 in watchpoint_command_test"
76 # Verify that we can create a watchpoint, and give it a commands
77 # list that continues the inferior. We set the watchpoint on a
78 # local variable, too, so that it self-deletes when the watched
79 # data goes out of scope.
81 # What should happen is: Each time the watchpoint triggers, it
82 # continues the inferior. Eventually, the watchpoint will self-
83 # delete, when the watched variable is out of scope. But by that
84 # time, the inferior should have exited. GDB shouldn't crash or
85 # anything untoward as a result of this.
87 send_gdb "watch local_var\n"
89 -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $"\
90 { pass "watch local_var"
91 set wp_id $expect_out(1,string)
92 send_gdb "commands $wp_id\n"
94 -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
95 { pass "begin commands on watch"}
97 {fail "begin commands on watch"}
98 timeout {fail "(timeout) begin commands on watch"}
102 {fail "watch local_var"}
103 timeout {fail "(timeout) watch local_var"}
105 # set wp_id $expect_out(1,string)
106 # send_gdb "commands $wp_id\n"
108 # -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
109 # {pass "begin commands on watch"}
110 # -re "$gdb_prompt $"\
111 # {fail "begin commands on watch"}
112 # timeout {fail "(timeout) begin commands on watch"}
114 send_gdb "print value\n"
117 {pass "add print command to watch"}
119 {fail "add print command to watch"}
120 timeout {fail "(timeout) add print command to watch"}
122 send_gdb "continue\n"
125 {pass "add continue command to watch"}
127 {fail "add continue command to watch"}
128 timeout {fail "(timeout) add continue command to watch"}
133 {pass "begin commands on watch"}
134 timeout {fail "(timeout) begin commands on watch"}
136 send_gdb "continue\n"
138 -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*in main.*$gdb_prompt $"\
139 {pass "continue with watch"}
141 {fail "continue with watch"}
142 timeout {fail "(timeout) continue with watch"}
144 send_gdb "continue\n"
146 -re "Continuing.*$gdb_prompt $"\
147 {pass "continue until exit"}
149 {fail "continue until exit"}
150 timeout {fail "(timeout) continue until exit"}
154 watchpoint_command_test