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