Avoid another inferior_ptid reference in gdb/remote.c
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.server / connect-without-multi-process.exp
CommitLineData
b811d2c2 1# Copyright 2015-2020 Free Software Foundation, Inc.
3d40fbb5
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# Check that we can connect to GDBserver with the multiprocess
e7af6c70 17# extensions disabled, run to main, and finish the process.
3d40fbb5
PA
18
19load_lib gdbserver-support.exp
20
21if {[skip_gdbserver_tests]} {
22 return
23}
24
25standard_testfile
26
27if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
28 return -1
29}
30
31# Test spawning gdbserver with a program, connect to it and run to
32# main, with both multiprocess extensions on and off.
33proc do_test {multiprocess} {
34 global binfile
35
36 clean_restart $binfile
37
38 # Make sure we're disconnected, in case we're testing with an
39 # extended-remote board, therefore already connected.
40 gdb_test "disconnect" ".*"
41
42 gdb_test_no_output "set remote multiprocess-feature $multiprocess"
43
e9d9abd7 44 set res [gdbserver_spawn ""]
3d40fbb5
PA
45 set gdbserver_protocol [lindex $res 0]
46 set gdbserver_gdbport [lindex $res 1]
47
48 gdb_test "break main" "Breakpoint .*"
49
50 gdb_test "target $gdbserver_protocol $gdbserver_gdbport" \
51 "Remote debugging using .*" \
52 "target $gdbserver_protocol"
53
54 gdb_test "continue" "main .*" "continue to main"
e7af6c70
TBA
55
56 # The W/X packets do not include the PID of the exiting process
57 # without the multi-process extensions. Check that we handle
58 # process exit correctly in that case.
59 gdb_continue_to_end
3d40fbb5
PA
60}
61
62foreach multiprocess { "off" "auto" } {
63 with_test_prefix "multiprocess=$multiprocess" {
64 do_test $multiprocess
65 }
66}
This page took 0.496834 seconds and 4 git commands to generate.