Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.multi / multi-target-no-resumed.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 that when there's a foreground execution command in progress, a
17# TARGET_WAITKIND_NO_RESUMED for a particular target is ignored when
18# other targets are still resumed.
19
20source $srcdir/$subdir/multi-target.exp.tcl
21
22if {![multi_target_prepare]} {
23 return
24}
25
26proc test_no_resumed_infs {inf_A inf_B} {
27 global gdb_prompt
28
29 if {![setup "off"]} {
30 untested "setup failed"
31 return
32 }
33
34 gdb_test "thread $inf_A.2" "Switching to thread $inf_A\.2 .*" \
35 "select thread of target A"
36
37 gdb_test_no_output "set scheduler-locking on"
38
39 gdb_test_multiple "continue &" "" {
40 -re "Continuing.*$gdb_prompt " {
41 pass $gdb_test_name
42 }
43 }
44
45 gdb_test "thread $inf_B.2" "Switching to thread $inf_B\.2 .*" \
46 "select thread of target B"
47 gdb_test "p exit_thread = 1" " = 1" \
48 "set the thread to exit on resumption"
49
50 # Wait 3 seconds. If we see any response from GDB, such as
51 # "No unwaited-for children left." it's a bug.
52 gdb_test_multiple "continue" "continue" {
53 -timeout 3
54 timeout {
55 pass $gdb_test_name
56 }
57 }
58
59 # Now stop the program (all targets).
60 send_gdb "\003"
61 gdb_test_multiple "" "send_gdb control C" {
62 -re "received signal SIGINT.*$gdb_prompt $" {
63 pass $gdb_test_name
64 }
65 }
66
67 gdb_test_multiple "info threads" "all threads stopped" {
68 -re "\\\(running\\\).*$gdb_prompt $" {
69 fail $gdb_test_name
70 }
71 -re "$gdb_prompt $" {
72 pass $gdb_test_name
73 }
74 }
75}
76
77# inferior 1 -> native
78# inferior 2 -> extended-remote 1
79# inferior 5 -> extended-remote 2
80set inferiors {1 2 5}
81foreach_with_prefix inf_A $inferiors {
82 foreach_with_prefix inf_B $inferiors {
83 if {$inf_A == $inf_B} {
84 continue
85 }
86 test_no_resumed_infs $inf_A $inf_B
87 }
88}
89
90multi_target_cleanup
This page took 0.145017 seconds and 4 git commands to generate.