]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.threads/staticthreads.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / staticthreads.exp
CommitLineData
c72b934c
AC
1# static.exp -- test script, for GDB, the GNU debugger.
2
6aba47ca 3# Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
c72b934c
AC
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19# Based on manythreads written by Jeff Johnston, contributed by Red
20# Hat.
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
26set prms_id 0
27set bug_id 0
28
29set testfile "staticthreads"
30set srcfile ${testfile}.c
31set binfile ${objdir}/${subdir}/${testfile}
32set static_flag "-static"
33
34if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
35 executable \
36 [list debug "incdir=${objdir}" "additional_flags=${static_flag}" \
37 ]] != "" } {
38 return -1
39}
40
41gdb_start
42gdb_reinitialize_dir $srcdir/$subdir
43gdb_load ${binfile}
44gdb_test "set print sevenbit-strings" ""
45
46
47# See if the static multi-threaded program runs.
48
49runto_main
50gdb_test "break sem_post"
51set test "Continue to main's call of sem_post"
52gdb_test_multiple "continue" "$test" {
53 -re " sem_post .*$gdb_prompt " {
54 pass "$test"
55 }
56 -re "Program received signal .*$gdb_prompt " {
57 kfail gdb/1328 "$test"
58 }
59}
60
61
62# See if handle SIG32 helps (a little) with a static multi-threaded
63# program.
64
1690f9cf
DJ
65set sig "SIG32"
66
67# SIGRTMIN is 37 on hppa-linux and hpux
68if [istarget hppa*-*-*] {
69 set sig "SIG37"
70}
71
c72b934c 72rerun_to_main
1690f9cf
DJ
73gdb_test "handle $sig nostop noprint pass"
74set test "Handle $sig helps"
75gdb_test "continue" " .*sem_post .*" "handle $sig helps"
c72b934c
AC
76
77
78# See if info threads produces anything approaching a thread list.
79
80set test "info threads"
81gdb_test_multiple "info threads" "$test" {
82 -re " Thread .*$gdb_prompt " {
83 pass "$test"
84 }
85 -re "$gdb_prompt " {
86 kfail gdb/1328 "$test"
87 }
88}
89
90
91# Check that the program can be quit.
92
93set test "GDB exits with static thread program"
94gdb_test_multiple "quit" "$test" {
95 -re "The program is running. Exit anyway\\? \\(y or n\\) $" {
96 send_gdb "y\n"
97 exp_continue
98 }
99 eof {
100 pass "$test"
101 }
102}