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