]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.threads/corethreads.exp
Copyright year update in most files of the GDB Project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / corethreads.exp
1 # Copyright 2011-2012 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
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.
12 #
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/>.
15
16 # Are we on a target board? And non-Linux targets seem to identify the thread
17 # differently.
18 if {![isnative] || ![istarget "*-*-linux*"]} {
19 return
20 }
21
22 set testfile "corethreads"
23 set srcfile ${testfile}.c
24 set executable ${testfile}
25 set binfile ${objdir}/${subdir}/${executable}
26 if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
27 untested ${testfile}.exp
28 return -1
29 }
30
31 set corefile [core_find $binfile]
32 if {$corefile == ""} {
33 return 0
34 }
35
36 clean_restart $executable
37
38 gdb_test "core-file $corefile" "Core was generated by .*" "load core"
39 gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "sanity check we see the core file"
40
41 set test "print pthread_t of thread0"
42 gdb_test_multiple "p/x thread0" $test {
43 -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
44 pass $test
45 set thread0 $expect_out(1,string)
46 }
47 }
48 set test "print pthread_t of thread1"
49 gdb_test_multiple "p/x thread1" $test {
50 -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
51 pass $test
52 set thread1 $expect_out(1,string)
53 }
54 }
55
56 gdb_test "info threads" "\r\n *\[12\] +Thread $thread0 .*" "thread0 found"
57 gdb_test "info threads" "\r\n *\\*? +\[12\] +Thread $thread1 .*" "thread1 found"
58 gdb_test "info threads" "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\[^\r\n\]+\r\n\[^\r\n\]+" "no other thread found"