Commit | Line | Data |
---|---|---|
9b254dd1 | 1 | # Copyright 1998, 1999, 2007, 2008 Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c SS |
15 | |
16 | # Please email any bugs, comments, and/or additions to this file to: | |
17 | # bug-gdb@prep.ai.mit.edu | |
18 | ||
19 | # This file was written by Michael Snyder (msnyder@cygnus.com) | |
20 | ||
21 | load_lib "trace-support.exp"; | |
22 | ||
23 | if $tracelevel then { | |
24 | strace $tracelevel | |
25 | } | |
26 | ||
27 | set prms_id 0 | |
28 | set bug_id 0 | |
29 | ||
30 | gdb_exit | |
31 | gdb_start | |
32 | ||
33 | if [istarget "m68k-*-elf"] then { | |
34 | set srcfile gdb_c_test.c | |
35 | set binfile [board_info target d490_binfile]; | |
36 | } else { | |
37 | set testfile "actions" | |
38 | set srcfile ${testfile}.c | |
39 | set binfile $objdir/$subdir/$testfile | |
40 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
fc91c6c2 | 41 | executable {debug nowarnings}] != "" } { |
b60f0898 JB |
42 | untested deltrace.exp |
43 | return -1 | |
c906108c SS |
44 | } |
45 | } | |
46 | gdb_reinitialize_dir $srcdir/$subdir | |
47 | ||
48 | # If testing on a remote host, download the source file. | |
49 | # remote_download host $srcdir/$subdir/$srcfile | |
50 | ||
51 | gdb_file_cmd $binfile | |
52 | ||
53 | # define relative source line numbers: | |
54 | # all subsequent line numbers are relative to this first one (baseline) | |
55 | set baseline [gdb_find_recursion_test_baseline $srcfile]; | |
56 | if { $baseline == -1 } then { | |
57 | fail "Could not find gdb_recursion_test function" | |
58 | return; | |
59 | } | |
60 | set testline1 [expr $baseline + 4] | |
61 | ||
62 | # | |
63 | # test "delete tracepoints" command | |
64 | # | |
65 | ||
66 | # 3.1 delete tracepoints (all) | |
67 | gdb_delete_tracepoints | |
68 | gdb_test "trace gdb_c_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 1" | |
69 | gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2" | |
70 | gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3" | |
71 | ||
72 | gdb_test "info tracepoints" \ | |
75ac9d7b | 73 | "Num Enb Address\[ \]+PassC StepC What.*\[0-9\]+\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_c_test.*\[0-9\]+\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*gdb_asm_test.*\[0-9\]+\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_recursion_test.*" \ |
c906108c SS |
74 | "3.1a: set three tracepoints" |
75 | ||
76 | send_gdb "delete tracepoints\n" | |
77 | gdb_expect 30 { | |
78 | -re "Delete all tracepoints.*y or n.*$" { | |
79 | send_gdb "y\n" | |
80 | gdb_expect 30 { | |
81 | -re "$gdb_prompt $" { | |
82 | pass "3.1b: delete all tracepoints" | |
83 | } | |
84 | timeout { fail "3.1b: delete all tracepoints (timeout)" } | |
85 | } | |
86 | } | |
87 | -re "$gdb_prompt $" { # This should only happen if there are no tracepoints | |
88 | fail "3.1b: delete all tracepoints (no tracepoints?)" | |
89 | } | |
90 | timeout { fail "3.1b: delete all tracepoints (timeout)" } | |
91 | } | |
92 | ||
93 | # 3.2 delete tracepoint <n> | |
94 | gdb_delete_tracepoints | |
95 | set trcpt1 [gdb_gettpnum gdb_c_test]; | |
96 | set trcpt2 [gdb_gettpnum gdb_asm_test]; | |
97 | set trcpt3 [gdb_gettpnum $testline1]; | |
98 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { | |
99 | fail "setting tracepoints" | |
100 | return; | |
101 | } | |
102 | ||
103 | gdb_test "info tracepoints" \ | |
75ac9d7b | 104 | "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in.*gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in.*gdb_recursion_test.*" \ |
c906108c SS |
105 | "3.2a: set three tracepoints" |
106 | ||
107 | #gdb_test "delete tracepoint $trcpt1" "" "" | |
108 | send_gdb "delete tracepoint $trcpt1\n" | |
109 | gdb_expect { | |
110 | -re "No tracepoint number.*$gdb_prompt $" { | |
111 | fail "3.2b: delete first tracepoint" | |
112 | } | |
113 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
114 | fail "3.2b: delete first tracepoint" | |
115 | } | |
116 | -re "$gdb_prompt $" { | |
117 | pass "3.2b: delete first tracepoint" | |
118 | } | |
119 | timeout { | |
120 | fail "3.2b: delete first tracepoint (timeout)" | |
121 | } | |
122 | } | |
123 | ||
124 | send_gdb "info tracepoints\n" | |
125 | gdb_expect { | |
126 | -re "$trcpt1\[\t \]+y\[\t \]+0x.*in.*gdb_c_test.*$gdb_prompt $" { | |
127 | fail "3.2c: verify delete first tracepoint (argh)" | |
128 | } | |
129 | -re "$trcpt2\[\t \]+y.*gdb_asm_test.*\[\r\n\t ]+$trcpt3\[\t \]+y.* in gdb_recursion_test at .*$gdb_prompt $" { | |
130 | pass "3.2c: verify delete first tracepoint" | |
131 | } | |
132 | -re ".*$gdb_prompt $" { | |
133 | fail "3.2c: verify delete first tracepoint (mumble)" | |
134 | } | |
135 | timeout { | |
136 | fail "3.2c: verify delete first tracepoint (timeout)" | |
137 | } | |
138 | } | |
139 | ||
140 | #gdb_test "delete tracepoint $trcpt2" "" "" | |
141 | send_gdb "delete tracepoint $trcpt2\n" | |
142 | gdb_expect { | |
143 | -re "No tracepoint number.*$gdb_prompt $" { | |
144 | fail "3.2d: delete second tracepoint" | |
145 | } | |
146 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
147 | fail "3.2d: delete second tracepoint" | |
148 | } | |
149 | -re "$gdb_prompt $" { | |
150 | pass "3.2d: delete second tracepoint" | |
151 | } | |
152 | timeout { | |
153 | fail "3.2d: delete second tracepoint (timeout)" | |
154 | } | |
155 | } | |
156 | ||
157 | send_gdb "info tracepoints\n" | |
158 | gdb_expect { | |
159 | -re "$trcpt1\[\t \]+y\[\t \]+0x.*in.*gdb_c_test.*$gdb_prompt $" { | |
160 | fail "3.2e: verify delete second tracepoint" | |
161 | } | |
162 | -re "$trcpt2\[\t \]+y\[\t \]+0x.*in gdb_asm_test.*$gdb_prompt $" { | |
163 | fail "3.2e: verify delete second tracepoint" | |
164 | } | |
165 | -re "$trcpt3\[\t \]+y\[\t \]+0x.*in gdb_recursion_test.*$gdb_prompt $" { | |
166 | pass "3.2e: verify delete second tracepoint" | |
167 | } | |
168 | -re "$gdb_prompt $" { | |
169 | fail "3.2e: verify delete second tracepoint" | |
170 | } | |
171 | timeout { | |
172 | fail "3.2e: verify delete second tracepoint (timeout)" | |
173 | } | |
174 | } | |
175 | ||
176 | #gdb_test "delete tracepoint $trcpt3" "" "" | |
177 | send_gdb "delete tracepoint $trcpt3\n" | |
178 | gdb_expect { | |
179 | -re "No tracepoint number.*$gdb_prompt $" { | |
180 | fail "3.2f: delete third tracepoint" | |
181 | } | |
182 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
183 | fail "3.2f: delete third tracepoint" | |
184 | } | |
185 | -re "$gdb_prompt $" { | |
186 | pass "3.2f: delete third tracepoint" | |
187 | } | |
188 | timeout { | |
189 | fail "3.2f: delete third tracepoint (timeout)" | |
190 | } | |
191 | } | |
192 | ||
193 | # send_gdb "ARF! \\n\n" | |
194 | send_gdb "info tracepoints\n" | |
195 | gdb_expect { | |
196 | -re "$trcpt3\[\t \]+y\[\t \]+0x.*in gdb_recursion_test.*$gdb_prompt $" { | |
197 | fail "3.2g: verify delete third tracepoint" | |
198 | } | |
199 | -re "$gdb_prompt $" { | |
200 | pass "3.2g: verify delete third tracepoint" | |
201 | } | |
202 | timeout { | |
203 | fail "3.2g: verify delete third tracepoint (timeout)" | |
204 | } | |
205 | } | |
206 | ||
207 | # 3.3 delete three tracepoints at once | |
208 | gdb_delete_tracepoints | |
209 | set trcpt1 [gdb_gettpnum gdb_c_test]; | |
210 | set trcpt2 [gdb_gettpnum gdb_asm_test]; | |
211 | set trcpt3 [gdb_gettpnum $testline1]; | |
212 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { | |
213 | fail "setting tracepoints" | |
214 | return; | |
215 | } | |
216 | ||
217 | gdb_test "info tracepoints" \ | |
75ac9d7b | 218 | "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_recursion_test.*" \ |
c906108c SS |
219 | "3.3a: set three tracepoints" |
220 | ||
221 | #gdb_test "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" "" | |
222 | send_gdb "delete tracepoint $trcpt1 $trcpt2 $trcpt3\n" | |
223 | gdb_expect { | |
224 | -re "No tracepoint number.*$gdb_prompt $" { | |
225 | fail "3.3b: delete three tracepoints" | |
226 | } | |
227 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
228 | fail "3.3b: delete three tracepoints" | |
229 | } | |
230 | -re "$gdb_prompt $" { | |
231 | pass "3.3b: delete three tracepoints" | |
232 | } | |
233 | timeout { | |
234 | fail "3.3b: delete three tracepoint (timeout)" | |
235 | } | |
236 | } | |
237 | ||
238 | send_gdb "info tracepoints\n" | |
239 | gdb_expect { | |
240 | -re "$trcpt1\[\t \]+y\[\t \]+0x.*in gdb_c_test.*$gdb_prompt $" { | |
241 | fail "3.3c: verify delete three tracepoints (first one persists)" | |
242 | } | |
243 | -re "$trcpt2\[\t \]+y\[\t \]+0x.*in gdb_asm_test.*$gdb_prompt $" { | |
244 | fail "3.3c: verify delete three tracepoints (second one persists)" | |
245 | } | |
246 | -re "$trcpt3\[\t \]+y\[\t \]+0x.*in gdb_recursion_test.*$gdb_prompt $" { | |
247 | fail "3.3c: verify delete three tracepoints (third one persists)" | |
248 | } | |
249 | -re "$gdb_prompt $" { | |
250 | pass "3.3c: verify delete three tracepoints" | |
251 | } | |
252 | timeout { | |
253 | fail "3.3c: verify delete three tracepoints (timeout)" | |
254 | } | |
255 | } | |
256 | ||
257 | # 3.4 delete invalid tracepoint number | |
258 | gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \ | |
259 | "No tracepoint number [expr $trcpt2 + $trcpt3]." \ | |
260 | "3.4: delete invalid tracepoint number" | |
261 | ||
262 | # 3.5 delete tracepoint number zero | |
c2d11a7d | 263 | gdb_test "delete tracepoint 0" "bad tracepoint number at or near '0'" \ |
c906108c SS |
264 | "3.5: delete tracepoint number zero" |
265 | ||
266 | # 3.6 help delete tracepoints | |
267 | gdb_test "help delete tracepoints" \ | |
268 | "Delete specified tracepoints.*" \ | |
269 | "3.6: help delete tracepoints" |