]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2017-2024 Free Software Foundation, Inc. |
87215ad1 SDJ |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
15 | ||
16 | load_lib gdbserver-support.exp | |
17 | ||
cadfc59b | 18 | require allow_gdbserver_tests |
87215ad1 SDJ |
19 | |
20 | standard_testfile normal.c | |
21 | ||
98bf5c02 | 22 | if {[build_executable "failed to prepare" $testfile $srcfile debug]} { |
87215ad1 SDJ |
23 | return -1 |
24 | } | |
25 | ||
64c9b639 TV |
26 | set target_binfile [gdb_remote_download target $binfile] |
27 | ||
87215ad1 SDJ |
28 | # Test running GDB without providing a local binary for it. In order |
29 | # to do that, we unset GDBFLAGS before running GDB. We also start | |
30 | # gdbserver "by hand". For more details about this test, see PR | |
31 | # remote/21852. | |
32 | save_vars { GDBFLAGS } { | |
33 | set GDBFLAGS "" | |
8dc558a0 SM |
34 | |
35 | # If GDB and GDBserver are both running locally, set the sysroot to avoid | |
36 | # reading files via the remote protocol. | |
37 | if { ![is_remote host] && ![is_remote target] } { | |
38 | set GDBFLAGS "-ex \"set sysroot\"" | |
39 | } | |
40 | ||
87215ad1 SDJ |
41 | gdb_exit |
42 | gdb_start | |
43 | ||
64c9b639 | 44 | gdb_test_no_output "set remote exec-file $target_binfile" \ |
87215ad1 SDJ |
45 | "set remote exec-file" |
46 | ||
47 | # Make sure we're disconnected, in case we're testing with an | |
48 | # extended-remote board, therefore already connected. | |
d1e36019 | 49 | gdb_test "disconnect" ".*" |
87215ad1 SDJ |
50 | |
51 | # Let's start gdbserver in extended-remote mode now. We cannot | |
52 | # use gdbserver_start_extended here because it starts gdbserver, | |
53 | # then GDB *with* a local binary, and the connect both. | |
54 | set res [gdbserver_start "--multi" ""] | |
55 | set gdbserver_protocol [lindex $res 0] | |
56 | if { [string first "extended-" $gdbserver_protocol] != 0} { | |
57 | set gdbserver_protocol "extended-$gdbserver_protocol" | |
58 | } | |
59 | set gdbserver_gdbport [lindex $res 1] | |
60 | set use_gdb_stub 0 | |
61 | ||
62 | gdb_test "target ${gdbserver_protocol} ${gdbserver_gdbport}" \ | |
c7ab0aef | 63 | "Remote debugging using [string_to_regexp $gdbserver_gdbport]" \ |
87215ad1 SDJ |
64 | "connect to gdbserver" |
65 | ||
66 | gdb_test "run" \ | |
67 | "\\\[Inferior $decimal \\\(process $decimal\\\) exited normally\\\]" \ | |
68 | "run test program until the end" | |
69 | } |