1 # Copyright 2016-2020 Free Software Foundation, Inc.
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.
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.
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/>.
18 if { [build_executable ${testfile}.exp ${binfile} "${srcfile}" {debug}] != 0 } {
22 proc switch_to_inferior { num message } {
23 gdb_test "inferior ${num}" \
24 "\\\[Switching to inferior ${num} \\\[<null>\\\] \\\(<noexec>\\\)\\\]" \
28 proc add_inferior { expected_num message } {
29 gdb_test "add-inferior" "Added inferior ${expected_num}" "${message}"
32 proc test_remove_inferiors { } {
35 clean_restart ${binfile}
37 # Add another inferior and switch to it.
38 add_inferior 2 "add second inferior"
39 switch_to_inferior 2 "switch to second inferior"
41 # Test that it is not possible to remove the current inferior.
42 gdb_test "remove-inferiors 2" \
43 "warning: Can not remove current inferior 2." \
44 "can't remove current inferior"
46 # Test that it is possible to remove a non-active non-current inferior.
47 gdb_test_no_output "remove-inferiors 1" "remove non-current inferior"
49 # Load binfile and start the inferior.
50 set binfile_re [string_to_regexp ${binfile}]
51 gdb_test "file ${binfile}" \
52 [multi_line "Reading symbols from ${binfile_re}\.\.\.(" \
53 "Expanding full symbols from ${binfile_re}\.\.\.)?" ] \
57 fail "couldn't run to main."
61 # Add another inferior and switch to it.
62 add_inferior 3 "add third inferior"
63 switch_to_inferior 3 "switch to third inferior"
65 # Test that it is not possible to remove an active non-current inferior.
66 gdb_test "remove-inferiors 2" \
67 "warning: Can not remove active inferior 2." \
68 "can't remove active inferior"