]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.server/wrapper.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.server / wrapper.exp
CommitLineData
ee47b2f8
YQ
1# This testcase is part of GDB, the GNU debugger.
2
1d506c26 3# Copyright 2013-2024 Free Software Foundation, Inc.
ee47b2f8
YQ
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 --wrapper option of GDBserver.
19
20load_lib gdbserver-support.exp
21
22standard_testfile
23
cadfc59b 24require allow_gdbserver_tests
ee47b2f8 25
a205fbfc
PA
26if { [istarget *-*-mingw*]
27 || [istarget *-*-cygwin*] } {
28 unsupported "gdbserver does not support --wrapper on this target (PR server/15967)"
ee47b2f8
YQ
29 return -1
30}
31
8dc558a0
SM
32save_vars { GDBFLAGS } {
33 # If GDB and GDBserver are both running locally, set the sysroot to avoid
34 # reading files via the remote protocol.
35 if { ![is_remote host] && ![is_remote target] } {
36 set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
37 }
38
39 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
40 return -1
41 }
ee47b2f8
YQ
42}
43
44# Make sure we're disconnected, in case we're testing with an
45# extended-remote board, therefore already connected.
46gdb_test "disconnect" ".*"
47
48set target_exec [gdbserver_download_current_prog]
49# Start GDBserver with option '--wrapper'.
50set res [gdbserver_start "--wrapper env TEST=1 --" $target_exec]
51
52set gdbserver_protocol [lindex $res 0]
53set gdbserver_gdbport [lindex $res 1]
54gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
55
56gdb_breakpoint marker
57gdb_test "continue" "Breakpoint.* marker .*" "continue to marker"
58# Test env var TEST is correctly passed to the program through
59# --wrapper.
60gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*"