1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2018-2021 Free Software Foundation, Inc.
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.
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.
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/>.
18 # Test that gdbserver performs path expansion/adjustment when we
19 # provide just a filename (without any path specifications) to it.
21 load_lib gdbserver-support.exp
23 standard_testfile normal.c
25 if { [skip_gdbserver_tests] } {
29 # Because we're relying on being able to change our CWD before
30 # executing gdbserver, we just run if we're not testing with a remote
32 if { [is_remote target] } {
36 save_vars { GDBFLAGS } {
37 # If GDB and GDBserver are both running locally, set the sysroot to avoid
38 # reading files via the remote protocol (the `is_remote target` check is
39 # already done above).
40 if { ![is_remote host] } {
41 set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
44 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
49 # Make sure we're disconnected, in case we're testing with an
50 # extended-remote board, therefore already connected.
51 gdb_test "disconnect" ".*"
53 set target_exec [gdbserver_download_current_prog]
55 # Switch to where $target_exec lives, and execute gdbserver from
57 with_cwd "[file dirname $target_exec]" {
58 set target_execname [file tail $target_exec]
59 set res [gdbserver_start "" $target_execname]
61 set gdbserver_protocol [lindex $res 0]
62 set gdbserver_gdbport [lindex $res 1]
63 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
66 gdb_test "continue" "Breakpoint $decimal.* main.*" "continue to main"