1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2020-2022 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test that in all-stop mode with multiple inferiors, GDB stops all
19 # threads upon receiving an exit event from one of the inferiors.
23 if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
28 fail "starting inferior 1"
32 # This is a test specific for a native target, where we use the
33 # "-exec" argument to "add-inferior" and we explicitly don't do
34 # "maint set target-non-stop on".
35 if {![gdb_is_target_native]} {
36 untested "the test is aimed at a native target"
40 # Add a second inferior that will sleep longer.
41 gdb_test "add-inferior -exec $binfile" "Added inferior 2.*" \
42 "add the second inferior"
43 gdb_test "inferior 2" ".*Switching to inferior 2.*"
45 fail "starting inferior 2"
48 gdb_test "print duration=10" "= 10"
50 # Now continue both processes. We should get the exit event from the
52 gdb_test_no_output "set schedule-multiple on"
55 # GDB is expected to have stopped the other inferior. Switch to the
56 # slow inferior's thread. It should not be running.
57 gdb_test_multiple "thread 2.1" "check thread 2.1 is not running" {
58 -re "\\(running\\)\[\r\n\]+$gdb_prompt" {