]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-pthreads.exp
run copyright.sh for 2011.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-pthreads.exp
CommitLineData
7b6bb8da 1# Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
0fb0cc75 2# Free Software Foundation, Inc.
d1a2f204
KS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
d1a2f204 7# (at your option) any later version.
e22f8b7c 8#
d1a2f204
KS
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
e22f8b7c 13#
d1a2f204 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
d1a2f204 16
d1a2f204
KS
17# This file tests MI thread commands.
18# Specifically, we are testing the MI command set and the console (in MI)
19# command set ("interpreter-exec") and that the commands that are executed
20# via these command pathways are properly executed. Console commands
21# executed via MI should use MI output wrappers, MI event handlers, etc.
22
23# This only works with native configurations
24if {![isnative]} {
25 return
26}
27
28load_lib mi-support.exp
29set MIFLAGS "-i=mi"
30
31gdb_exit
32if {[mi_gdb_start]} {
33 continue
34}
35
d1a2f204
KS
36# This procedure tests the various thread commands in MI.
37proc check_mi_thread_command_set {} {
38
39 mi_runto done_making_threads
40
41 set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
42
43 mi_gdb_test "-thread-select" \
44 {\^error,msg="mi_cmd_thread_select: USAGE: threadnum."} \
45 "check_mi_thread_command_set: -thread-select"
46
47 mi_gdb_test "-thread-select 123456789" \
39fb8e9e 48 {&.*\^error,msg="Thread ID 123456789 not known\."} \
d1a2f204
KS
49 "check_mi_thread_command_set: -thread-select 123456789"
50
51 foreach thread $thread_list {
d8b3e9ee
MC
52 # line and file are optional.
53 # many of the threads are blocked in libc calls,
54 # and many people have libc's with no symbols.
d1a2f204 55 mi_gdb_test "-thread-select $thread" \
d8b3e9ee 56 "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
d1a2f204
KS
57 "check_mi_thread_command_set: -thread-select $thread"
58 }
66bb093b
VP
59
60 foreach thread $thread_list {
61 mi_gdb_test "-interpreter-exec console \"thread $thread\"" \
62 ".*\\^done\r\n=thread-selected,id=\"$thread\"" \
63 "check =thread-selected: thread $thread"
64 }
d1a2f204
KS
65}
66
67#
68# Start here
69#
70set testfile "pthreads"
71set srcfile "$testfile.c"
19ac3974 72set binfile "$objdir/$subdir/mi-$testfile"
d1a2f204 73
dc62bfc2 74set options [list debug incdir=$objdir]
2bd4c7b1
MK
75if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
76 return -1
d1a2f204
KS
77}
78
79mi_gdb_reinitialize_dir $srcdir/$subdir
80mi_gdb_load $binfile
81
82check_mi_thread_command_set
83
84mi_gdb_exit
85