Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 2003-2015 Free Software Foundation, Inc. |
8bc2021f EZ |
2 | |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
8bc2021f | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
8bc2021f EZ |
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. | |
e22f8b7c | 12 | # |
8bc2021f | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
8bc2021f | 15 | |
8bc2021f EZ |
16 | # tls-shared.exp -- Expect script to test thread local storage in gdb, with |
17 | # shared libraries. | |
18 | ||
0efbbabc | 19 | standard_testfile tls-main.c |
8bc2021f | 20 | set libfile tls-shared |
756d88a7 | 21 | set srcfile_lib ${libfile}.c |
0efbbabc | 22 | set binfile_lib [standard_output_file ${libfile}.so] |
8bc2021f EZ |
23 | |
24 | remote_exec build "rm -f ${binfile}" | |
25 | ||
26 | # get the value of gcc_compiled | |
4c93b1db | 27 | if [get_compiler_info] { |
8bc2021f EZ |
28 | return -1 |
29 | } | |
30 | ||
8bc2021f | 31 | |
756d88a7 UW |
32 | if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != "" |
33 | || [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable [list debug shlib=${binfile_lib}]] != ""} { | |
4ee6625b | 34 | return -1 |
8bc2021f EZ |
35 | } |
36 | ||
37 | ||
0efbbabc | 38 | clean_restart ${binfile} |
756d88a7 | 39 | gdb_load_shlibs ${binfile_lib} |
8bc2021f EZ |
40 | |
41 | if ![runto_main] then { | |
42 | fail "Can't run to main" | |
43 | return 0 | |
44 | } | |
45 | ||
46 | gdb_test "print i_tls" "2" "print thread local storage variable" | |
47 | ||
48 | gdb_test "ptype i_tls" "int" "ptype of thread local storage variable" | |
49 | ||
50 | gdb_test "info address i_tls" \ | |
0efbbabc | 51 | "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the thread-local storage for .*tls-shared.." \ |
8bc2021f EZ |
52 | "print storage info for thread local storage variable" |
53 | ||
54 | set line_number [gdb_get_line_number "break here to check result"] | |
55 | ||
56 | gdb_test "break $line_number" \ | |
57 | "Breakpoint.*at.*file.*tls-main.c.*line ${line_number}." \ | |
58 | "break at and of main" | |
59 | gdb_test "continue" \ | |
60 | "main .* at .*:.*return 0.*break here to check result.*" \ | |
61 | "continue to break" | |
62 | # This is more of a gcc/glibc test, really. | |
63 | # | |
64 | gdb_test "print result" "3" "print result" | |
65 | ||
66 |