]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.server/abspath.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.server / abspath.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2018-2022 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
21 load_lib gdbserver-support.exp
22
23 standard_testfile normal.c
24
25 if { [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.
32 if { [is_remote target] } {
33 return 0
34 }
35
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\""
42 }
43
44 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
45 return -1
46 }
47 }
48
49 # Make sure we're disconnected, in case we're testing with an
50 # extended-remote board, therefore already connected.
51 gdb_test "disconnect" ".*"
52
53 set target_exec [gdbserver_download_current_prog]
54
55 # Switch to where $target_exec lives, and execute gdbserver from
56 # there.
57 with_cwd "[file dirname $target_exec]" {
58 set target_execname [file tail $target_exec]
59 set res [gdbserver_start "" $target_execname]
60
61 set gdbserver_protocol [lindex $res 0]
62 set gdbserver_gdbport [lindex $res 1]
63 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
64
65 gdb_breakpoint main
66 gdb_test "continue" "Breakpoint $decimal.* main.*" "continue to main"
67 }