Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.server / run-without-local-binary.exp
CommitLineData
88b9d363 1# Copyright 2017-2022 Free Software Foundation, Inc.
87215ad1
SDJ
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
16load_lib gdbserver-support.exp
17
18if {[skip_gdbserver_tests]} {
19 return
20}
21
22standard_testfile normal.c
23
24if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
25 return -1
26}
27
28# Test running GDB without providing a local binary for it. In order
29# to do that, we unset GDBFLAGS before running GDB. We also start
30# gdbserver "by hand". For more details about this test, see PR
31# remote/21852.
32save_vars { GDBFLAGS } {
33 set GDBFLAGS ""
8dc558a0
SM
34
35 # If GDB and GDBserver are both running locally, set the sysroot to avoid
36 # reading files via the remote protocol.
37 if { ![is_remote host] && ![is_remote target] } {
38 set GDBFLAGS "-ex \"set sysroot\""
39 }
40
87215ad1
SDJ
41 gdb_exit
42 gdb_start
43
44 gdb_test_no_output "set remote exec-file $binfile" \
45 "set remote exec-file"
46
47 # Make sure we're disconnected, in case we're testing with an
48 # extended-remote board, therefore already connected.
d1e36019 49 gdb_test "disconnect" ".*"
87215ad1
SDJ
50
51 # Let's start gdbserver in extended-remote mode now. We cannot
52 # use gdbserver_start_extended here because it starts gdbserver,
53 # then GDB *with* a local binary, and the connect both.
54 set res [gdbserver_start "--multi" ""]
55 set gdbserver_protocol [lindex $res 0]
56 if { [string first "extended-" $gdbserver_protocol] != 0} {
57 set gdbserver_protocol "extended-$gdbserver_protocol"
58 }
59 set gdbserver_gdbport [lindex $res 1]
60 set use_gdb_stub 0
61
62 gdb_test "target ${gdbserver_protocol} ${gdbserver_gdbport}" \
c7ab0aef 63 "Remote debugging using [string_to_regexp $gdbserver_gdbport]" \
87215ad1
SDJ
64 "connect to gdbserver"
65
66 gdb_test "run" \
67 "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\\]" \
68 "run test program until the end"
69}
This page took 0.590183 seconds and 4 git commands to generate.