1 # manythreads.exp -- Expect script to test stopping many threads
2 # Copyright (C) 2004, 2006, 2007 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 set cmd "info threads"
86 gdb_test_multiple $cmd $cmd {
92 # Eat this line and continue, to prevent the buffer overflowing.
104 set message "second continue"
105 gdb_test_multiple "continue" "second continue" {
106 -re "error:.*$gdb_prompt $" {
114 # Send another Ctrl-C and verify that we can do info threads and quit
117 set message "stop threads 2"
118 gdb_test_multiple "" "stop threads 2" {
119 -re "\\\[New \[^\]\]*\\\]\r\n" {
122 -re "\\\[\[^\]\]* exited\\\]\r\n" {
125 -re "Thread \[^\n\]* executing\r\n" {
128 -re "Program received signal SIGINT.*$gdb_prompt $" {
132 fail "$message (timeout)"
136 gdb_test_multiple "quit" "GDB exits after stopping multithreaded program" {
137 -re "The program is running. Exit anyway\\? \\(y or n\\) $" {
142 pass "GDB exits after stopping multithreaded program"
145 fail "GDB exits after stopping multithreaded program (timeout)"