Update years in copyright notice for the GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / tls.exp
index 1c29a547ad77a3afd6144be549eaa3d1d7e91750..5f983aa3964474db63ac7a86e980504c2864b0f2 100644 (file)
@@ -1,5 +1,5 @@
 # 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"
@@ -26,7 +22,7 @@ if [istarget "*-*-linux"] then {
     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
 }
 
@@ -74,7 +70,7 @@ proc check_thread_local {number} {
            "= $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"
 
@@ -82,7 +78,7 @@ proc check_thread_local {number} {
            ".*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"
 }
@@ -142,11 +138,7 @@ proc check_thread_stack {number spin_threads spin_threads_level} {
     }
 }
 
-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
@@ -176,7 +168,7 @@ gdb_expect {
         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 $" {
@@ -213,7 +205,7 @@ gdb_test "continue" ".*Breakpoint 3.*still alive.*" "continue to synch point"
 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"
         }
@@ -261,10 +253,10 @@ gdb_test "continue" ".*Breakpoint 4.*before exit.*" "threads exited"
 
 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 $" {
@@ -283,8 +275,8 @@ runto spin
 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.
This page took 0.041599 seconds and 4 git commands to generate.