1 # manythreads.exp -- Expect script to test stopping many threads
2 # Copyright (C) 2004, 2006, 2007, 2008 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 3 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, see <http://www.gnu.org/licenses/>.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Jeff Johnston. (jjohnstn@redhat.com)
29 set testfile "manythreads"
30 set srcfile ${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
33 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
38 gdb_reinitialize_dir $srcdir/$subdir
40 gdb_test "set print sevenbit-strings" ""
43 # We'll need this when we send_gdb a ^C to GDB. Need to do it before we
44 # run the program and gdb starts saving and restoring tty states.
45 # On Ultrix, we don't need it and it is really slow (because shell_escape
47 if ![istarget "*-*-ultrix*"] then {
48 gdb_test "shell stty intr '^C'" ""
51 set message "first continue"
52 gdb_test_multiple "continue" "first continue" {
53 -re "error:.*$gdb_prompt $" {
61 # Send a Ctrl-C and verify that we can do info threads and continue
64 set message "stop threads 1"
65 gdb_test_multiple "" "stop threads 1" {
66 -re "\\\[New \[^\]\]*\\\]\r\n" {
69 -re "\\\[\[^\]\]* exited\\\]\r\n" {
72 -re "Thread \[^\n\]* executing\r\n" {
75 -re "Program received signal SIGINT.*$gdb_prompt $" {
79 fail "$message (timeout)"
83 set cmd "info threads"
85 gdb_test_multiple $cmd $cmd {
91 # Eat this line and continue, to prevent the buffer overflowing.
103 set message "second continue"
104 gdb_test_multiple "continue" "second continue" {
105 -re "error:.*$gdb_prompt $" {
113 # Send another Ctrl-C and verify that we can do info threads and quit
116 set message "stop threads 2"
117 gdb_test_multiple "" "stop threads 2" {
118 -re "\\\[New \[^\]\]*\\\]\r\n" {
121 -re "\\\[\[^\]\]* exited\\\]\r\n" {
124 -re "Thread \[^\n\]* executing\r\n" {
127 -re "Program received signal SIGINT.*$gdb_prompt $" {
131 fail "$message (timeout)"
135 gdb_test_multiple "quit" "GDB exits after stopping multithreaded program" {
136 -re "The program is running. Exit anyway\\? \\(y or n\\) $" {
141 pass "GDB exits after stopping multithreaded program"
144 fail "GDB exits after stopping multithreaded program (timeout)"