Switch the license of all .exp files to GPLv3.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / print-threads.exp
index 09c3f8ada808e9610a6e61dbe7d92088f945ed65..de8a490fc0d5fd69f4e3c069880ab1666024e68b 100644 (file)
@@ -1,18 +1,17 @@
-# Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2002, 2003, 2007 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Please email any bugs, comments, and/or additions to this file to:
 # bug-gdb@prep.ai.mit.edu
@@ -38,41 +37,7 @@ set binfile ${objdir}/${subdir}/${testfile}
 # carriage return)
 set horiz "\[^\n\r\]*"
 
-set built_binfile 0
-
-# Default to the usual (only?) -lpthread on GNU/Linux to quiet noise
-if [istarget "*-*-linux*"] then {
-    set possible_libs "-lpthread -lpthreads -lthread"
-} else {
-    set possible_libs "-lpthreads -lpthread -lthread"
-}
-
-set why_msg "unrecognized error"
-foreach lib $possible_libs {
-    set options "debug"
-    lappend options "incdir=${objdir}/${subdir}"
-    lappend options "libs=$lib"
-    set ccout [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options]
-    switch -regexp -- $ccout {
-       ".*no posix threads support.*" {
-           set why_msg "missing threads include file"
-           break
-       }
-       ".*cannot open -lpthread.*" {
-           set why_msg "missing runtime threads library"
-       }
-       ".*Can't find library for -lpthread.*" {
-           set why_msg "missing runtime threads library"
-       }
-       {^$} {
-           pass "successfully compiled posix threads test case"
-           set built_binfile 1
-           break
-       }
-    }
-}
-if {$built_binfile == "0"} {
-    unsupported "Couldn't compile ${srcfile}, ${why_msg}"
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
     return -1
 }
 
@@ -128,6 +93,13 @@ proc test_all_threads { name kill } {
                fail "all threads ran once ($name) (total $i threads ran)"
            }
        }
+       -re "Program received signal SIGTRAP.*(Thread \[-0-9a-fx\]* \\(zombie\\)|0x00000000 in ).*$gdb_prompt $" {
+           if { $kill == 1 } {
+               kfail "gdb/1265" "Running threads ($name) (zombie thread)"
+           } else {
+               fail "Running threads ($name) (unknown output)"
+           }
+       }
        -re "$gdb_prompt" {
            fail "Running threads ($name) (unknown output)"
        }
@@ -150,7 +122,7 @@ test_all_threads "slow" 0
 runto_main
 gdb_test "break thread_function" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*print-threads.c, line \[0-9\]*\\." "break thread_function (3)"
 gdb_test "set var slow = 1" "" "set var slow = 1 (2)"
-gdb_test "break kill" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+"
+gdb_breakpoint "kill"
 test_all_threads "slow with kill breakpoint" 1
 
 return 0
This page took 0.025154 seconds and 4 git commands to generate.