Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.multi / multi-target-interrupt.exp
CommitLineData
88b9d363 1# Copyright 2017-2022 Free Software Foundation, Inc.
e11daf7a
PA
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# Test interrupting multiple targets with Ctrl-C.
17
18source $srcdir/$subdir/multi-target.exp.tcl
19
20if {![multi_target_prepare]} {
21 return
22}
23
24proc test_ctrlc {} {
25 if {![setup "off"]} {
26 untested "setup failed"
27 return
28 }
29
30 delete_breakpoints
31
32 # Select inferior INF, continue all inferiors, and then Ctrl-C.
33 proc test_ctrlc_inf {inf} {
34 global gdb_prompt
35
36 gdb_test "inferior $inf" "Switching to inferior $inf.*"
37
38 set msg "continue"
39 gdb_test_multiple "continue" $msg {
40 -re "Continuing" {
41 pass $msg
42 }
43 }
44
45 after 200 { send_gdb "\003" }
46
47 set msg "send_gdb control C"
48 gdb_test_multiple "" $msg {
49 -re "received signal SIGINT.*$gdb_prompt $" {
50 pass $msg
51 }
52 }
53
54 set msg "all threads stopped"
55 gdb_test_multiple "info threads" "$msg" {
56 -re "\\\(running\\\).*$gdb_prompt $" {
57 fail $msg
58 }
59 -re "$gdb_prompt $" {
60 pass $msg
61 }
62 }
63 }
64
65 for {set i 1} {$i <= 5} {incr i} {
66 if {$i == 3} {
67 # This is a core inferior.
68 continue
69 }
70
71 with_test_prefix "inf$i" {
72 test_ctrlc_inf $i
73 }
74 }
75}
76
77test_ctrlc
78
79multi_target_cleanup
This page took 0.144693 seconds and 4 git commands to generate.