]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-pthreads.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-pthreads.exp
CommitLineData
4a94e368 1# Copyright 2002-2022 Free Software Foundation, Inc.
d1a2f204
KS
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
d1a2f204 6# (at your option) any later version.
e22f8b7c 7#
d1a2f204
KS
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#
d1a2f204 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/>.
d1a2f204 15
d1a2f204
KS
16# This file tests MI thread commands.
17# Specifically, we are testing the MI command set and the console (in MI)
18# command set ("interpreter-exec") and that the commands that are executed
19# via these command pathways are properly executed. Console commands
20# executed via MI should use MI output wrappers, MI event handlers, etc.
21
d1a2f204
KS
22load_lib mi-support.exp
23set MIFLAGS "-i=mi"
24
25gdb_exit
26if {[mi_gdb_start]} {
27 continue
28}
29
d1a2f204
KS
30# This procedure tests the various thread commands in MI.
31proc check_mi_thread_command_set {} {
32
33 mi_runto done_making_threads
34
35 set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
36
37 mi_gdb_test "-thread-select" \
1b05df00 38 {\^error,msg="-thread-select: USAGE: threadnum."} \
d1a2f204
KS
39 "check_mi_thread_command_set: -thread-select"
40
41 mi_gdb_test "-thread-select 123456789" \
65630365 42 {\^error,msg="Thread ID 123456789 not known\."} \
d1a2f204
KS
43 "check_mi_thread_command_set: -thread-select 123456789"
44
45 foreach thread $thread_list {
d8b3e9ee
MC
46 # line and file are optional.
47 # many of the threads are blocked in libc calls,
48 # and many people have libc's with no symbols.
d1a2f204 49 mi_gdb_test "-thread-select $thread" \
d8b3e9ee 50 "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
d1a2f204
KS
51 "check_mi_thread_command_set: -thread-select $thread"
52 }
66bb093b
VP
53
54 foreach thread $thread_list {
55 mi_gdb_test "-interpreter-exec console \"thread $thread\"" \
4034d0ff
AT
56 ".*=thread-selected,id=\"$thread\".*\r\n\\^done" \
57 "check =thread-selected: thread $thread"
66bb093b 58 }
d1a2f204
KS
59}
60
61#
62# Start here
63#
298a9cf0 64standard_testfile pthreads.c
d1a2f204 65
298a9cf0 66set options [list debug]
2bd4c7b1
MK
67if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
68 return -1
d1a2f204
KS
69}
70
71mi_gdb_reinitialize_dir $srcdir/$subdir
72mi_gdb_load $binfile
73
74check_mi_thread_command_set
75
76mi_gdb_exit
77