Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.multi / stop-all-on-exit.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2020-2022 Free Software Foundation, Inc.
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
21 standard_testfile
22
23 if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
24 return -1
25 }
26
27 if {![runto_main]} {
28 fail "starting inferior 1"
29 return -1
30 }
31
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"
37 return 0
38 }
39
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.*"
44 if {![runto_main]} {
45 fail "starting inferior 2"
46 return -1
47 }
48 gdb_test "print duration=10" "= 10"
49
50 # Now continue both processes. We should get the exit event from the
51 # first inferior.
52 gdb_test_no_output "set schedule-multiple on"
53 gdb_continue_to_end
54
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" {
59 fail $gdb_test_name
60 }
61 -re "$gdb_prompt" {
62 pass $gdb_test_name
63 }
64 }
This page took 0.030849 seconds and 4 git commands to generate.