]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.threads/staticthreads.exp
Fix test names starting with uppercase output by basic functions
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / staticthreads.exp
CommitLineData
c72b934c
AC
1# static.exp -- test script, for GDB, the GNU debugger.
2
618f726f 3# Copyright 2004-2016 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
c72b934c 21
0efbbabc 22standard_testfile
c72b934c
AC
23set static_flag "-static"
24
5876f503
JK
25foreach have_tls { "-DHAVE_TLS" "" } {
26 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
27 executable \
28 [list debug "additional_flags=${static_flag} ${have_tls}" \
29 ]] == "" } {
30 break
31 }
32 if { $have_tls == "" } {
33 return -1
34 }
c72b934c
AC
35}
36
0efbbabc 37clean_restart ${binfile}
12b5d08a 38gdb_test_no_output "set print sevenbit-strings"
c72b934c
AC
39
40
41# See if the static multi-threaded program runs.
42
43runto_main
44gdb_test "break sem_post"
bc6c7af4 45set test "continue to main's call of sem_post"
c72b934c 46gdb_test_multiple "continue" "$test" {
aba471f5 47 -re "Breakpoint .*, .*sem_post .*$gdb_prompt " {
c72b934c
AC
48 pass "$test"
49 }
00dbd492 50 -re " received signal .*$gdb_prompt " {
c72b934c
AC
51 kfail gdb/1328 "$test"
52 }
53}
54
55
56# See if handle SIG32 helps (a little) with a static multi-threaded
57# program.
58
1690f9cf
DJ
59set sig "SIG32"
60
3ca22649 61# SIGRTMIN is 37 on hppa-linux
1690f9cf
DJ
62if [istarget hppa*-*-*] {
63 set sig "SIG37"
64}
65
c72b934c 66rerun_to_main
1690f9cf 67gdb_test "handle $sig nostop noprint pass"
bc6c7af4 68set test "handle $sig helps"
1690f9cf 69gdb_test "continue" " .*sem_post .*" "handle $sig helps"
c72b934c
AC
70
71
72# See if info threads produces anything approaching a thread list.
73
74set test "info threads"
75gdb_test_multiple "info threads" "$test" {
76 -re " Thread .*$gdb_prompt " {
77 pass "$test"
78 }
79 -re "$gdb_prompt " {
80 kfail gdb/1328 "$test"
81 }
82}
83
84
85# Check that the program can be quit.
86
87set test "GDB exits with static thread program"
88gdb_test_multiple "quit" "$test" {
b8fa0bfa 89 -re "Quit anyway\\? \\(y or n\\) $" {
c72b934c
AC
90 send_gdb "y\n"
91 exp_continue
92 }
93 eof {
94 pass "$test"
95 }
96}
5876f503
JK
97clean_restart ${binfile}
98
99
100if { "$have_tls" != "" } {
101 if ![runto_main] {
102 return -1
103 }
104 gdb_breakpoint [gdb_get_line_number "tlsvar-is-set"]
105 gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*"
106 gdb_test "p tlsvar" " = 2" "tlsvar in thread"
107 gdb_test "thread 1" ".*"
b8b91e98 108 # Unwind to main.
5876f503
JK
109 gdb_test "up 10" " in main .*"
110 gdb_test "p tlsvar" " = 1" "tlsvar in main"
111}