1# This testcase is part of GDB, the GNU debugger. 2 3# Copyright 2018-2020 Free Software Foundation, Inc. 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 that gdbserver performs path expansion/adjustment when we 19# provide just a filename (without any path specifications) to it. 20 21load_lib gdbserver-support.exp 22 23standard_testfile normal.c 24 25if { [skip_gdbserver_tests] } { 26 return 0 27} 28 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 31# target. 32if { [is_remote target] } { 33 return 0 34} 35 36if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { 37 return -1 38} 39 40# Make sure we're disconnected, in case we're testing with an 41# extended-remote board, therefore already connected. 42gdb_test "disconnect" ".*" 43 44set target_exec [gdbserver_download_current_prog] 45 46# Switch to where $target_exec lives, and execute gdbserver from 47# there. 48with_cwd "[file dirname $target_exec]" { 49 set target_execname [file tail $target_exec] 50 set res [gdbserver_start "" $target_execname] 51 52 set gdbserver_protocol [lindex $res 0] 53 set gdbserver_gdbport [lindex $res 1] 54 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport 55 56 gdb_breakpoint main 57 gdb_test "continue" "Breakpoint $decimal.* main.*" "continue to main" 58} 59