No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.hp / gdb.aCC / watch-cmd.exp
blobe447c0b5cf50d9f48c59f0c865a09ab72c5fba47
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.
7 #
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
20 if $tracelevel then {
21 strace $tracelevel
25 # test special commands
27 set prms_id 0
28 set bug_id 0
30 if { [skip_hp_tests] } then { continue }
32 set testfile "run"
33 set srcfile ${testfile}.c
34 set binfile ${objdir}/${subdir}/${testfile}
35 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
36 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
40 if [get_compiler_info ${binfile}] {
41 return -1;
43 if { $gcc_compiled } then { continue }
46 gdb_exit
47 gdb_start
48 delete_breakpoints
49 gdb_reinitialize_dir $srcdir/$subdir
50 gdb_load ${binfile}
54 proc watchpoint_command_test {} {
55 global gdb_prompt
57 if [target_info exists noargs] {
58 verbose "Skipping watchpoint_command_test because of noargs."
59 return
62 if { ![runto factorial] } then { gdb_suppress_tests }
63 # Don't depend upon argument passing, since most simulators don't currently
64 # support it. Bash value variable to be what we want.
65 gdb_test "p value=6" "" "set value to 6 in watchpoint_command_test"
66 delete_breakpoints
68 # Verify that we can create a watchpoint, and give it a commands
69 # list that continues the inferior. We set the watchpoint on a
70 # local variable, too, so that it self-deletes when the watched
71 # data goes out of scope.
73 # What should happen is: Each time the watchpoint triggers, it
74 # continues the inferior. Eventually, the watchpoint will self-
75 # delete, when the watched variable is out of scope. But by that
76 # time, the inferior should have exited. GDB shouldn't crash or
77 # anything untoward as a result of this.
79 send_gdb "watch local_var\n"
80 gdb_expect {
81 -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $"\
82 { pass "watch local_var"
83 set wp_id $expect_out(1,string)
84 send_gdb "commands $wp_id\n"
85 gdb_expect {
86 -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
87 { pass "begin commands on watch"}
88 -re "$gdb_prompt $"\
89 {fail "begin commands on watch"}
90 timeout {fail "(timeout) begin commands on watch"}
93 -re "$gdb_prompt $"\
94 {fail "watch local_var"}
95 timeout {fail "(timeout) watch local_var"}
97 # set wp_id $expect_out(1,string)
98 # send_gdb "commands $wp_id\n"
99 # gdb_expect {
100 # -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
101 # {pass "begin commands on watch"}
102 # -re "$gdb_prompt $"\
103 # {fail "begin commands on watch"}
104 # timeout {fail "(timeout) begin commands on watch"}
106 send_gdb "print value\n"
107 gdb_expect {
108 -re ">"\
109 {pass "add print command to watch"}
110 -re "$gdb_prompt $"\
111 {fail "add print command to watch"}
112 timeout {fail "(timeout) add print command to watch"}
114 send_gdb "continue\n"
115 gdb_expect {
116 -re ">"\
117 {pass "add continue command to watch"}
118 -re "$gdb_prompt $"\
119 {fail "add continue command to watch"}
120 timeout {fail "(timeout) add continue command to watch"}
122 send_gdb "end\n"
123 gdb_expect {
124 -re "$gdb_prompt $"\
125 {pass "begin commands on watch"}
126 timeout {fail "(timeout) begin commands on watch"}
128 send_gdb "continue\n"
129 gdb_expect {
130 -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*in main.*$gdb_prompt $"\
131 {pass "continue with watch"}
132 -re "$gdb_prompt $"\
133 {fail "continue with watch"}
134 timeout {fail "(timeout) continue with watch"}
136 send_gdb "continue\n"
137 gdb_expect {
138 -re "Continuing.*$gdb_prompt $"\
139 {pass "continue until exit"}
140 -re "$gdb_prompt $"\
141 {fail "continue until exit"}
142 timeout {fail "(timeout) continue until exit"}
146 watchpoint_command_test