import gdb-1999-08-16 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.hp / quicksort.exp
CommitLineData
c906108c
SS
1# quicksort.exp -- Expect script to test gdb with quicksort.c
2# Copyright (C) 1992 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# use this to debug:
22#
23#log_user 1
24
25if $tracelevel then {
26 strace $tracelevel
27}
28
29if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } {
30 verbose "HPUX thread test ignored for non-hppa or pre-HP/UX-10.30 targets."
31 return 0
32}
33
34set testfile quicksort
35set srcfile ${srcdir}/${subdir}/${testfile}.c
36set binfile ${objdir}/${subdir}/${testfile}
37
38if [get_compiler_info ${binfile}] {
39 return -1
40}
41
42# To build the executable we need to link against the thread library.
43#
44# cc -Ae -g -o quicksort -lpthread quicksort.c
45#
46#compile "${srcfile} -Ae -g -lpthread -o ${binfile}"
47
48if {$gcc_compiled == 0} {
49 set additional_flags "additional_flags=-Ae"
50} else {
51 set additional_flags ""
52}
53
54if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}.o" object [list debug $additional_flags]] != "" } {
55 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
56}
57remote_exec build "ld /usr/ccs/lib/crt0.o ${binfile}.o -lcl -lpthread -lc /opt/langtools/lib/end.o -o ${binfile}"
58
59
60# Thread stuff is _slow_; prepare for long waits.
61#
62set oldtimeout $timeout
63set timeout [expr "$timeout + 300"]
64set oldverbose $verbose
65#set verbose 40
66
67# Further, this test has some "null" lines designed
68# to consume output from gdb that was too late to be
69# matched (sequence is "gdb_test" sends; timeout and
70# on to next send; result finally comes in; mismatch).
71#
72# The null command is 'gdb_test "p \$pc" ".*" ""'
73#
74# NOTE: to pass a literal "$", "/" or "*" (etc.) to gdb_test,
75# remember that the pattern will be escaped once and
76# $-evaluated twice:
77#
78# "\\\*" matches "\*"
79# "\$" matches "$"
80#
81proc fix_timeout {} {
82 gdb_test "p \$pc" ".*" ""
83}
84
85#=========================
86#
87# Simple sanity test first.
88#
89gdb_exit
90gdb_start
91gdb_reinitialize_dir $srcdir/$subdir
92gdb_load ${binfile}
93
94gdb_test "tb 122" ".*Breakpoint.*" ""
95gdb_test "r" ".*122.*" ""
96gdb_test "thr 99" ".*Thread ID 99 not known.*" "Check too-big thread number"
97gdb_test "tb 145 thr 3" ".*Breakpoint.*" "set thread-specific bp 145"
98gdb_test "tb 146 thr 4" ".*Breakpoint.*" "set thread-specific bp 146"
99gdb_test "c" ".*Switched to thread.*145.*" "auto switch"
100gdb_test "c" ".*Switched to thread.*146.*" "auto switch 2"
101gdb_test "c" ".*Program exited normally.*" ""
102
103#=========================
104#
105# Test that you can't do a thread select after a program runs.
106#
107gdb_test "thread" ".*No stack.*" "No live thread after run"
108gdb_test "thr 2" ".*No stack.*" "Can't set thread after run"
109
110#=========================
111#
112# Test thread command changes, look for frame level reset bug.
113#
114gdb_exit
115gdb_start
116gdb_reinitialize_dir $srcdir/$subdir
117gdb_load ${binfile}
118gdb_test "b 122" ".*" ""
119gdb_test "r" ".*122.*" ""
120
121# Prep for frame level test--go up/info thread/check frame
122#
123gdb_test "up" ".*quick_sort.*" ""
124gdb_test "up" ".*main.*" ""
125
126send_gdb "i th\n"
127gdb_expect {
128 -re ".*7 thread.* in .* from .* in .* from .* 6 thread.*$gdb_prompt $" {
129 fail "old thread command, says things twice"
130 }
131 -re ".*7 system thread.*6 system th.*5 sys.*4.*3.*2.*1.*work_init.*$gdb_prompt $" {
132 pass "info threads"
133 }
134 -re ".*$gdb_prompt $" { fail "no info thread command" }
135 timeout { fail "timeout" }
136}
137
138# We should have been restored two frames up--check.
139#
140send_gdb "up\n"
141gdb_expect {
142 -re ".*Initial frame selected.*$gdb_prompt $" {
143 pass "Frame correctly reset after 'info threads'"
144 }
145 -re ".*quick_sort.*$gdb_prompt $" {
146 fail "Old gdb bug; should be fixed someday"
147 }
148 -re ".*$gdb_prompt $" {
149 fail "real bug--FIX!"
150 }
151 timeout { fail "timeout" }
152}
153
154# Do it again, only just go to a middle frame, and use another thread.
155#
156gdb_test "thr 5" ".*" ""
157gdb_test "bt" ".* ___ksleep.*_lwp_cond_timedwait.*pthread_cond_wait.*worker.*__pthread_create_system.*" ""
158gdb_test "up" ".*1.*_lwp_cond_timedwait.*" ""
159gdb_test "up" ".*2.*pthread_cond_wait.*" ""
160gdb_test "up" ".*3.*worker.*" ""
161gdb_test "i th" ".*7.*6.*work_init.*" ""
162gdb_test "f" ".*3.*worker.*" "Frame restored"
163gdb_test "p wp->max_pile" ".*= 128.*" "can see vars in frame"
164
165# Thread command changes
166#
167gdb_test "thr" ".*Current thread is 5.*" "threads-no-num"
168gdb_test "thr 6" ".*Switching to thread 6.*" "new switch"
169gdb_test "thr" ".*Current thread is 6.*" "check switch"
170#gdb_test "thr 6" ".*Current thread is already 6.*" "dup, no switch"
171gdb_test "thr app all p x" ".*No symbol.*" ""
172gdb_test "thr" ".*Current thread is 6.*" "restore current thread"
173
174#=========================
175#
176# Test new stepping
177#
178
179proc get_hit { } {
180 global hit2
181 global hit3
182 global hit4
183 global hit5
184 global hit6
185 global hit7
186 global gdb_prompt
187
188 send_gdb "cont\n"
189 gdb_expect {
190 -re ".*Breakpoint.*145.*$gdb_prompt $" {
191 send_gdb "thr\n"
192 gdb_expect {
193 -re ".*is 7.*$gdb_prompt $" {
194 set hit7 [expr "$hit7 + 1"]
195 }
196 -re ".*is 6.*$gdb_prompt $" {
197 set hit6 [expr "$hit6 + 1"]
198 }
199 -re ".*is 5.*$gdb_prompt $" {
200 set hit5 [expr "$hit5 + 1"]
201 }
202 -re ".*is 4.*$gdb_prompt $" {
203 set hit4 [expr "$hit4 + 1"]
204 }
205 -re ".*is 3.*$gdb_prompt $" {
206 set hit3 [expr "$hit3 + 1"]
207 }
208 -re ".*is 2.*$gdb_prompt $" {
209 set hit2 [expr "$hit2 + 1"]
210 }
211 -re ".*$gdb_prompt $" {
212 fail "can't see which thread"
213 }
214 timeout { fail "timeout" }
215 }
216 }
217 -re ".*$gdb_prompt $" {
218 fail "thread command"
219 }
220 timeout { fail "timeout" }
221 }
222}
223
224gdb_exit
225gdb_start
226gdb_reinitialize_dir $srcdir/$subdir
227gdb_load ${binfile}
228gdb_test "break 122" ".*" ""
229gdb_test "run" ".*122.*" ""
230
231# Make sure we hit a bp on every thread.
232#
233# Try one, via thread-specific bps
234#
235gdb_test "break 145 thr 2" ".*" "set thread-specific bp thr 2"
236gdb_test "break 145 thr 3" ".*" "set thread-specific bp thr 3"
237gdb_test "break 145 thr 4" ".*" "set thread-specific bp thr 4"
238gdb_test "break 145 thr 5" ".*" "set thread-specific bp thr 5"
239gdb_test "break 145 thr 6" ".*" "set thread-specific bp thr 6"
240gdb_test "break 145 thr 7" ".*" "set thread-specific bp thr 7"
241
242set hit2 0
243set hit3 0
244set hit4 0
245set hit5 0
246set hit6 0
247set hit7 0
248
249get_hit
250get_hit
251get_hit
252get_hit
253get_hit
254get_hit
255
256if { [expr "$hit2 == 1"]
257 && [expr "$hit3 == 1"]
258 && [expr "$hit4 == 1"]
259 && [expr "$hit5 == 1"]
260 && [expr "$hit6 == 1"]
261 && [expr "$hit7 == 1"] } {
262 pass "thread-specific bps 1"
263} else {
264 fail "thread-specific bps 1"
265}
266
267#====================
268#
269# Now use generic bps
270#
271gdb_exit
272gdb_start
273gdb_reinitialize_dir $srcdir/$subdir
274gdb_load ${binfile}
275gdb_test "b 122" ".*" ""
276gdb_test "r" ".*122.*" ""
277
278# Make sure we hit a bp on every thread.
279#
280# Try two, via non-thread-specific bp
281#
282gdb_test "b 145" ".*" "b 145"
283
284set hit2 0
285set hit3 0
286set hit4 0
287set hit5 0
288set hit6 0
289set hit7 0
290
291get_hit
292get_hit
293get_hit
294get_hit
295get_hit
296get_hit
297
298if { [expr "$hit2 == 1"]
299 && [expr "$hit3 == 1"]
300 && [expr "$hit4 == 1"]
301 && [expr "$hit5 == 1"]
302 && [expr "$hit6 == 1"]
303 && [expr "$hit7 == 1"] } {
304 pass "thread-specific bps 2"
305} else {
306 fail "thread-specific bps 2"
307}
308
309#====================
310#
311# Complicated (original) test next.
312#
313gdb_exit
314gdb_start
315gdb_reinitialize_dir $srcdir/$subdir
316gdb_load ${binfile}
317
318if ![runto_main] then {
319 fail "Can't run to main"
320 return 0
321}
322
323# OK, we're at "main", there should be one thread.
324#
325gdb_test "info thread" ".*\\\* 1 system thread .*main.*" "initial thread"
326
327# Try to see the threads being created: set a breakpoint
328# after the creation and go around the loop a few times.
329#
330gdb_test "break 109" "Breakpoint.*109.*" "set bpt"
331
332gdb_test "c" ".*New thread.*Breakpoint.*109.*" "first continue"
333fix_timeout
334
335# Make sure we don't wait (waiting is for attach test)
336#
337gdb_test "set wait_here = 0" ".*" ""
338
339send_gdb "info thr\n"
340gdb_expect {
341 -re ".*2 system th.*1 sy.*109.*$gdb_prompt $" { pass "saw thread create" }
342 -re ".*1 system thread.*87.*$gdb_prompt $" { fail "didn't see thread create" }
343 -re ".*$gdb_prompt $" { fail "no info thread command" }
344 timeout { fail "timeout" }
345}
346
347gdb_test "c" ".*New thread.*Breakpoint.*109.*" "continue"
348fix_timeout
349
350send_gdb "info thr\n"
351gdb_expect {
352 -re ".*3 system thread.*2 sys.*\\\* 1 system thread.*109.*$gdb_prompt $" {
353 pass "saw thread create" }
354 -re ".*2 system thread.*1 sys.*109.*$gdb_prompt $" {
355 fail "didn't see thread create"
356 }
357 -re ".*1 system thread.*109.*$gdb_prompt $" {
358 fail "didn't see thread create"
359 }
360 -re ".*$gdb_prompt $" {
361 fail "no info thread command"
362 }
363 timeout { fail "timeout" }
364}
365
366fix_timeout
367gdb_test "clear" ".*Deleted breakpoint.*" ""
368
369# Now go on to the end of thread creation.
370#
371gdb_test "b 122" ".*" "set bpt 122"
372gdb_test "c" ".*New thread.*New thread.*New thread.*122.*" ""
373gdb_test "p \$pc" ".*" ""
374gdb_test "clear" ".*Deleted breakpoint.*" ""
375
376send_gdb "info thr\n"
377gdb_expect {
378 -re ".*7 system thread.*6 sys.*5.*1 system thread.*122.*$gdb_prompt $"
379 { pass "saw thread creates" }
380 -re ".*$gdb_prompt $"
381 { fail "no info thread command" }
382 timeout { fail "timeout" }
383}
384
385# Try a thread-specific breakpoint; we expect the other threads to
386# be waiting at this point.
387#
388gdb_test "thr 3" ".*Switching to thread.*ksleep.*" "thread switch"
389gdb_test "i th" ".*\\\* 3 system thread.*" "show new current thread"
390
391gdb_test "up" ".*lwp_cond_timedwait.*" ""
392gdb_test "up" ".*pthread_cond_wait.*" ""
393gdb_test "up" ".*worker.*144.*" ""
394
395gdb_test "b 145 th 3" ".*Breakpoint.*145.*" "set thread-specific bp"
396gdb_test "i b" ".*breakpoint.*breakpoint.*145 thread 3.*" "show thread-specific bp"
397
398gdb_test "c" ".*Breakpoint.*145.*145.*" "hit thread-specific bp"
399gdb_test "p \$pc" ".*" ""
400
401# Test thread apply command on thread specific data.
402#
403gdb_test "thre app all p \$pc" ".*Thread 7.*Thread 6.*Thread 5.*Thread 4.*Thread 3.*Thread 2.*Thread 1.*" "thread apply all"
404gdb_test "thr ap 1 3 5 p \$pc" ".*Thread 1.*Thread 3.*Thread 5.*" "thr app 1 3 5"
405
406# Switch again, and test that others continue on a "next"
407# This test _could_ fail due to timing issues, but that's
408# unlikely.
409#
410gdb_test "thr 7" ".*Switching to thread.*" ""
411
412# Make sure that "up" stops at __pthread_exit, or
413# __pthread_create, the pseudo-roots, and that we
414# only see that pseudo-root once.
415#
416send_gdb "bt\n"
417gdb_expect {
418 -re ".*Error accessing memory address.*" { fail "bt" }
419 -re ".*pthread_create.*pthread_create.*" { fail "bt" }
420 -re ".*worker.*pthread_create.*" { pass "bt" }
421 -re ".*pthread_exit.*" { pass "bt" }
422 timeout { fail "timeout on bt" }
423}
424
425gdb_test "up" ".*" ""
426gdb_test "up" ".*" ""
427gdb_test "up" ".*144.*" "Up 3"
428gdb_test "up" ".*pthread_.*" "Up 4"
429gdb_test "up" ".*Initial frame selected; you cannot go up.*" "catch end of thread stack"
430
431#=====================
432#
433# Things get iffy here; when we step, sometimes the step
434# completes, sometimes it doesn't. When it doesn't, we
435# hit a bp somewhere else and the step never completes
436# (wait_for_inferior just evaporates it).
437#
438# I think the right answer is that any failures here
439# should stick around to trigger later fixing.
440#
441# Here's the plan:
442#
443# Bps at 148 (5) and 154 (6) on thread 7 (two bps so we
444# see the difference between going around the loop and
445# reporting the same bp hit twice).
446#
447# Bp at 144 on thread 3.
448#
449# Step out of a library routine.
450#
451# Either the step will finish or a bp will hit. Try to
452# handle all the cases.
453#
454gdb_test "b 148 thr 7" ".*Breakpoint.*148.*" ""
455gdb_test "b 154 thr 7" ".*Breakpoint.*154.*" "set bpt 2"
456
457set hit_154_bp 0
458set hit_148_bp 0
459set hit_145_bp 0
460set step_completed 0
461
462# Expect zero hits
463#
464gdb_test "i b" ".*" ""
465
466send_gdb "n\n"
467gdb_expect {
468 -re ".*Single stepping.*_lwp_cond_timedwait.*$gdb_prompt $" {
469 send_gdb "thr\n"
470 gdb_expect {
471 -re ".*is 7.*$gdb_prompt $" {
472 set step_completed 1
473 pass "completed step in library code"
474 }
475 -re ".*$gdb_prompt $" {
476 fail "completed step in library code, but in wrong thread"
477 }
478 timeout { fail "timeout" }
479 }
480 }
481 -re ".*Single stepping.*Switched to thread 3.*Breakpoint.*$gdb_prompt $" {
482 pass "step cancelled; hit bp due to thread parallelism"
483 set hit_145_bp 1
484 }
485 -re ".*Single stepping.*Switched to thread 7.*Breakpoint.*148.*$gdb_prompt $" {
486 pass "step cancelled; hit bp due to thread parallelism"
487 set hit_148_bp 1
488 }
489 -re ".*Single stepping.*Switched to thread 7.*Breakpoint.*154.*$gdb_prompt $" {
490 pass "step cancelled; hit bp due to thread parallelism"
491 set hit_154_bp 1
492 }
493 -re ".*$gdb_prompt $" {
494 send_gdb "thr\n"
495 gdb_expect {
496 -re ".*is 7.*$gdb_prompt $" {
497 fail "No event?"
498 }
499 -re ".*$gdb_prompt $" {
500 fail "No event"
501 }
502 timeout { fail "timeout" }
503 }
504 }
505 timeout { fail "timeout" }
506}
507
508# Sometimes used to get SIGTRAP here; that should be fixed
509#
510
511# Expect appropriate hits of bpt; too much work to parse
512# result and check...
513#
514gdb_test "i b" ".*" ""
515
516send_gdb "c\n"
517gdb_expect {
518 -re ".*SIGTRAP.*$gdb_prompt $" {
519 fail "got SIGTRAP"
520 }
521 -re ".*Switched to thread 7.*Breakpoint.*154.*$gdb_prompt $" {
522 if { $hit_154_bp == 1 } {
523 fail "re-hit old bp"
524 } else {
525 pass "continue; hit parallel event after continue"
526 }
527 set hit_154_bp 1
528 }
529 -re ".*Switched to thread 7.*Breakpoint.*148.*$gdb_prompt $" {
530 if { $hit_148_bp == 1 } {
531 fail "re-hit old bp"
532 } else {
533 pass "continue; hit parallel event after continue"
534 }
535 set hit_148_bp 1
536 }
537 -re ".*Breakpoint.*154.*$gdb_prompt $" {
538 if { $hit_154_bp == 1 } {
539 fail "re-hit old bp"
540 } else {
541 send_gdb "thr\n"
542 gdb_expect {
543 -re ".*is 7.*$gdb_prompt $" {
544 pass "continue; hit parallel event after continue"
545 }
546 -re ".*$gdb_prompt $" {
547 fail "hit bp in wrong thread"
548 }
549 timeout { fail "timeout" }
550 }
551 }
552 set hit_154_bp 1
553 }
554 -re ".*Breakpoint.*148.*$gdb_prompt $" {
555 if { $hit_148_bp == 1 } {
556 fail "re-hit old bp"
557 } else {
558 send_gdb "thr\n"
559 gdb_expect {
560 -re ".*is 7.*$gdb_prompt $" {
561 pass "continue; hit parallel event after continue"
562 }
563 -re ".*$gdb_prompt $" {
564 fail "hit bp in wrong thread"
565 }
566 timeout { fail "timeout" }
567 }
568 }
569 set hit_148_bp 1
570 }
571 -re ".*Breakpoint.*145.*$gdb_prompt $" {
572 if { $hit_145_bp == 1 } {
573 fail "re-hit old bp"
574 } else {
575 send_gdb "thr\n"
576 gdb_expect {
577 -re ".*is 3.*$gdb_prompt $" {
578 pass "continue; hit parallel event after continue"
579 }
580 -re ".*$gdb_prompt $" {
581 fail "hit bp in wrong thread"
582 }
583 timeout { fail "timeout" }
584 }
585 }
586 set hit_145_bp 1
587 }
588 -re ".*_lwp_cond_timedwait.*$gdb_prompt $" {
589 pass "continue; hit step completion after continue"
590 }
591 -re ".*Program exited normally.*" {
592 fail "Program ended? HOW?"
593 }
594 -re ".*$gdb_prompt $" {
595 fail "Unexpected event"
596 }
597 timeout { fail "timeout" }
598}
599
600# There are a number of places we _could_ be now;
601# this is the price of really running in parallel.
602#
603send_gdb "n\n"
604gdb_expect {
605 -re ".*Switched to thread 7.*pthread_cond_wait.*$gdb_prompt $" {
606 if { $step_completed } {
607 fail "step already completed"
608 } else {
609 pass "finish step"
610 }
611 }
612 -re ".*pthread_cond_wait.*$gdb_prompt $" {
613 #
614 # Unlikely, but we might finish the range step from inside
615 # ksleep, before anything else.
616 #
617 if { $step_completed } {
618 fail "step already completed"
619 } else {
620 send_gdb "thr\n"
621 gdb_expect {
622 -re ".*is 7.*$gdb_prompt $" {
623 pass "finish step"
624 }
625 -re ".*$gdb_prompt $" {
626 fail "step in wrong thread"
627 }
628 timeout { fail "timeout" }
629 }
630 }
631 }
632 -re ".*Switched to thread.*Breakpoint.*145.*$gdb_prompt $" {
633 pass "auto-switch thread"
634 }
635 -re ".*Breakpoint.*145.*$gdb_prompt $" {
636 pass "auto-switch not needed, ok"
637 }
638 -re ".*140.*while.*n_pile.*$gdb_prompt $" {
639 #
640 # This is just going around the loop from the 154 bp.
641 #
642 send_gdb "thr\n"
643 gdb_expect {
644 -re ".*is 7.*$gdb_prompt $" {
645 pass "finish step"
646 }
647 -re ".*$gdb_prompt $" {
648 fail "step in wrong thread"
649 }
650 timeout { fail "timeout" }
651 }
652 }
653 -re ".*149.*ptr = wp.*pile.*$gdb_prompt $" {
654 #
655 # This is just going around the loop from the 148 bp.
656 #
657 if { $hit_154_bp } {
658 send_gdb "thr\n"
659 gdb_expect {
660 -re ".*is 7.*$gdb_prompt $" {
661 pass "finish step"
662 }
663 -re ".*$gdb_prompt $" {
664 fail "step in wrong thread"
665 }
666 timeout { fail "timeout" }
667 }
668 } else {
669 pass "step from 149 but didn't hit it first"
670 }
671 }
672 -re ".*Breakpoint 5.*154.*$gdb_prompt $" {
673 gdb_test "i b" ".*" ""
674 if { $hit_154_bp } {
675 fail "hit bp again?"
676 } else {
677 pass "hit bp"
678 }
679 }
680 -re ".*Breakpoint 5.*148.*$gdb_prompt $" {
681 gdb_test "i b" ".*" ""
682 if { $hit_148_bp } {
683 fail "hit bp again?"
684 } else {
685 pass "hit bp"
686 }
687 }
688 -re ".*$gdb_prompt $" {
689 fail "no step finished"
690 }
691 timeout { fail "timeout on 'next'" }
692}
693
694# Let's get into some kind of known state again.
695#
696gdb_test "thr 7" ".*" ""
697gdb_test "info thread" ".*" ""
698#gdb_test "i b" ".*" ""
699
700# Leave breakpoint "154 thr 7" as only live bp.
701#
702gdb_test "d 1" ".*" "del main bp"
703gdb_test "d 4" ".*" "thread-specific bpt delete"
704gdb_test "d 5" ".*" "other bp delete"
705send_gdb "i b\n"
706gdb_expect {
707 -re ".*breakpoint.*breakpoint.*$gdb_prompt $" {
708 fail "more than one bp left"
709 }
710 -re ".*breakpoint.*154.*thread.*7.*$gdb_prompt $" {
711 pass "Only one bp left"
712 }
713 -re ".*$gdb_prompt $" {
714 fail "Wrong or no bp left"
715 }
716 timeout { fail "timeout on info b" }
717}
718
719send_gdb "c\n"
720gdb_expect {
721 -re ".*SIGTRAP.*Switched to thread.*$gdb_prompt $" {
722 fail "SIGTRAP error; lost thread-specific bpt"
723 }
724 -re ".*SIGTRAP.*Switched to thread.*154.*$gdb_prompt $" {
725 fail "SIGTRAP, but hit right thread-specific bpt"
726 }
727 -re ".*Switched to thread.*Breakpoint.*154.*$gdb_prompt $" {
728 pass "auto-switch back"
729 }
730 -re ".*Breakpoint.*154.*$gdb_prompt $" {
731 pass "step to bp"
732 }
733 -re ".*$gdb_prompt $" {
734 fail "auto-switch back"
735 }
736 -re ".*Program exited normally.*$gdb_prompt $" {
737 fail "step lost"
738 }
739 timeout {
740 fail "timeout"
741 }
742}
743fix_timeout
744
745gdb_test "cle" ".*Deleted breakpoint.*" "delete last breakpoint"
746
747# Sometimes get SIGTRAP here. Continue sometimes gets another...
748#
749send_gdb "c\n"
750gdb_expect {
751 -re ".*SIGTRAP.*154.*154.*$gdb_prompt $" {
752 fail "SIGTRAP on deleted bp 154 "
753 send_gdb "c\n"
754 gdb_expect {
755 -re ".*$gdb_prompt $" { pass "fixup"}
756 timeout { fail "fixup" }
757 }
758 }
759 -re ".*SIGTRAP.*144.*145.*$gdb_prompt $" {
760 fail "SIGTRAP on deleted bp 145 "
761 send_gdb "c\n"
762 gdb_expect {
763 -re ".*$gdb_prompt $" { pass "fixup"}
764 timeout { fail "fixup" }
765 }
766 }
767 -re ".*SIGTRAP.*148.*148.*$gdb_prompt $" {
768 fail "SIGTRAP on deleted bp 148 "
769 send_gdb "c\n"
770 gdb_expect {
771 -re ".*$gdb_prompt $" { pass "fixup"}
772 timeout { fail "fixup" }
773 }
774 }
775 -re ".*SIGTRAP.*$gdb_prompt $" {
776 fail "unknown SIGTRAP"
777 send_gdb "c\n"
778 gdb_expect {
779 -re ".*$gdb_prompt $" { pass "fixup"}
780 timeout { fail "fixup" }
781 }
782 }
783 -re ".*Program exited.*$gdb_prompt $" {
784 pass "run to end"
785 }
786 -re ".*$gdb_prompt $" {
787 fail "run to end"
788 send_gdb "c\n"
789 gdb_expect {
790 -re ".*$gdb_prompt $" { pass "fixup"}
791 timeout { fail "fixup" }
792 }
793 }
794 timeout { fail "timeout" }
795}
796
797gdb_test "p \$pc" ".*No registers.*" "program done"
798
799# Done!
800#
801gdb_exit
802
803set timeout $oldtimeout
804set verbose $oldverbose
805
806# execute_anywhere "rm -f ${binfile}"
807#
808return 0
809
This page took 0.064478 seconds and 4 git commands to generate.