Commit | Line | Data |
---|---|---|
c72b934c AC |
1 | # static.exp -- test script, for GDB, the GNU debugger. |
2 | ||
9b254dd1 | 3 | # Copyright 2004, 2005, 2007, 2008 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 | |
e22f8b7c | 7 | # the Free Software Foundation; either version 3 of the License, or |
c72b934c | 8 | # (at your option) any later version. |
e22f8b7c | 9 | # |
c72b934c AC |
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. | |
e22f8b7c | 14 | # |
c72b934c | 15 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c72b934c AC |
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 | set prms_id 0 | |
26 | set bug_id 0 | |
27 | ||
28 | set testfile "staticthreads" | |
29 | set srcfile ${testfile}.c | |
30 | set binfile ${objdir}/${subdir}/${testfile} | |
31 | set static_flag "-static" | |
32 | ||
33 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ | |
34 | executable \ | |
35 | [list debug "incdir=${objdir}" "additional_flags=${static_flag}" \ | |
36 | ]] != "" } { | |
37 | return -1 | |
38 | } | |
39 | ||
40 | gdb_start | |
41 | gdb_reinitialize_dir $srcdir/$subdir | |
42 | gdb_load ${binfile} | |
43 | gdb_test "set print sevenbit-strings" "" | |
44 | ||
45 | ||
46 | # See if the static multi-threaded program runs. | |
47 | ||
48 | runto_main | |
49 | gdb_test "break sem_post" | |
50 | set test "Continue to main's call of sem_post" | |
51 | gdb_test_multiple "continue" "$test" { | |
aba471f5 | 52 | -re "Breakpoint .*, .*sem_post .*$gdb_prompt " { |
c72b934c AC |
53 | pass "$test" |
54 | } | |
55 | -re "Program received signal .*$gdb_prompt " { | |
56 | kfail gdb/1328 "$test" | |
57 | } | |
58 | } | |
59 | ||
60 | ||
61 | # See if handle SIG32 helps (a little) with a static multi-threaded | |
62 | # program. | |
63 | ||
1690f9cf DJ |
64 | set sig "SIG32" |
65 | ||
66 | # SIGRTMIN is 37 on hppa-linux and hpux | |
67 | if [istarget hppa*-*-*] { | |
68 | set sig "SIG37" | |
69 | } | |
70 | ||
c72b934c | 71 | rerun_to_main |
1690f9cf DJ |
72 | gdb_test "handle $sig nostop noprint pass" |
73 | set test "Handle $sig helps" | |
74 | gdb_test "continue" " .*sem_post .*" "handle $sig helps" | |
c72b934c AC |
75 | |
76 | ||
77 | # See if info threads produces anything approaching a thread list. | |
78 | ||
79 | set test "info threads" | |
80 | gdb_test_multiple "info threads" "$test" { | |
81 | -re " Thread .*$gdb_prompt " { | |
82 | pass "$test" | |
83 | } | |
84 | -re "$gdb_prompt " { | |
85 | kfail gdb/1328 "$test" | |
86 | } | |
87 | } | |
88 | ||
89 | ||
90 | # Check that the program can be quit. | |
91 | ||
92 | set test "GDB exits with static thread program" | |
93 | gdb_test_multiple "quit" "$test" { | |
94 | -re "The program is running. Exit anyway\\? \\(y or n\\) $" { | |
95 | send_gdb "y\n" | |
96 | exp_continue | |
97 | } | |
98 | eof { | |
99 | pass "$test" | |
100 | } | |
101 | } |