1 # manythreads.exp
-- Expect script to test stopping many threads
2 # Copyright
(C
) 2004 Free Software Foundation
, Inc.
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.
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.
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.
18 # Please email
any bugs
, comments
, and
/or additions to this file to
:
19 # bug
-gdb@prep.ai.mit.edu
21 # This file was written by Jeff Johnston.
(jjohnstn@redhat.com
)
30 set testfile
"manythreads"
31 set srcfile $
{testfile
}.c
32 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
34 if {[gdb_compile_pthreads
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
39 gdb_reinitialize_dir $srcdir
/$subdir
41 gdb_test
"set print sevenbit-strings" ""
44 # We
'll need this when we send_gdb a ^C to GDB. Need to do it before we
45 # run the program and gdb starts saving and restoring tty states.
46 # On Ultrix, we don't need it and it is really slow
(because shell_escape
48 if ![istarget "*-*-ultrix*"] then {
49 gdb_test "shell stty intr '^C
'" ""
52 set message "first continue"
53 gdb_test_multiple "continue" "first continue" {
54 -re "error:.*$gdb_prompt $" {
62 # Send a Ctrl-C and verify that we can do info threads and continue
65 set message "stop threads 1"
66 gdb_test_multiple "" "stop threads 1" {
67 -re "\\\[New \[^\]\]*\\\]\r\n" {
70 -re "\\\[\[^\]\]* exited\\\]\r\n" {
73 -re "Thread \[^\n\]* executing\r\n" {
76 -re "Program received signal SIGINT.*$gdb_prompt $" {
80 fail "$message (timeout)"
84 gdb_test "info threads" ".*1 Thread.*.LWP.*"
86 set message "second continue"
87 gdb_test_multiple "continue" "second continue" {
88 -re "error:.*$gdb_prompt $" {
96 # Send another Ctrl-C and verify that we can do info threads and quit
99 set message "stop threads 2"
100 gdb_test_multiple "" "stop threads 2" {
101 -re "\\\[New \[^\]\]*\\\]\r\n" {
104 -re "\\\[\[^\]\]* exited\\\]\r\n" {
107 -re "Thread \[^\n\]* executing\r\n" {
110 -re "Program received signal SIGINT.*$gdb_prompt $" {
111 pass "stop threads 2"
115 gdb_test_multiple "quit" "GDB exits after stopping multithreaded program" {
116 -re "The program is running. Exit anyway\\? \\(y or n\\) $" {
121 pass "GDB exits after stopping multithreaded program"
124 fail "GDB exits after stopping multithreaded program (timeout)"