]>
Commit | Line | Data |
---|---|---|
d55ea55c DT |
1 | # Copyright (C) 1998 Free Software Foundation, Inc. |
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 | ||
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
24 | # | |
25 | # test special commands | |
26 | # | |
27 | set prms_id 0 | |
28 | set bug_id 0 | |
29 | ||
30 | set testfile "run-hp" | |
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." | |
35 | ||
36 | } | |
37 | ||
7930c920 EZ |
38 | # are we on a target board |
39 | if ![isnative] then { | |
40 | return | |
41 | } | |
42 | ||
43 | if {![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"]} { | |
44 | #setup_xfail "*-*.*" | |
45 | return 0 | |
46 | } | |
47 | ||
48 | if [get_compiler_info ${binfile}] { | |
49 | return -1; | |
50 | } | |
51 | if {[skip_hp_tests $gcc_compiled]} then { continue } | |
52 | ||
53 | ||
d55ea55c DT |
54 | gdb_exit |
55 | gdb_start | |
56 | delete_breakpoints | |
57 | gdb_reinitialize_dir $srcdir/$subdir | |
58 | gdb_load ${binfile} | |
59 | ||
60 | ||
61 | ||
62 | proc watchpoint_command_test {} { | |
63 | global gdb_prompt | |
64 | ||
65 | if [target_info exists noargs] { | |
66 | verbose "Skipping watchpoint_command_test because of noargs." | |
67 | return | |
68 | } | |
69 | ||
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" | |
74 | delete_breakpoints | |
75 | ||
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. | |
80 | # | |
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. | |
86 | # | |
87 | send_gdb "watch local_var\n" | |
88 | gdb_expect { | |
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" | |
93 | gdb_expect { | |
94 | -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\ | |
95 | { pass "begin commands on watch"} | |
96 | -re "$gdb_prompt $"\ | |
97 | {fail "begin commands on watch"} | |
98 | timeout {fail "(timeout) begin commands on watch"} | |
99 | } | |
100 | } | |
101 | -re "$gdb_prompt $"\ | |
102 | {fail "watch local_var"} | |
103 | timeout {fail "(timeout) watch local_var"} | |
104 | } | |
105 | # set wp_id $expect_out(1,string) | |
106 | # send_gdb "commands $wp_id\n" | |
107 | # gdb_expect { | |
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"} | |
113 | # } | |
114 | send_gdb "print value\n" | |
115 | gdb_expect { | |
116 | -re ">"\ | |
117 | {pass "add print command to watch"} | |
118 | -re "$gdb_prompt $"\ | |
119 | {fail "add print command to watch"} | |
120 | timeout {fail "(timeout) add print command to watch"} | |
121 | } | |
122 | send_gdb "continue\n" | |
123 | gdb_expect { | |
124 | -re ">"\ | |
125 | {pass "add continue command to watch"} | |
126 | -re "$gdb_prompt $"\ | |
127 | {fail "add continue command to watch"} | |
128 | timeout {fail "(timeout) add continue command to watch"} | |
129 | } | |
130 | send_gdb "end\n" | |
131 | gdb_expect { | |
132 | -re "$gdb_prompt $"\ | |
133 | {pass "begin commands on watch"} | |
134 | timeout {fail "(timeout) begin commands on watch"} | |
135 | } | |
136 | send_gdb "continue\n" | |
137 | gdb_expect { | |
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"} | |
140 | -re "$gdb_prompt $"\ | |
141 | {fail "continue with watch"} | |
142 | timeout {fail "(timeout) continue with watch"} | |
143 | } | |
144 | send_gdb "continue\n" | |
145 | gdb_expect { | |
146 | -re "Continuing.*$gdb_prompt $"\ | |
147 | {pass "continue until exit"} | |
148 | -re "$gdb_prompt $"\ | |
149 | {fail "continue until exit"} | |
150 | timeout {fail "(timeout) continue until exit"} | |
151 | } | |
152 | } | |
153 | ||
154 | watchpoint_command_test | |
155 | ||
156 | ||
157 | ||
158 | ||
159 | ||
160 | ||
161 | ||
162 | ||
7930c920 EZ |
163 | |
164 | ||
165 |