# tls.exp -- Expect script to test thread-local storage
-# Copyright (C) 1992, 2003, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1992-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
-set testfile tls
-set testfile2 tls2
-set srcfile ${testfile}.c
-set srcfile2 ${testfile2}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile tls.c tls2.c
if [istarget "*-*-linux"] then {
set target_cflags "-D_MIT_POSIX_THREADS"
set target_cflags ""
}
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable [list c++ debug]] != "" } {
return -1
}
"= $expected_value" \
"${number} thread local storage"
- gdb_test "p another_thread_local" \
+ gdb_test "p K::another_thread_local" \
"= $me_variable" \
"${number} another thread local storage"
".*a_thread_local.*a thread-local variable at offset.*" \
"${number} info address a_thread_local"
- gdb_test "info address another_thread_local" \
+ gdb_test "info address K::another_thread_local" \
".*another_thread_local.*a thread-local variable at offset.*" \
"${number} info address another_thread_local"
}
}
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
fail "Can't run to main"
return 0
unsupported "continue to first thread: system does not support TLS"
return -1
}
- -re ".*Program exited normally.*$gdb_prompt $" {
+ -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
fail "continue to first thread: program runaway"
}
-re ".*Pass 0 done.*Pass 1 done.*$gdb_prompt $" {
set no_of_threads 0
send_gdb "info thread\n"
gdb_expect {
- -re "^info thread\[ \t\r\n\]+(\[0-9\]+) Thread.*$gdb_prompt $" {
+ -re "^info thread\[ \t\r\n\]+ *Id .*Frame\[ \t\r\n\]+(\[0-9\]+) *Thread.*$gdb_prompt $" {
set no_of_threads $expect_out(1,string)
pass "get number of threads"
}
send_gdb "info thread\n"
gdb_expect {
- -re ".* 1 Thread.*2 Thread.*$gdb_prompt $" {
+ -re ".* 1 *Thread.*2 *Thread.*$gdb_prompt $" {
fail "Too many threads left at end"
}
- -re ".*\\\* 1 Thread.*main.*$gdb_prompt $" {
+ -re ".*\\\* 1 *Thread.*main.*$gdb_prompt $" {
pass "Expect only base thread at end"
}
-re ".*No stack.*$gdb_prompt $" {
gdb_test "info address a_global" \
".*a_global.*static storage at address.*" "info address a_global"
-setup_kfail "gdb/1294" "*-*-*"
-gdb_test "info address me" ".*me.*is a variable at offset.*" "info address me"
+gdb_test "info address me" ".*me.*is a (complex DWARF expression:|variable).*" \
+ "info address me"
# Test LOC_UNRESOLVED references resolving for `extern' TLS variables.