]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.hp/gdb.aCC/watch-cmd.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.aCC / watch-cmd.exp
CommitLineData
6aba47ca 1# Copyright (C) 1998, 2007 Free Software Foundation, Inc.
7be570e7
JM
2
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.
12#
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.
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20if $tracelevel then {
21 strace $tracelevel
22}
23
24#
25# test special commands
26#
27set prms_id 0
28set bug_id 0
29
30if { [skip_hp_tests] } then { continue }
31
32set testfile "run"
33set srcfile ${testfile}.c
34set binfile ${objdir}/${subdir}/${testfile}
35if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
b60f0898
JB
36 untested watch-cmd.exp
37 return -1
7be570e7
JM
38
39}
40
41if [get_compiler_info ${binfile}] {
42 return -1;
43}
44if { $gcc_compiled } then { continue }
45
46
47gdb_exit
48gdb_start
49delete_breakpoints
50gdb_reinitialize_dir $srcdir/$subdir
51gdb_load ${binfile}
52
53
54
55proc watchpoint_command_test {} {
56 global gdb_prompt
57
58 if [target_info exists noargs] {
59 verbose "Skipping watchpoint_command_test because of noargs."
60 return
61 }
62
63 if { ![runto factorial] } then { gdb_suppress_tests }
64 # Don't depend upon argument passing, since most simulators don't currently
65 # support it. Bash value variable to be what we want.
66 gdb_test "p value=6" "" "set value to 6 in watchpoint_command_test"
67 delete_breakpoints
68
69 # Verify that we can create a watchpoint, and give it a commands
70 # list that continues the inferior. We set the watchpoint on a
71 # local variable, too, so that it self-deletes when the watched
72 # data goes out of scope.
73 #
74 # What should happen is: Each time the watchpoint triggers, it
75 # continues the inferior. Eventually, the watchpoint will self-
76 # delete, when the watched variable is out of scope. But by that
77 # time, the inferior should have exited. GDB shouldn't crash or
78 # anything untoward as a result of this.
79 #
80 send_gdb "watch local_var\n"
81 gdb_expect {
82 -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $"\
83 { pass "watch local_var"
84 set wp_id $expect_out(1,string)
85 send_gdb "commands $wp_id\n"
86 gdb_expect {
87 -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
88 { pass "begin commands on watch"}
89 -re "$gdb_prompt $"\
90 {fail "begin commands on watch"}
91 timeout {fail "(timeout) begin commands on watch"}
92 }
93 }
94 -re "$gdb_prompt $"\
95 {fail "watch local_var"}
96 timeout {fail "(timeout) watch local_var"}
97 }
98# set wp_id $expect_out(1,string)
99# send_gdb "commands $wp_id\n"
100# gdb_expect {
101# -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
102# {pass "begin commands on watch"}
103# -re "$gdb_prompt $"\
104# {fail "begin commands on watch"}
105# timeout {fail "(timeout) begin commands on watch"}
106# }
107 send_gdb "print value\n"
108 gdb_expect {
109 -re ">"\
110 {pass "add print command to watch"}
111 -re "$gdb_prompt $"\
112 {fail "add print command to watch"}
113 timeout {fail "(timeout) add print command to watch"}
114 }
115 send_gdb "continue\n"
116 gdb_expect {
117 -re ">"\
118 {pass "add continue command to watch"}
119 -re "$gdb_prompt $"\
120 {fail "add continue command to watch"}
121 timeout {fail "(timeout) add continue command to watch"}
122 }
123 send_gdb "end\n"
124 gdb_expect {
125 -re "$gdb_prompt $"\
126 {pass "begin commands on watch"}
127 timeout {fail "(timeout) begin commands on watch"}
128 }
129 send_gdb "continue\n"
130 gdb_expect {
131 -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*in main.*$gdb_prompt $"\
132 {pass "continue with watch"}
133 -re "$gdb_prompt $"\
134 {fail "continue with watch"}
135 timeout {fail "(timeout) continue with watch"}
136 }
137 send_gdb "continue\n"
138 gdb_expect {
139 -re "Continuing.*$gdb_prompt $"\
140 {pass "continue until exit"}
141 -re "$gdb_prompt $"\
142 {fail "continue until exit"}
143 timeout {fail "(timeout) continue until exit"}
144 }
145}
146
147watchpoint_command_test
148
149
150
151
152
153
154
155
156
157
158