Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.server / sysroot.exp
CommitLineData
e5a1a79a
AH
1# This testcase is part of GDB, the GNU debugger.
2#
b811d2c2 3# Copyright 2019-2020 Free Software Foundation, Inc.
e5a1a79a
AH
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 GDB can correctly read the binary and shared libraries
19# with different sysroot setups: local and "target:".
20
21load_lib gdbserver-support.exp
22
23if { [skip_gdbserver_tests] } {
24 verbose "skipping gdbserver tests"
25 return -1
26}
27
28standard_testfile
29if {[build_executable "failed to prepare" $testfile $srcfile "additional_flags=--no-builtin"] == -1} {
30 return -1
31}
32
33# Run once with sysroot set to the local filesystem and once set to the remote
34# target.
35foreach_with_prefix sysroot { "local" "remote" } {
36 global srcdir
37 global subdir
38 global binfile
39
40 if { $sysroot == "local" } {
41 set sysroot_command "/"
42 set reading_symbols "Reading symbols from $binfile..."
43 } else {
44 set sysroot_command "target:"
45 set reading_symbols "Reading $binfile from remote target..."
46 }
47
48 # Restart GDB.
49 clean_restart
50
51 # Make sure we're disconnected, in case we're testing with an
52 # extended-remote board, therefore already connected.
53 gdb_test "disconnect" ".*"
54
55 # Start GDBserver.
56 set res [gdbserver_start "" $binfile]
57 set gdbserver_protocol [lindex $res 0]
58 set gdbserver_gdbport [lindex $res 1]
59
60 # Set the sysroot.
61 gdb_test_no_output "set sysroot $sysroot_command"
62
63 # Connect to gdbserver, making sure GDB reads in the binary correctly.
64 set test "connect to remote and read binary"
65 if {[gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport $reading_symbols] == 0} {
66 pass $test
67 } else {
68 fail $test
69 }
70
71 gdb_breakpoint main
72 gdb_test "continue" "Breakpoint $decimal.* main.*" "continue to main"
73
74 # Test that we can stop inside a library.
75 gdb_breakpoint printf
76 gdb_test "continue" "Breakpoint $decimal.* printf .*" "continue to printf"
77}
This page took 0.112434 seconds and 4 git commands to generate.