]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - 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
CommitLineData
cced7cac
AB
1# This testcase is part of GDB, the GNU debugger.
2
213516ef 3# Copyright 2022-2023 Free Software Foundation, Inc.
cced7cac
AB
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.
27if { [is_remote target] || [is_remote host] } {
28 return 0
29}
30
31load_lib gdbserver-support.exp
32
33standard_testfile
34
35if { [skip_gdbserver_tests] } {
36 return 0
37}
38
39set gdbserver [find_gdbserver]
40if { $gdbserver == "" } {
41 unsupported "could not find gdbserver"
42 return
43}
44
45standard_testfile normal.c
46set executable ${testfile}
47
48if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
49 return -1
50}
51
52# Start GDB using remote type TARGET, which should be either "remote"
53# or "extended-remote". Check the output of 'info connections', and
54# the contents of the gdb.TargetConnection.details string.
55proc do_test { target } {
56 clean_restart ${::binfile}
57
58 # Make sure we're disconnected, in case we're testing with an
59 # extended-remote board, therefore already connected.
60 gdb_test "disconnect" ".*"
61
62 gdb_test "target ${target} | ${::gdbserver} - ${::binfile}" ".*" \
63 "start gdbserver using pipe syntax"
64
65 gdb_breakpoint main
66 gdb_continue_to_breakpoint main
67 gdb_test "info frame" ".* in main .*"
68
69 gdb_test "info connections" "${target} \| ${::gdbserver} - ${::binfile} \[^\r\n\]+"
70
71 if { ![skip_python_tests] } {
72 gdb_test_no_output "python conn = gdb.selected_inferior().connection"
73 gdb_test "python print(conn.details)" "\| ${::gdbserver} - ${::binfile}"
74 }
75}
76
d3b61062
AB
77save_vars { GDBFLAGS } {
78 set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
79
80 # Test with the two remote protocol types.
81 foreach_with_prefix target { remote extended-remote } {
82 do_test ${target}
83 }
cced7cac 84}