]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi2-pthreads.exp
* lib/mi-support.exp (get_mi_thread_list)
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-pthreads.exp
CommitLineData
9b254dd1 1# Copyright 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
2fcf52f0
AC
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
2fcf52f0 6# (at your option) any later version.
e22f8b7c 7#
2fcf52f0
AC
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.
e22f8b7c 12#
2fcf52f0 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
2fcf52f0
AC
15
16# Please email any bugs, comments, and/or additions to this file to:
17# bug-gdb@prep.ai.mit.edu
18
19# This file tests MI thread commands.
20# Specifically, we are testing the MI command set and the console (in MI)
21# command set ("interpreter-exec") and that the commands that are executed
22# via these command pathways are properly executed. Console commands
23# executed via MI should use MI output wrappers, MI event handlers, etc.
24
25# This only works with native configurations
26if {![isnative]} {
27 return
28}
29
30load_lib mi-support.exp
31set MIFLAGS "-i=mi2"
32
33gdb_exit
34if {[mi_gdb_start]} {
35 continue
36}
37
2fcf52f0
AC
38# This procedure tests the various thread commands in MI.
39proc check_mi_thread_command_set {} {
40
41 mi_runto done_making_threads
42
43 set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
44
45 mi_gdb_test "-thread-select" \
46 {\^error,msg="mi_cmd_thread_select: USAGE: threadnum."} \
47 "check_mi_thread_command_set: -thread-select"
48
49 mi_gdb_test "-thread-select 123456789" \
39fb8e9e 50 {&.*\^error,msg="Thread ID 123456789 not known\."} \
2fcf52f0
AC
51 "check_mi_thread_command_set: -thread-select 123456789"
52
53 foreach thread $thread_list {
54 # line and file are optional.
55 # many of the threads are blocked in libc calls,
56 # and many people have libc's with no symbols.
57 mi_gdb_test "-thread-select $thread" \
58 "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
59 "check_mi_thread_command_set: -thread-select $thread"
60 }
61}
62
63#
64# Start here
65#
66set testfile "pthreads"
67set srcfile "$testfile.c"
19ac3974 68set binfile "$objdir/$subdir/mi2-$testfile"
2fcf52f0
AC
69
70set options [list debug incdir=$objdir]
71if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
72 return -1
73}
74
75mi_gdb_reinitialize_dir $srcdir/$subdir
76mi_gdb_load $binfile
77
78check_mi_thread_command_set
79
80mi_gdb_exit
81