packaging: Add python3-base dependency
[platform/upstream/gdb.git] / gdb / testsuite / gdb.base / annota1.exp
1 # Copyright 1999-2023 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 3 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, see <http://www.gnu.org/licenses/>.
15
16 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18
19 # This testcase cannot use runto_main because of the different prompt
20 # we get when using annotation level 2.
21 #
22 if ![target_can_use_run_cmd] {
23     return 0
24 }
25
26 set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
27
28 #
29 # test running programs
30 #
31
32 standard_testfile .c
33
34 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
35     untested "failed to compile"
36     return -1
37 }
38
39
40 clean_restart ${binfile}
41
42 # The commands we test here produce many lines of output; disable "press 
43 # <return> to continue" prompts.
44 gdb_test_no_output "set height 0"
45
46 #
47 # break in main
48 #
49
50 set main_line [gdb_get_line_number "break main"]
51
52 gdb_test "break ${srcfile}:${main_line}" \
53     "Breakpoint.*at.* file .*$srcfile, line $main_line\\." \
54     "breakpoint main"
55
56
57 #
58 # NOTE: this prompt is OK only when the annotation level is > 1
59 # NOTE: When this prompt is in use the gdb_test procedure cannot be used because
60 # it assumes that the last char after the gdb_prompt is a white space. This is not
61 # true with this annotated prompt. So we must use send_gdb and gdb_expect.
62 #
63
64 set old_gdb_prompt $gdb_prompt
65 set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
66
67 #
68 # Escape all the characters in the path that need it. For instance 
69 # the directory name could contain '+'.
70 #
71 set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
72
73
74 #
75 # set the annotation level to 2
76 #
77 # of course, this will test:
78 # annotate-pre-prompt
79 # annotate-prompt
80 # annotate-post-prompt (in the next block)
81 #
82 send_gdb "set annotate 2\n" 
83 gdb_expect {
84     -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
85     -re ".*$gdb_prompt$"       { fail "annotation set at level 2" }
86     timeout                 { fail "annotation set at level 2 (timeout)" }
87   }
88
89
90 #
91 # info break will test:
92 # annotate-breakpoints-headers
93 # annotate-field
94 # annotate-breakpoints-table
95 # annotate-record
96 # annotate-breakpoints-table-end
97 #
98 gdb_test_multiple "info break" "breakpoint info" {
99     -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$" {
100         pass $gdb_test_name
101     }
102     -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$" {
103         setup_xfail "*-*-*" 8375
104         fail $gdb_test_name
105     }
106 }
107
108
109 #
110 # run to a break point will test:
111 # annotate-frames-invalid
112 # annotate-breakpoints-invalid (a.k.a. breakpoints-changed)
113 # annotate-starting
114 # annotate-breakpoint
115 # annotate-frame-begin
116 # annotate-frame-function-name
117 # annotate-frame-args
118 # annotate-frame-source-begin
119 # annotate-frame-source-file
120 # annotate-frame-source-file-end
121 # annotate-frame-source-line
122 # annotate-frame-source-end
123 # annotate-source
124 # annotate-frame-end
125 # annotate-stopped
126 #
127 #exp_internal 1
128 set binexp [string_to_regexp $binfile]
129
130 set warning_slow_re \
131     "warning: File transfers from remote targets can be slow\[^\r\n\]+\r\n"
132 set warning_gdb_index_re \
133     [multi_line \
134          "warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \
135          "Do \"set use-deprecated-index-sections on\" before the file is read" \
136          "to use the section anyway\\.\r\n"]
137 set reading_re \
138     "Reading \[^\r\n\]+\r\n"
139 set libthread_db_re \
140     [multi_line \
141          "\\\[Thread debugging using libthread_db enabled\\\]" \
142          "Using host libthread_db library \[^\r\n\]+\r\n"]
143
144 set optional_re \
145     [list \
146          "\(" \
147          "\($reading_re)" \
148          "|" \
149          "\($warning_slow_re\)" \
150          "|" \
151          "\($libthread_db_re\)" \
152          "|" \
153          "\(\r\n$warning_gdb_index_re\)?" \
154          "\)*"]
155 set optional_re [join $optional_re ""]
156
157 set run_re \
158     [list \
159          "\r\n\032\032post-prompt\r\n" \
160          "Starting program: $binexp \r\n" \
161          $optional_re \
162          "\(\r\n\032\032breakpoints-invalid\r\n\)?" \
163          $optional_re \
164          "\r\n\032\032starting\r\n" \
165          $optional_re \
166          "\r\n\032\032frames-invalid\r\n" \
167          $optional_re \
168          "\r\n\032\032breakpoints-invalid\r\n" \
169          $optional_re \
170          "\r\n\032\032breakpoint 1\r\n" \
171          "\r\n" \
172          "Breakpoint 1, " \
173          "\r\n\032\032frame-begin 0 $hex\r\n" \
174          "\r\n\032\032frame-function-name\r\n" \
175          "main" \
176          "\r\n\032\032frame-args\r\n" \
177          " \\(\\)" \
178          "\r\n\032\032frame-source-begin\r\n" \
179          " at " \
180          "\r\n\032\032frame-source-file\r\n" \
181          ".*annota1.c" \
182          "\r\n\032\032frame-source-file-end\r\n" \
183          ":" \
184          "\r\n\032\032frame-source-line\r\n" \
185          "$main_line" \
186          "\r\n\032\032frame-source-end\r\n" \
187          "\r\n" \
188          "\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n" \
189          "\r\n\032\032frame-end\r\n" \
190          "\r\n\032\032stopped\r\n"]
191
192 set run_re [join $run_re ""]
193
194 gdb_test_multiple "run" "run until main breakpoint" {
195     -re $run_re.*$gdb_prompt$ {
196         pass $gdb_test_name
197     }
198 }
199 #exp_internal 0
200 #exit 0
201
202 #
203 # Let's do a next, to get to a point where the array is initialized
204 # We don't care about the annotated output for this operation, it is the same as
205 # the one produced by run above
206 #
207 gdb_test_multiple "next" "go after array init line" {
208     -re "source .*annota1.c.*$gdb_prompt$" {
209         pass $gdb_test_name
210     }
211 }
212
213
214 #
215 # printing the array will test:
216 # annotate-value-history-begin
217 # annotate-value-history-value
218 # annotate-array-section-begin
219 # annotate-elt
220 # FIXME: annotate-elt-rep and annotate-elt-rep-end not tested
221 # annotate-array-section-end
222 # annotate-value-history-end
223 # FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output
224 #              command would cause them to be used)
225 #
226 gdb_test_multiple "print my_array" "print array" {
227     -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$" {
228         pass $gdb_test_name
229     }
230 }
231
232
233 #
234 # this should generate an error message, so to test:
235 # annotate-error-begin
236 # FIXME: annotate-error not tested
237 #
238
239 #exp_internal 1
240 gdb_test_multiple "print non_existent_value" "print non_existent_value" {
241     -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$" {
242         pass $gdb_test_name
243     }
244 }
245
246
247 #
248 # break at signal handler. So that, once we are in the sig handler, if we do a bt
249 # we can test annotate-signal-handler-caller
250 #
251 gdb_test_multiple "break handle_USR1" "break handle_USR1" {
252     -re  "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
253         pass $gdb_test_name
254     }
255 }
256
257 #
258 # break at printf. When we are stopped at printf, we can test 
259 #
260 gdb_test_multiple "break printf" "break printf" {
261     -re  "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex.*\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
262         pass $gdb_test_name
263     }
264     -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$" {
265         pass $gdb_test_name
266     }
267 }
268
269 #
270 # get to printf
271 #
272 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${breakpoints_invalid}\r\n\032\032frames-invalid\r\n"
273 set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n"
274 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$"
275
276 gdb_test_multiple "continue" "continue to printf" {
277     -re "${pat_begin}($pat_adjust)?$pat_end" {
278         pass $gdb_test_name
279     }
280     -re ".*$gdb_prompt$"     { fail $gdb_test_name }
281 }
282
283 #
284 # test:
285 # annotate-frame-where
286 # annotate-frame-address
287 # annotate-frame-address-end
288 #
289 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"
290
291 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$"
292
293 gdb_test_multiple "backtrace" "backtrace from shlibrary" {
294     -re "$pat_begin$escapedsrcfile$pat_end" {
295         pass $gdb_test_name
296     }
297     -re "$pat_begin.*$srcfile$pat_end" {
298         setup_xfail "*-*-*" 8375
299         fail $gdb_test_name
300     }
301 }
302
303
304 #
305 # test printing a frame with some arguments: 
306 # annotate-arg-begin
307 # annotate-arg-name-end
308 # annotate-arg-value
309 # annotate-arg-end
310 #
311
312 if [target_info exists gdb,nosignals] {
313     unsupported "send SIGUSR1"
314     unsupported "backtrace @ signal handler"
315 } else {
316     gdb_test_multiple "signal SIGUSR1" "send SIGUSR1" {
317         -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\032breakpoints-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$" {
318             pass $gdb_test_name
319         }
320         -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\032breakpoints-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$" {
321             setup_xfail "*-*-*" 8375
322             fail $gdb_test_name
323         }
324     }
325
326     #
327     # test:
328     # annotate-signal-handler-caller
329     #
330     gdb_test_multiple "backtrace" "backtrace @ signal handler" {
331         -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$" {
332             pass $gdb_test_name
333         }
334     }
335 }
336
337 #
338 # delete all the breakpoints
339 #
340 gdb_test_multiple "delete 1" "delete bp 1" {
341     -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
342         pass $gdb_test_name
343     }
344 }
345
346 gdb_test_multiple "delete 2" "delete bp 2" {
347     -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
348         pass $gdb_test_name
349     }
350 }
351
352 gdb_test_multiple "delete 3" "delete bp 3" {
353     -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
354         pass $gdb_test_name
355     }
356 }
357
358 #
359 # break in main, after value is initialized. This is in preparation
360 # to test the annotate output for the display command.
361 #
362 gdb_test_multiple "break ${srcfile}:${main_line}" "break in main" {
363     -re "post-prompt.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
364         pass $gdb_test_name
365     }
366     -re "post-prompt.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
367         setup_xfail "*-*-*" 8375
368         fail $gdb_test_name
369     }
370 }
371
372 #
373 # display the value; test:
374 # annotate-display-begin
375 # annotate-display-number-end
376 # annotate-display-format
377 # annotate-display-expression
378 # annotate-display-expression-end
379 # annotate-display-end
380 # FIXME: annotate-display-value not tested
381 #
382 gdb_test_multiple "display value" "set up display" {
383     -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$" {
384         pass "set up display"
385     }
386 }
387
388 # Get the core into the output directory.
389 if {![is_remote host]} {
390     gdb_test -prompt "$gdb_prompt$" \
391         "set cwd [file dirname $binfile]" "" \
392         "set inferior cwd to test directory"
393 }
394
395 # should ask query. Test annotate-query.
396 # we don't care about anything else here, only the query.
397
398 send_gdb "run\n"
399 gdb_expect {
400   -re "pre-query.*already.*\\(y or n\\).*query\r\n" {
401          send_gdb "y\n"
402          gdb_expect {
403              -re ".*post-query.*$gdb_prompt$" \
404                      { pass "re-run" }
405              -re ".*$gdb_prompt$"  { fail "re-run" }
406              timeout { fail "re-run (timeout)" }
407          }
408      }
409   -re ".*$gdb_prompt$"  { fail "re-run" }
410   timeout { fail "re-run (timeout)" }
411 }
412
413 #
414 # Test that breakpoints-invalid is issued once and only once for
415 # breakpoint ignore count changes, after annotation stopped.
416 #
417
418 set value_inc_line [gdb_get_line_number "increment value"]
419
420 gdb_test_multiple "break $value_inc_line" "break at value++" {
421     -re "Breakpoint 5 at $hex: file .*$srcfile, line $value_inc_line.*$gdb_prompt$" {
422         pass "break at value++"
423     }
424 }
425
426 gdb_test_multiple "ignore 5 4" "ignore 5 4" {
427     -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" {
428         pass "ignore 5 4"
429     }
430 }
431
432 gdb_test_multiple "continue" "annotate ignore count change" {
433     -re ".*breakpoints-invalid.*breakpoints-invalid.*$gdb_prompt$" {
434         fail "annotate ignore count change"
435     }
436     -re ".*$srcfile:$value_inc_line:.*\032\032stopped\r\n$gdb_prompt$" {
437         pass "annotate ignore count change"
438     }
439 }
440
441 # check that ignore command is working, or the above can provide
442 # misleading assurance ...
443
444 gdb_test_multiple "next" "next to exit loop" {
445     -re "source .*annota1.c.*$gdb_prompt$" {
446     }
447 }
448
449 set after_loop_line [gdb_get_line_number "after loop"]
450
451 gdb_test_multiple "next" "breakpoint ignore count" {
452     -re ".*$srcfile:$after_loop_line:.*$gdb_prompt$" {
453         pass "breakpoint ignore count"
454     }
455 }
456
457 # Get the inferior's PID for later.
458
459 set pid -1
460 gdb_test_multiple "info inferior 1" "get inferior pid" {
461     -re "process (\[0-9\]*).*$gdb_prompt$" {
462         set pid $expect_out(1,string)
463         pass $gdb_test_name
464     }
465 }
466
467 #
468 # Send a signal that is not handled; test:
469 # annotate-signalled
470 # annotate-signal-name
471 # annotate-signal-name-end
472 # annotate-signal-string
473 # annotate-signal-string-end
474 # FIXME: annotate-signal not tested (requires that the inferior be 
475 #                        stopped by a "random" signal)
476
477 if [target_info exists gdb,nosignals] {
478     unsupported "signal sent"
479 } else {
480     gdb_test_multiple "signal SIGTRAP" "signal sent" {
481         -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\032thread-exited,id=\"${decimal}\",group-id=\"i${decimal}\"\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
482             pass $gdb_test_name
483         }
484     }
485 }
486
487 # Check for production of a core file and remove it!
488 remove_core $pid
489
490 proc thread_test {} {
491     global subdir srcdir testfile srcfile binfile
492     global gdb_prompt old_gdb_prompt
493     global decimal
494     set srcfile watch_thread_num.c
495     set binfile [standard_output_file ${testfile}-watch_thread_num]
496     set gdb_prompt $old_gdb_prompt
497
498     if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
499
500         gdb_exit
501         gdb_start
502         gdb_reinitialize_dir $srcdir/$subdir
503         gdb_load ${binfile}
504         if {![runto_main]} {
505             return
506         }
507
508         set linenum [gdb_get_line_number "all threads started"]
509         gdb_breakpoint "$linenum"
510
511         set linenum [gdb_get_line_number "first child thread exited"]
512         gdb_breakpoint "$linenum"
513
514         set gdb_prompt \
515             "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
516
517         gdb_test_multiple "set annotate 2" "" {
518             -re "set annotate 2\r\n$gdb_prompt$" {
519             }
520         }
521
522         gdb_test_multiple "continue" "new thread" {
523             -re "\032\032new-thread.*\r\n$gdb_prompt$" {
524                 pass $gdb_test_name
525             }
526         }
527
528     gdb_test_multiple "continue" "thread exit" {
529             -re "\032\032thread-exited,id=\"${decimal}\",group-id=\"i${decimal}\".*\r\n$gdb_prompt$" {
530                 pass $gdb_test_name
531             }
532     }
533     }
534 }
535
536 proc thread_switch {} {
537     gdb_test_multiple "thread 1" "thread switch" {
538         -re ".*\032\032thread-changed" {
539             pass $gdb_test_name
540         }
541     }
542 }
543
544 thread_test
545 thread_switch
546
547 # restore the original prompt for the rest of the testsuite
548
549 set gdb_prompt $old_gdb_prompt