GDB copyright headers update after running GDB's copyright.py script.
[deliverable/binutils-gdb.git] / gdb / testsuite / boards / remote-stdio-gdbserver.exp
CommitLineData
618f726f 1# Copyright 2011-2016 Free Software Foundation, Inc.
69a97597
SA
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# This file is a dejagnu "board file" and is used to run the testsuite
17# with a remotehost and gdbserver using stdio for communicating through
18# ssh. Certain firewalls prevent gdbserver from using the usual mechanism of
19# listening on a remote port, so use stdio via ssh instead.
20#
21# To use this file:
22# bash$ cd ${build_dir}/gdb
23# bash$ make check RUNTESTFLAGS="--target_board=remote-stdio-gdbserver \
24# REMOTE_USERNAME=... REMOTE_HOSTNAME=... REMOTE_PORTNUM=... \
25# [REMOTE_TMPDIR=${remote_dir}] [GDBSERVER=${remote_gdbserver}]"
26
27load_board_description "native-stdio-gdbserver"
28
69a97597
SA
29# Test machine info. The generic_config gdbserver reads some of these
30# values from board_info, so this file must set them there.
31if [info exists REMOTE_USERNAME] {
32 set_board_info username $REMOTE_USERNAME
33} else {
34 set_board_info username unspecified_username
35}
36if [info exists REMOTE_HOSTNAME] {
37 set_board_info hostname $REMOTE_HOSTNAME
38} else {
39 set_board_info hostname unspecified_hostname
40}
489d4f4d
SA
41
42# The two programs have different syntax to set the remote port, so
43# set it as part of the program name rather than in get_remote_login.
44
69a97597
SA
45if [info exists REMOTE_PORTNUM] {
46 set_board_info portnum $REMOTE_PORTNUM
489d4f4d
SA
47 set_board_info rsh_prog "/usr/bin/ssh -p$REMOTE_PORTNUM"
48 set_board_info rcp_prog "/usr/bin/scp -P$REMOTE_PORTNUM"
49} else {
50 set_board_info rsh_prog /usr/bin/ssh
51 set_board_info rcp_prog /usr/bin/scp
69a97597
SA
52}
53
54# Some remote machines don't have writable home directories.
55if [info exists REMOTE_TMPDIR] {
56 set_board_info remotedir $REMOTE_TMPDIR
57}
58
59unset_board_info gdb_server_prog
60set_board_info gdb_server_prog "/usr/bin/gdbserver"
61
62# Used to pass a value between ${board}_spawn and ${board}_get_remote_address.
63set stdio_gdbserver_command "--unset--"
64
65proc get_remote_login { } {
66 set result ""
67 if {[board_info [target_info name] exists username]} {
68 append result "[board_info [target_info name] username]@"
69 }
70 if {[board_info [target_info name] exists hostname]} {
71 append result "[board_info [target_info name] hostname]"
72 }
69a97597
SA
73 return $result
74}
75
ab19de87
DE
76proc ${board}_get_remote_address { host port } {
77 global stdio_gdbserver_command
69a97597 78 set rsh_cmd "[board_info [target_info name] rsh_prog] [get_remote_login]"
ab19de87
DE
79 return "| $rsh_cmd $stdio_gdbserver_command"
80}
69a97597 81
ab19de87
DE
82proc ${board}_get_comm_port { port } {
83 return $port
69a97597
SA
84}
85
86proc ${board}_download { board host dest } {
87 if { [board_info [target_info name] exists remotedir] } {
88 set remotedir "[board_info [target_info name] remotedir]/"
89 } else {
90 set remotedir ""
91 }
92 return [standard_download $board $host "$remotedir$dest"]
93}
94
95proc ${board}_upload {dest srcfile args} {
96 return [standard_upload $dest $srcfile $args]
97}
98
99proc ${board}_file { dest op args } {
100 if { $op == "delete" } {
101 return [remote_exec [get_remote_login] "rm -f $args"]
102 }
103 return [eval [list standard_file $dest $op] $args]
104}
This page took 0.358216 seconds and 4 git commands to generate.