]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2015-2024 Free Software Foundation, Inc. |
3d40fbb5 PA |
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 | # Check that we can connect to GDBserver with the multiprocess | |
e7af6c70 | 17 | # extensions disabled, run to main, and finish the process. |
3d40fbb5 PA |
18 | |
19 | load_lib gdbserver-support.exp | |
20 | ||
cadfc59b | 21 | require allow_gdbserver_tests |
3d40fbb5 PA |
22 | |
23 | standard_testfile | |
24 | ||
25 | if {[build_executable "failed to prepare" $testfile $srcfile debug]} { | |
26 | return -1 | |
27 | } | |
28 | ||
29 | # Test spawning gdbserver with a program, connect to it and run to | |
30 | # main, with both multiprocess extensions on and off. | |
31 | proc do_test {multiprocess} { | |
8dc558a0 | 32 | global binfile GDBFLAGS |
3d40fbb5 | 33 | |
8dc558a0 SM |
34 | save_vars { GDBFLAGS } { |
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 "$GDBFLAGS -ex \"set sysroot\"" | |
39 | } | |
40 | ||
41 | clean_restart $binfile | |
42 | } | |
3d40fbb5 PA |
43 | |
44 | # Make sure we're disconnected, in case we're testing with an | |
45 | # extended-remote board, therefore already connected. | |
46 | gdb_test "disconnect" ".*" | |
47 | ||
ff52c073 CS |
48 | gdb_test \ |
49 | "set remote multiprocess-feature $multiprocess" \ | |
50 | "Support for the 'multiprocess-feature' packet on future remote targets is set to \"$multiprocess\"." | |
3d40fbb5 | 51 | |
e9d9abd7 | 52 | set res [gdbserver_spawn ""] |
3d40fbb5 PA |
53 | set gdbserver_protocol [lindex $res 0] |
54 | set gdbserver_gdbport [lindex $res 1] | |
55 | ||
e777225b | 56 | gdb_test "break -q main" "Breakpoint .*" |
3d40fbb5 PA |
57 | |
58 | gdb_test "target $gdbserver_protocol $gdbserver_gdbport" \ | |
59 | "Remote debugging using .*" \ | |
60 | "target $gdbserver_protocol" | |
61 | ||
62 | gdb_test "continue" "main .*" "continue to main" | |
e7af6c70 TBA |
63 | |
64 | # The W/X packets do not include the PID of the exiting process | |
65 | # without the multi-process extensions. Check that we handle | |
66 | # process exit correctly in that case. | |
67 | gdb_continue_to_end | |
3d40fbb5 PA |
68 | } |
69 | ||
70 | foreach multiprocess { "off" "auto" } { | |
71 | with_test_prefix "multiprocess=$multiprocess" { | |
72 | do_test $multiprocess | |
73 | } | |
74 | } |