]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.server/server-pipe.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.server / server-pipe.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2022-2024 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 starting gdbserver using the 'target remove | ....' syntax.
19 # The extended-remote target type is tested too. The test checks that
20 # the `|` character can be seen in the 'info connections' output, and
21 # (when Python is available) in the gdb.TargetConnection.details
22 # string.
23
24 # This test relies on starting gdbserver using the pipe syntax. Not
25 # sure how well this will run if part of this test is being run
26 # elsewhere.
27 require {!is_remote target} {!is_remote host}
28
29 load_lib gdbserver-support.exp
30
31 standard_testfile
32
33 require allow_gdbserver_tests
34
35 set gdbserver [find_gdbserver]
36 if { $gdbserver == "" } {
37 unsupported "could not find gdbserver"
38 return
39 }
40
41 standard_testfile normal.c
42 set executable ${testfile}
43
44 if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
45 return -1
46 }
47
48 # Start GDB using remote type TARGET, which should be either "remote"
49 # or "extended-remote". Check the output of 'info connections', and
50 # the contents of the gdb.TargetConnection.details string.
51 proc do_test { target } {
52 clean_restart ${::binfile}
53
54 # Make sure we're disconnected, in case we're testing with an
55 # extended-remote board, therefore already connected.
56 gdb_test "disconnect" ".*"
57
58 gdb_test "target ${target} | ${::gdbserver} - ${::binfile}" ".*" \
59 "start gdbserver using pipe syntax"
60
61 gdb_breakpoint main
62 gdb_continue_to_breakpoint main
63 gdb_test "info frame" ".* in main .*"
64
65 gdb_test "info connections" "${target} \| ${::gdbserver} - ${::binfile} \[^\r\n\]+"
66
67 if { [allow_python_tests] } {
68 gdb_test_no_output "python conn = gdb.selected_inferior().connection"
69 gdb_test "python print(conn.details)" "\| ${::gdbserver} - ${::binfile}"
70 }
71 }
72
73 save_vars { GDBFLAGS } {
74 set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
75
76 # Test with the two remote protocol types.
77 foreach_with_prefix target { remote extended-remote } {
78 do_test ${target}
79 }
80 }