| OLD | NEW |
| 1 # Copyright 2003, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2003, 2007-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 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 | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 15 | 15 |
| 16 # tls-shared.exp -- Expect script to test thread local storage in gdb, with | 16 # tls-shared.exp -- Expect script to test thread local storage in gdb, with |
| 17 # shared libraries. | 17 # shared libraries. |
| 18 | 18 |
| 19 if $tracelevel then { | 19 standard_testfile tls-main.c |
| 20 strace $tracelevel | |
| 21 } | |
| 22 | |
| 23 set testfile tls-main | |
| 24 set libfile tls-shared | 20 set libfile tls-shared |
| 25 set srcfile ${testfile}.c | |
| 26 set binfile ${objdir}/${subdir}/${testfile} | |
| 27 set srcfile_lib ${libfile}.c | 21 set srcfile_lib ${libfile}.c |
| 28 set binfile_lib ${objdir}/${subdir}/${libfile}.so | 22 set binfile_lib [standard_output_file ${libfile}.so] |
| 29 | 23 |
| 30 remote_exec build "rm -f ${binfile}" | 24 remote_exec build "rm -f ${binfile}" |
| 31 | 25 |
| 32 # get the value of gcc_compiled | 26 # get the value of gcc_compiled |
| 33 if [get_compiler_info ${binfile}] { | 27 if [get_compiler_info] { |
| 34 return -1 | 28 return -1 |
| 35 } | 29 } |
| 36 | 30 |
| 37 | 31 |
| 38 if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
b} {debug}] != "" | 32 if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
b} {debug}] != "" |
| 39 || [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executab
le [list debug shlib=${binfile_lib}]] != ""} { | 33 || [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executab
le [list debug shlib=${binfile_lib}]] != ""} { |
| 40 return -1 | 34 return -1 |
| 41 } | 35 } |
| 42 | 36 |
| 43 | 37 |
| 44 gdb_exit | 38 clean_restart ${binfile} |
| 45 gdb_start | |
| 46 gdb_reinitialize_dir $srcdir/$subdir | |
| 47 gdb_load ${binfile} | |
| 48 gdb_load_shlibs ${binfile_lib} | 39 gdb_load_shlibs ${binfile_lib} |
| 49 | 40 |
| 50 if ![runto_main] then { | 41 if ![runto_main] then { |
| 51 fail "Can't run to main" | 42 fail "Can't run to main" |
| 52 return 0 | 43 return 0 |
| 53 } | 44 } |
| 54 | 45 |
| 55 gdb_test "print i_tls" "2" "print thread local storage variable" | 46 gdb_test "print i_tls" "2" "print thread local storage variable" |
| 56 | 47 |
| 57 gdb_test "ptype i_tls" "int" "ptype of thread local storage variable" | 48 gdb_test "ptype i_tls" "int" "ptype of thread local storage variable" |
| 58 | 49 |
| 59 gdb_test "info address i_tls" \ | 50 gdb_test "info address i_tls" \ |
| 60 » "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the th
read-local storage for .*tls-main.." \ | 51 » "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the th
read-local storage for .*tls-shared.." \ |
| 61 "print storage info for thread local storage variable" | 52 "print storage info for thread local storage variable" |
| 62 | 53 |
| 63 set line_number [gdb_get_line_number "break here to check result"] | 54 set line_number [gdb_get_line_number "break here to check result"] |
| 64 | 55 |
| 65 gdb_test "break $line_number" \ | 56 gdb_test "break $line_number" \ |
| 66 "Breakpoint.*at.*file.*tls-main.c.*line ${line_number}." \ | 57 "Breakpoint.*at.*file.*tls-main.c.*line ${line_number}." \ |
| 67 "break at and of main" | 58 "break at and of main" |
| 68 gdb_test "continue" \ | 59 gdb_test "continue" \ |
| 69 "main .* at .*:.*return 0.*break here to check result.*" \ | 60 "main .* at .*:.*return 0.*break here to check result.*" \ |
| 70 "continue to break" | 61 "continue to break" |
| 71 # This is more of a gcc/glibc test, really. | 62 # This is more of a gcc/glibc test, really. |
| 72 # | 63 # |
| 73 gdb_test "print result" "3" "print result" | 64 gdb_test "print result" "3" "print result" |
| 74 | 65 |
| 75 | 66 |
| OLD | NEW |