Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.server / run-without-local-binary.exp
blob21682a58c77111df74f5531f32915abd253807d8
1 # Copyright 2017-2023 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/>.  */
16 load_lib gdbserver-support.exp
18 if {[skip_gdbserver_tests]} {
19     return
22 standard_testfile normal.c
24 if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
25     return -1
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.
32 save_vars { GDBFLAGS } {
33     set GDBFLAGS ""
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     }
41     gdb_exit
42     gdb_start
44     gdb_test_no_output "set remote exec-file $binfile" \
45         "set remote exec-file"
47     # Make sure we're disconnected, in case we're testing with an
48     # extended-remote board, therefore already connected.
49     gdb_test "disconnect" ".*"
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
62     gdb_test "target ${gdbserver_protocol} ${gdbserver_gdbport}" \
63         "Remote debugging using [string_to_regexp $gdbserver_gdbport]" \
64         "connect to gdbserver"
66     gdb_test "run" \
67         "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\\]" \
68         "run test program until the end"