Commit | Line | Data |
---|---|---|
ee47b2f8 YQ |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | ||
42a4f53d | 3 | # Copyright 2013-2019 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 | ||
20 | load_lib gdbserver-support.exp | |
21 | ||
22 | standard_testfile | |
23 | ||
24 | if { [skip_gdbserver_tests] } { | |
25 | return 0 | |
26 | } | |
27 | ||
a205fbfc PA |
28 | if { [istarget *-*-mingw*] |
29 | || [istarget *-*-cygwin*] } { | |
30 | unsupported "gdbserver does not support --wrapper on this target (PR server/15967)" | |
ee47b2f8 YQ |
31 | return -1 |
32 | } | |
33 | ||
5b362f04 | 34 | if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { |
ee47b2f8 YQ |
35 | return -1 |
36 | } | |
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 | set target_exec [gdbserver_download_current_prog] | |
43 | # Start GDBserver with option '--wrapper'. | |
44 | set res [gdbserver_start "--wrapper env TEST=1 --" $target_exec] | |
45 | ||
46 | set gdbserver_protocol [lindex $res 0] | |
47 | set gdbserver_gdbport [lindex $res 1] | |
48 | gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport | |
49 | ||
50 | gdb_breakpoint marker | |
51 | gdb_test "continue" "Breakpoint.* marker .*" "continue to marker" | |
52 | # Test env var TEST is correctly passed to the program through | |
53 | # --wrapper. | |
54 | gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*" |