OSDN Git Service

Copyright year update in most files of the GDB Project.
[pf3gnuchains/pf3gnuchains4x.git] / gdb / testsuite / gdb.threads / staticthreads.exp
1 # static.exp -- test script, for GDB, the GNU debugger.
2
3 # Copyright 2004-2005, 2007-2012 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
17
18 # Based on manythreads written by Jeff Johnston, contributed by Red
19 # Hat.
20
21 if $tracelevel then {
22         strace $tracelevel
23 }
24
25
26 set testfile "staticthreads"
27 set srcfile ${testfile}.c
28 set binfile ${objdir}/${subdir}/${testfile}
29 set static_flag "-static"
30
31 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
32          executable \
33          [list debug "incdir=${objdir}" "additional_flags=${static_flag}" \
34              ]] != "" } {
35     return -1
36 }
37
38 gdb_start
39 gdb_reinitialize_dir $srcdir/$subdir
40 gdb_load ${binfile}
41 gdb_test_no_output "set print sevenbit-strings"
42
43
44 # See if the static multi-threaded program runs.
45
46 runto_main
47 gdb_test "break sem_post"
48 set test "Continue to main's call of sem_post"
49 gdb_test_multiple "continue" "$test" {
50     -re "Breakpoint .*, .*sem_post .*$gdb_prompt " {
51         pass "$test"
52     }
53     -re "Program received signal .*$gdb_prompt " {
54         kfail gdb/1328 "$test"
55     }
56 }
57     
58
59 # See if handle SIG32 helps (a little) with a static multi-threaded
60 # program.
61
62 set sig "SIG32"
63
64 # SIGRTMIN is 37 on hppa-linux and hpux
65 if [istarget hppa*-*-*] {
66   set sig "SIG37"
67 }
68
69 rerun_to_main
70 gdb_test "handle $sig nostop noprint pass"
71 set test "Handle $sig helps"
72 gdb_test "continue" " .*sem_post .*" "handle $sig helps"
73
74
75 # See if info threads produces anything approaching a thread list.
76
77 set test "info threads"
78 gdb_test_multiple "info threads" "$test" {
79     -re " Thread .*$gdb_prompt " {
80         pass "$test"
81     }
82     -re "$gdb_prompt " {
83         kfail gdb/1328 "$test"
84     }
85 }
86
87
88 # Check that the program can be quit.
89
90 set test "GDB exits with static thread program"
91 gdb_test_multiple "quit" "$test" {
92     -re "Quit anyway\\? \\(y or n\\) $" {
93         send_gdb "y\n"
94         exp_continue
95     }
96     eof {
97         pass "$test"
98     }
99 }