]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.multi/stop-all-on-exit.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.multi / stop-all-on-exit.exp
CommitLineData
53cccef1
TBA
1# This testcase is part of GDB, the GNU debugger.
2
213516ef 3# Copyright 2020-2023 Free Software Foundation, Inc.
53cccef1
TBA
4
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.
9#
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.
14#
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/>.
17
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.
20
21standard_testfile
22
23if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
24 return -1
25}
26
27if {![runto_main]} {
53cccef1
TBA
28 return -1
29}
30
31# This is a test specific for a native target, where we use the
32# "-exec" argument to "add-inferior" and we explicitly don't do
33# "maint set target-non-stop on".
34if {![gdb_is_target_native]} {
35 untested "the test is aimed at a native target"
36 return 0
37}
38
39# Add a second inferior that will sleep longer.
40gdb_test "add-inferior -exec $binfile" "Added inferior 2.*" \
41 "add the second inferior"
42gdb_test "inferior 2" ".*Switching to inferior 2.*"
43if {![runto_main]} {
53cccef1
TBA
44 return -1
45}
46gdb_test "print duration=10" "= 10"
47
48# Now continue both processes. We should get the exit event from the
49# first inferior.
50gdb_test_no_output "set schedule-multiple on"
51gdb_continue_to_end
52
53# GDB is expected to have stopped the other inferior. Switch to the
54# slow inferior's thread. It should not be running.
55gdb_test_multiple "thread 2.1" "check thread 2.1 is not running" {
56 -re "\\(running\\)\[\r\n\]+$gdb_prompt" {
57 fail $gdb_test_name
58 }
59 -re "$gdb_prompt" {
60 pass $gdb_test_name
61 }
62}