Commit | Line | Data |
---|---|---|
d99968dc | 1 | # Copyright 1999, 2000, 2001, 2002, 2003 |
a4cb37cb SS |
2 | # Free Software Foundation, Inc. |
3 | ||
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | ||
18 | # Please email any bugs, comments, and/or additions to this file to: | |
19 | # bug-gdb@prep.ai.mit.edu | |
20 | ||
21 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) | |
22 | ||
23 | if $tracelevel then { | |
24 | strace $tracelevel | |
25 | } | |
26 | ||
27 | ||
fc33412a DT |
28 | # are we on a target board? If so, don't run these tests. |
29 | # note: this is necessary because we cannot use runto_main (which would | |
30 | # work for remote targets too) because of the different prompt we get | |
31 | # when using annotation level 2. | |
32 | # | |
676a0442 | 33 | if [is_remote target] then { |
fc33412a DT |
34 | return 0 |
35 | } | |
36 | ||
37 | ||
a4cb37cb SS |
38 | # |
39 | # test running programs | |
40 | # | |
41 | set prms_id 0 | |
42 | set bug_id 0 | |
43 | ||
44 | set testfile "annota1" | |
45 | set srcfile ${testfile}.c | |
46 | set binfile ${objdir}/${subdir}/${testfile} | |
47 | ||
48 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { | |
49 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
50 | } | |
51 | ||
52 | ||
a4cb37cb SS |
53 | gdb_exit |
54 | gdb_start | |
55 | gdb_reinitialize_dir $srcdir/$subdir | |
56 | gdb_load ${binfile} | |
57 | ||
58 | if [target_info exists gdb_stub] { | |
59 | gdb_step_for_stub; | |
60 | } | |
61 | ||
62 | # | |
63 | # the line at which break main will put the breakpoint | |
64 | # | |
085dd6e6 | 65 | set main_line 32 |
a4cb37cb SS |
66 | |
67 | # The commands we test here produce many lines of output; disable "press | |
68 | # <return> to continue" prompts. | |
69 | send_gdb "set height 0\n" | |
70 | gdb_expect -re "$gdb_prompt $" | |
71 | ||
72 | # | |
73 | # break at main | |
74 | # | |
75 | gdb_test "break main" \ | |
76 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
77 | "breakpoint main" | |
78 | ||
79 | ||
80 | # | |
81 | # NOTE: this prompt is OK only when the annotation level is > 1 | |
82 | # NOTE: When this prompt is in use the gdb_test procedure cannot be used because | |
83 | # it assumes that the last char after the gdb_prompt is a white space. This is not | |
84 | # true with this annotated prompt. So we must use send_gdb and gdb_expect. | |
85 | # | |
86 | ||
87 | set old_gdb_prompt $gdb_prompt | |
88 | set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" | |
89 | ||
d99968dc EZ |
90 | # |
91 | # Escape all the characters in the path that need it. For instance | |
92 | # the directory name could contain '+'. | |
93 | # | |
94 | set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}] | |
a4cb37cb SS |
95 | |
96 | ||
97 | # | |
98 | # set the annotation level to 2 | |
99 | # | |
100 | # of course, this will test: | |
101 | # annotate-pre-prompt | |
102 | # annotate-prompt | |
103 | # annotate-post-prompt (in the next block) | |
104 | # | |
105 | send_gdb "set annotate 2\n" | |
106 | gdb_expect { | |
107 | -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" } | |
108 | -re ".*$gdb_prompt$" { fail "annotation set at level 2" } | |
109 | timeout { fail "annotation set at level 2 (timeout)" } | |
110 | } | |
111 | ||
112 | ||
113 | # | |
114 | # info break will test: | |
115 | # annotate-breakpoints-headers | |
116 | # annotate-field | |
117 | # annotate-breakpoints-table | |
118 | # annotate-record | |
119 | # annotate-breakpoints-table-end | |
120 | # | |
121 | send_gdb "info break\n" | |
122 | gdb_expect { | |
d99968dc | 123 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ |
a4cb37cb | 124 | {pass "breakpoint info"} |
d99968dc EZ |
125 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ |
126 | { setup_xfail "*-*-*" 1270 | |
127 | fail "breakpoint info"} | |
a4cb37cb SS |
128 | -re ".*$gdb_prompt$" { fail "breakpoint info" } |
129 | timeout { fail "breakpoint info (timeout)" } | |
130 | } | |
131 | ||
132 | ||
133 | # | |
134 | # run to a break point will test: | |
135 | # annotate-frames-invalid | |
136 | # annotate-breakpoints-invalid (a.k.a. breakpoints-changed) | |
137 | # annotate-starting | |
138 | # annotate-breakpoint | |
139 | # annotate-frame-begin | |
140 | # annotate-frame-function-name | |
141 | # annotate-frame-args | |
142 | # annotate-frame-source-begin | |
143 | # annotate-frame-source-file | |
144 | # annotate-frame-source-file-end | |
145 | # annotate-frame-source-line | |
146 | # annotate-frame-source-end | |
147 | # annotate-source | |
148 | # annotate-frame-end | |
149 | # annotate-stopped | |
150 | # | |
392a587b | 151 | #exp_internal 1 |
a4cb37cb | 152 | send_gdb "run\n" |
7346e70f MS |
153 | gdb_expect { |
154 | -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" { | |
155 | pass "run until main breakpoint" | |
156 | } | |
157 | -re ".*$gdb_prompt$" { | |
158 | fail "run until main breakpoint" | |
159 | } | |
160 | timeout { | |
161 | fail "run until main breakpoint (timeout)" | |
162 | } | |
a4cb37cb | 163 | } |
392a587b JM |
164 | #exp_internal 0 |
165 | #exit 0 | |
a4cb37cb SS |
166 | |
167 | # | |
168 | # Let's do a next, to get to a point where the array is initialized | |
169 | # We don't care about the annotated output for this operation, it is the same as | |
170 | # the one produced by run above | |
171 | # | |
172 | send_gdb "next\n" | |
173 | gdb_expect { | |
174 | -re ".*$gdb_prompt$" { pass "go after array init line" } | |
175 | timeout { fail "go after array init line (timeout)" } | |
176 | } | |
177 | ||
178 | ||
179 | # | |
180 | # printing the array will test: | |
181 | # annotate-value-history-begin | |
182 | # annotate-value-history-value | |
183 | # annotate-array-section-begin | |
184 | # annotate-elt | |
185 | # FIXME: annotate-elt-rep and annotate-elt-rep-end not tested | |
186 | # annotate-array-section-end | |
187 | # annotate-value-history-end | |
188 | # FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output | |
189 | # command would cause them to be used) | |
190 | # | |
191 | send_gdb "print my_array\n" | |
192 | gdb_expect { | |
193 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n.\r\n\032\032array-section-begin 0 -\r\n1\r\n\032\032elt\r\n, 2\r\n\032\032elt\r\n, 3\r\n\032\032elt\r\n\r\n\032\032array-section-end\r\n.\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" \ | |
194 | { pass "print array" } | |
195 | -re ".*$gdb_prompt$" { fail "print array" } | |
196 | timeout { fail "print array (timeout)" } | |
197 | } | |
198 | ||
199 | ||
200 | # | |
201 | # this should generate an error message, so to test: | |
202 | # annotate-error-begin | |
203 | # FIXME: annotate-error not tested | |
204 | # | |
205 | ||
206 | #exp_internal 1 | |
207 | send_gdb "print non_existent_value\n" | |
208 | gdb_expect { | |
209 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" \ | |
210 | { pass "print non_existent_value" } | |
211 | -re ".*$gdb_prompt$" { fail "print non_existent_value" } | |
212 | timeout { fail "print non_existent_value (timeout)" } | |
213 | } | |
214 | ||
215 | ||
216 | # | |
217 | # break at signal handler. So that, once we are in the sig handler, if we do a bt | |
218 | # we can test annotate-signal-handler-caller | |
219 | # | |
220 | send_gdb "break handle_USR1\n" | |
221 | gdb_expect { | |
222 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \ | |
223 | { pass "breakpoint handle_USR1" } | |
224 | -re ".*$gdb_prompt$" { fail "break at handle_USR1" } | |
225 | timeout { fail "break at handle_USR1 (timeout)" } | |
226 | } | |
227 | ||
228 | # | |
229 | # break at printf. When we are stopped at printf, we can test | |
230 | # | |
231 | send_gdb "break printf\n" | |
232 | gdb_expect { | |
233 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \ | |
234 | { pass "breakpoint printf" } | |
235 | -re ".*$gdb_prompt$" { fail "break printf" } | |
236 | timeout { fail "break printf (timeout)" } | |
237 | } | |
238 | ||
239 | # | |
240 | # get to printf | |
241 | # | |
242 | send_gdb "continue\n" | |
243 | gdb_expect { | |
a0b3c4fd | 244 | -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ |
a4cb37cb SS |
245 | { pass "continue to printf" } |
246 | -re ".*$gdb_prompt$" { fail "continue to printf" } | |
247 | timeout { fail "continue to printf (timeout)" } | |
248 | } | |
249 | ||
250 | # | |
251 | # test: | |
252 | # annotate-frame-where | |
253 | # annotate-frame-address | |
254 | # annotate-frame-address-end | |
255 | # | |
256 | send_gdb "backtrace\n" | |
257 | gdb_expect { | |
d99968dc | 258 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" \ |
7148ab62 | 259 | { pass "backtrace from shlibrary" } |
d99968dc EZ |
260 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" \ |
261 | { setup_xfail "*-*-*" 1270 | |
262 | fail "backtrace from shlibrary" } | |
a4cb37cb SS |
263 | -re ".*$gdb_prompt$" { fail "backtrace from shlibrary" } |
264 | timeout { fail "backtrace from shlibrary (timeout)" } | |
265 | } | |
266 | ||
267 | ||
268 | # | |
269 | # test printing a frame with some arguments: | |
270 | # annotate-arg-begin | |
271 | # annotate-arg-name-end | |
272 | # annotate-arg-value | |
273 | # annotate-arg-end | |
274 | # | |
275 | send_gdb "signal SIGUSR1\n" | |
276 | gdb_expect { | |
d99968dc | 277 | -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ |
a4cb37cb | 278 | { pass "send SIGUSR1" } |
d99968dc EZ |
279 | -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ |
280 | { setup_xfail "*-*-*" 1270 | |
281 | fail "send SIGUSR1" } | |
a4cb37cb SS |
282 | -re ".*$gdb_prompt$" { fail "send SIGUSR1" } |
283 | timeout { fail "send SIGUSR1 (timeout)" } | |
284 | } | |
285 | ||
286 | ||
287 | # | |
288 | # test: | |
289 | # annotate-signal-handler-caller | |
290 | # | |
0f71a2f6 JM |
291 | verbose "match_max local is: [match_max]" |
292 | verbose "match_max default is: [match_max -d]" | |
293 | # This is necessary because a 2000 buffer is not enought to get everything | |
294 | # up to the prompt ad the test gets a timeout. | |
295 | match_max 3000 | |
296 | verbose "match_max now is: [match_max]" | |
a4cb37cb SS |
297 | send_gdb "backtrace\n" |
298 | gdb_expect { | |
0b915e9c | 299 | -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" { |
0a791409 MS |
300 | pass "backtrace @ signal handler" |
301 | } | |
302 | -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" } | |
303 | timeout { fail "backtrace @ signal handler (timeout)" } | |
a4cb37cb SS |
304 | } |
305 | ||
306 | # | |
307 | # delete all the breakpoints | |
308 | # | |
309 | send_gdb "delete 1\n" | |
310 | gdb_expect { | |
311 | -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ | |
312 | { pass "delete bp 1" } | |
313 | -re ".*$gdb_prompt$" { fail "delete bp 1" } | |
314 | timeout { fail "delete bp 1 (timeout)" } | |
315 | } | |
316 | ||
317 | send_gdb "delete 2\n" | |
318 | gdb_expect { | |
319 | -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ | |
320 | { pass "delete bp 2" } | |
321 | -re ".*$gdb_prompt$" { fail "delete bp 2 " } | |
322 | timeout { fail "delete bp 2 (timeout)" } | |
323 | } | |
324 | ||
325 | send_gdb "delete 3\n" | |
326 | gdb_expect { | |
327 | -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ | |
328 | { pass "delete bp 3" } | |
329 | -re ".*$gdb_prompt$" { fail "delete bp 3" } | |
330 | timeout { fail "delete bp 3 (timeout)" } | |
331 | } | |
332 | ||
333 | # | |
334 | # break at main, after value is initialized. This is in preparation | |
335 | # to test the annotate output for the display command. | |
336 | # | |
337 | send_gdb "break main\n" | |
338 | gdb_expect { | |
d99968dc | 339 | -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" \ |
a4cb37cb | 340 | { pass "break at 28" } |
d99968dc EZ |
341 | -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*$gdb_prompt$" \ |
342 | { setup_xfail "*-*-*" 1270 | |
343 | fail "break at 28" } | |
a4cb37cb SS |
344 | -re ".*$gdb_prompt$" { fail "break at 28" } |
345 | timeout { fail "break at 28 (timeout)" } | |
346 | } | |
347 | ||
348 | # | |
349 | # display the value; test: | |
350 | # annotate-display-begin | |
351 | # annotate-display-number-end | |
352 | # annotate-display-format | |
353 | # annotate-display-expression | |
354 | # annotate-display-expression-end | |
355 | # annotate-display-end | |
356 | # FIXME: annotate-display-value not tested | |
357 | # | |
358 | send_gdb "display value\n" | |
359 | gdb_expect { | |
360 | -re "post-prompt\r\n\r\n\032\032display-begin\r\n1\r\n\032\032display-number-end\r\n: \r\n\032\032display-format\r\n\r\n\032\032display-expression\r\nvalue\r\n\032\032display-expression-end\r\n = \r\n\032\032display-expression\r\n7\r\n\r\n\032\032display-end\r\n$gdb_prompt$" \ | |
361 | { pass "set up display" } | |
362 | -re ".*$gdb_prompt$" { fail "set up display" } | |
363 | timeout { fail "set up display (timeout)" } | |
364 | } | |
365 | ||
366 | ||
367 | # should ask query. Test annotate-query. | |
368 | # we don't care about anything else here, only the query. | |
369 | ||
370 | send_gdb "run\n" | |
371 | gdb_expect { | |
372 | -re "pre-query.*already.*\\(y or n\\).*query\r\n" { | |
373 | send_gdb "y\n" | |
374 | gdb_expect { | |
375 | -re ".*post-query.*$gdb_prompt$" \ | |
376 | { pass "re-run" } | |
377 | -re ".*$gdb_prompt$" { fail "re-run" } | |
378 | timeout { fail "re-run (timeout)" } | |
379 | } | |
380 | } | |
381 | -re ".*$gdb_prompt$" { fail "re-run" } | |
382 | timeout { fail "re-run (timeout)" } | |
383 | } | |
384 | ||
5c44784c JM |
385 | # |
386 | # Test that breakpoints-invalid is issued once and only once for | |
387 | # breakpoint ignore count changes, after annotation stopped. | |
388 | # | |
389 | send_gdb "break 46\n" | |
390 | gdb_expect { | |
391 | -re "Breakpoint 5 at $hex: file .*$srcfile, line 46.*$gdb_prompt$" { | |
392 | pass "break at 46" | |
393 | } | |
394 | -re ".*$gdb_prompt$" { fail "break at 46" } | |
395 | timeout { fail "break at 46 (timeout)" } | |
396 | } | |
397 | ||
398 | send_gdb "ignore 5 4\n" | |
399 | gdb_expect { | |
400 | -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" { | |
401 | pass "ignore 5 4" | |
402 | } | |
403 | -re ".*$gdb_prompt$" { fail "ignore 5 4" } | |
404 | timeout { fail "ignore 5 4 (timeout)" } | |
405 | } | |
406 | ||
407 | send_gdb "continue\n" | |
408 | gdb_expect { | |
409 | -re ".*$srcfile:46:.*\032\032stopped\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" { | |
410 | pass "annotate ignore count change" | |
411 | } | |
412 | -re ".*$gdb_prompt$" { fail "annotate ignore count change" } | |
413 | timeout { fail "annotate ignore count change (timeout)" } | |
414 | } | |
415 | ||
416 | # check that ignore command is working, or the above can provide | |
417 | # misleading assurance ... | |
418 | ||
419 | send_gdb "next\n" | |
420 | gdb_expect { | |
421 | -re "$gdb_prompt$" {} | |
422 | timeout { fail "next to exit loop" } | |
423 | } | |
424 | ||
425 | send_gdb "next\n" | |
426 | gdb_expect { | |
427 | -re ".*$srcfile:49:.*$gdb_prompt$" { | |
428 | pass "breakpoint ignore count" | |
429 | } | |
430 | -re ".*$gdb_prompt$" { fail "breakpoint ignore count" } | |
431 | timeout { fail "breakpoint ignore count (timeout)" } | |
432 | } | |
a4cb37cb SS |
433 | |
434 | # | |
435 | # Send a signal that is not handled; test: | |
436 | # annotate-signalled | |
437 | # annotate-signal-name | |
438 | # annotate-signal-name-end | |
439 | # annotate-signal-string | |
440 | # annotate-signal-string-end | |
441 | # FIXME: annotate-signal not tested (requires that the inferior be | |
442 | # stopped by a "random" signal) | |
443 | # | |
8fb87725 JL |
444 | # SIGTRAP signals are dropped before they get to the inferior process |
445 | # on hpux11. In theory, this behaivor can be controlled by setting | |
446 | # TTEO_NORM_SIGTRAP in the inferior, but doing so did not cause | |
447 | # the signal to be properly delivered. | |
448 | # | |
449 | # It has been verified that other signals will be delivered. However, | |
450 | # rather than twiddle the test, I choose to leave it as-is as it | |
451 | # exposes an interesting failure on hpux11. | |
452 | setup_xfail hppa*-*-hpux11* | |
a4cb37cb SS |
453 | send_gdb "signal SIGTRAP\n" |
454 | gdb_expect { | |
11cf8741 | 455 | -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ |
a4cb37cb SS |
456 | { pass "signal sent" } |
457 | -re ".*$gdb_prompt$" { fail "signal sent" } | |
458 | timeout { fail "signal sent (timeout)" } | |
459 | } | |
460 | ||
461 | ||
462 | # Check for production of a core file | |
463 | # and remove it! | |
464 | ||
465 | set exec_output [remote_exec build "ls core"] | |
466 | ||
467 | if [ regexp "core not found" $exec_output] { | |
468 | pass "No core dumped" | |
469 | } else { | |
470 | if [ regexp "No such file or directory" $exec_output] { | |
471 | pass "No core dumped" | |
472 | } else { | |
473 | remote_exec build "rm -f core" | |
474 | pass "Core dumped and removed" | |
475 | } | |
476 | } | |
477 | ||
a4cb37cb SS |
478 | # restore the original prompt for the rest of the testsuite |
479 | ||
480 | set gdb_prompt $old_gdb_prompt |