Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.threads / tls-shared.exp
blobfc5c0862cc0144e11b8db0cddf23d2583c9302e1
1 # Copyright 2003 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # tls-shared.exp -- Expect script to test thread local storage in gdb, with
21 # shared libraries.
23 if $tracelevel then {
24 strace $tracelevel
27 set testfile tls-main
28 set libfile tls-shared
29 set srcfile ${testfile}.c
30 set binfile ${objdir}/${subdir}/${testfile}
32 remote_exec build "rm -f ${binfile}"
34 # get the value of gcc_compiled
35 if [get_compiler_info ${binfile}] {
36 return -1
39 if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
40 return -1
43 # Build the shared libraries this test case needs.
46 if {$gcc_compiled == 0} {
47 if [istarget "hppa*-hp-hpux*"] then {
48 set additional_flags "additional_flags=+z"
49 } elseif { [istarget "mips-sgi-irix*"] } {
50 # Disable SGI compiler's implicit -Dsgi
51 set additional_flags "additional_flags=-Usgi"
52 } else {
53 # don't know what the compiler is...
54 set additional_flags ""
56 } else {
57 if { ([istarget "powerpc*-*-aix*"]
58 || [istarget "rs6000*-*-aix*"]) } {
59 set additional_flags ""
60 } else {
61 set additional_flags "additional_flags=-fpic"
65 set additional_flags "$additional_flags -shared"
66 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.so" executable [list debug $additional_flags "incdir=${objdir}"]] != ""} {
67 return -1
70 if { ($gcc_compiled
71 && ([istarget "powerpc*-*-aix*"]
72 || [istarget "rs6000*-*-aix*"] )) } {
73 set additional_flags "additional_flags=-L${objdir}/${subdir}"
74 } elseif { [istarget "mips-sgi-irix*"] } {
75 set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
76 } else {
77 set additional_flags ""
80 if {[gdb_compile_pthreads "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.so" "${binfile}" executable [list debug $additional_flags]] != ""} {
81 return -1
85 gdb_exit
86 gdb_start
87 gdb_reinitialize_dir $srcdir/$subdir
88 gdb_load ${binfile}
90 if ![runto_main] then {
91 fail "Can't run to main"
92 return 0
95 gdb_test "print i_tls" "2" "print thread local storage variable"
97 gdb_test "ptype i_tls" "int" "ptype of thread local storage variable"
99 gdb_test "info address i_tls" \
100 "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0 in the thread-local storage for .*tls-main.." \
101 "print storage info for thread local storage variable"
103 set line_number [gdb_get_line_number "break here to check result"]
105 gdb_test "break $line_number" \
106 "Breakpoint.*at.*file.*tls-main.c.*line ${line_number}." \
107 "break at and of main"
108 gdb_test "continue" \
109 "main .* at .*:.*return 0.*break here to check result.*" \
110 "continue to break"
111 # This is more of a gcc/glibc test, really.
113 gdb_test "print result" "3" "print result"