Home | History | Annotate | Line # | Download | only in boards
remote-gdbserver-on-localhost.exp revision 1.1.1.5.2.1
      1 # Copyright 2015-2023 Free Software Foundation, Inc.
      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 remote gdbserver on localhost.
     18 #
     19 # To use this file:
     20 # bash$ cd ${build_dir}/gdb
     21 # bash$ make check RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost
     22 #   [ REMOTE_TARGET_USERNAME=<remote_target_username> ]"
     23 
     24 load_generic_config "gdbserver"
     25 load_board_description "gdbserver-base"
     26 
     27 # The sshd should be running on localhost and ssh key should be
     28 # correctly set up that you ssh to localhost without having to type
     29 # password.
     30 set_board_info rcp_prog "/usr/bin/scp"
     31 set_board_info rsh_prog "/usr/bin/ssh"
     32 set_board_info protocol standard
     33 if { [info exists REMOTE_TARGET_USERNAME] } {
     34     set_board_info username $REMOTE_TARGET_USERNAME
     35 } else {
     36     set_board_info username $env(USER)
     37 }
     38 set_board_info hostname localhost
     39 
     40 # Handle separate test account.
     41 if { [board_info $board username] != $env(USER) } {
     42     # We're pretending that some local user account is remote target.
     43     # Make things a bit more realistic by restricting file permissions.
     44 
     45     # Make sure remote target can't see files on build.
     46     remote_exec build "chmod go-rx $objdir"
     47 
     48     # Make sure build can't see files on remote target.  We can't use
     49     # remote_exec target, because we're in the middle of parsing the
     50     # target board.
     51     remote_exec build \
     52 	"[board_info $board rsh_prog] \
     53 		     -l [board_info $board username] \
     54 			[board_info $board hostname] \
     55 	chmod go-rx ."
     56 }
     57 
     58 proc ${board}_spawn { board cmd } {
     59     global board_info
     60 
     61     set remote [board_info $board hostname]
     62     set username [board_info $board username]
     63     set RSH [board_info $board rsh_prog]
     64 
     65     spawn $RSH -t -l $username $remote $cmd
     66     set board_info($board,fileid) $spawn_id
     67     return $spawn_id
     68 }
     69 
     70 # We will be using the standard GDB remote protocol
     71 set_board_info gdb_protocol "remote"
     72 
     73 # Use techniques appropriate to a stub
     74 set_board_info use_gdb_stub 1
     75 
     76 # This gdbserver can only run a process once per session.
     77 set_board_info gdb,do_reload_on_run 1
     78 
     79 # There's no support for argument-passing (yet).
     80 set_board_info noargs 1
     81 
     82 set_board_info exit_is_reliable 1
     83