2022-01-01 18:56:03 +04:00
|
|
|
# Copyright 2011-2022 Free Software Foundation, Inc.
|
2013-05-21 17:58:46 +00:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# This file is a dejagnu "board file" and is used to run the testsuite
|
|
|
|
# with a remotehost and gdbserver using stdio for communicating through
|
|
|
|
# ssh. Certain firewalls prevent gdbserver from using the usual mechanism of
|
|
|
|
# listening on a remote port, so use stdio via ssh instead.
|
|
|
|
#
|
|
|
|
# To use this file:
|
|
|
|
# bash$ cd ${build_dir}/gdb
|
|
|
|
# bash$ make check RUNTESTFLAGS="--target_board=remote-stdio-gdbserver \
|
2022-10-29 09:20:36 +02:00
|
|
|
# REMOTE_USERNAME=... REMOTE_HOSTNAME=... \
|
2013-05-21 17:58:46 +00:00
|
|
|
# [REMOTE_TMPDIR=${remote_dir}] [GDBSERVER=${remote_gdbserver}]"
|
|
|
|
|
Make native gdbserver boards no longer be "remote" (in DejaGnu terms)
This commit finally clears the "isremote" flag in the native-gdbserver
and native-stdio-gdbserver boards. The goal is to make all "native"
boards be considered not remote in DejaGnu terms, like the
native-extended-gdbserver board is too.
DejaGnu automatically considers boards remote if their names don't
match the local hostname. That means that native-gdbserver and
native-extended-gdbserver are considered remote by default by DejaGnu,
even though they run locally. native-extended-gdbserver, however,
overrides its isremote flag to force it to be not remote. So we are
in that weird state where native-gdbserver is considered remote, and
native-extended-gdbserver is considered not remote.
A recent set of commits fixed all the problems (and some more) exposed
by testing with --target_board=native-gdbserver and
--target_board=native-stdio-gdbserver with isremote forced off on
x86-64 GNU/Linux. I believe we're good to go now.
The native-stdio-gdbserver.exp/remote-stdio-gdbserver.exp boards
required deep non-obvious modifications unfortunately... The problem
is that if a board is not remote, then DejaGnu doesn't call
${board}_spawn / ${board}_exec at all, and the
native-stdio-gdbserver.exp board relies on those procedures being
called. To fix that, this commit redesigns how the stdio boards hook
into the testing framework to spawn gdbserver. IMO, this is a good
change anyway, because the way its done currently is a bit of a hack,
and the result turns out to be simpler, even. With this commit, they
now no longer load the "gdbserver" generic config, and hook at the
mi_gdb_target_load/gdb_reload level instead, making them more like
traditional board files.
To share code between native-stdio-gdbserver.exp and
remote-stdio-gdbserver.exp, a new shared stdio-gdbserver-base.exp file
is created.
Instead of having each native board clear isremote manually, boards
source the new "local-board.exp" file.
This also adds a new section to testsuite/README file discussing
local/remote/native, so that we can easily refer to it.
gdb/testsuite/ChangeLog:
2017-10-16 Pedro Alves <palves@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca>
* README (Local vs Remote vs Native): New section.
* boards/local-board.exp: New file, with bits factored out from
...
* boards/native-extended-gdbserver.exp: ... here. Load
"local-board".
* boards/native-gdbserver.exp: Load "local-board".
(${board}_spawn, ${board}_exec): Delete.
* boards/native-stdio-gdbserver.exp: Most contents factored out to
...
* boards/stdio-gdbserver-base.exp: ... this new file.
* boards/native-stdio-gdbserver.exp: Reimplement, by loading
"stdio-gdbserver-base" and defining a get_target_remote_pipe_cmd
procedure.
* boards/remote-stdio-gdbserver.exp: Load stdio-gdbserver-base
instead of native-stdio-gdbserver. Don't set gdb_server_prog nor
stdio_gdbserver_command.
(${board}_get_remote_address, ${board}_get_comm_port)
(${board}_download, ${board}_upload): Delete.
(get_target_remote_pipe_cmd): New.
2017-10-16 20:24:21 +01:00
|
|
|
load_board_description "stdio-gdbserver-base"
|
2013-05-21 17:58:46 +00:00
|
|
|
|
|
|
|
# Test machine info. The generic_config gdbserver reads some of these
|
|
|
|
# values from board_info, so this file must set them there.
|
|
|
|
if [info exists REMOTE_USERNAME] {
|
|
|
|
set_board_info username $REMOTE_USERNAME
|
|
|
|
} else {
|
|
|
|
set_board_info username unspecified_username
|
|
|
|
}
|
|
|
|
if [info exists REMOTE_HOSTNAME] {
|
|
|
|
set_board_info hostname $REMOTE_HOSTNAME
|
|
|
|
} else {
|
|
|
|
set_board_info hostname unspecified_hostname
|
|
|
|
}
|
2013-08-29 19:22:06 +00:00
|
|
|
|
2022-10-29 09:20:36 +02:00
|
|
|
set_board_info rsh_prog /usr/bin/ssh
|
|
|
|
set_board_info rcp_prog /usr/bin/scp
|
2013-05-21 17:58:46 +00:00
|
|
|
|
|
|
|
# Some remote machines don't have writable home directories.
|
|
|
|
if [info exists REMOTE_TMPDIR] {
|
|
|
|
set_board_info remotedir $REMOTE_TMPDIR
|
|
|
|
}
|
|
|
|
|
2021-12-10 11:43:20 +00:00
|
|
|
unset_board_info gdb_server_prog
|
|
|
|
if [info exists GDBSERVER] {
|
|
|
|
set_board_info gdb_server_prog $GDBSERVER
|
|
|
|
} else {
|
|
|
|
set_board_info gdb_server_prog /usr/bin/gdbserver
|
|
|
|
}
|
|
|
|
|
2013-05-21 17:58:46 +00:00
|
|
|
proc get_remote_login { } {
|
|
|
|
set result ""
|
|
|
|
if {[board_info [target_info name] exists username]} {
|
|
|
|
append result "[board_info [target_info name] username]@"
|
|
|
|
}
|
|
|
|
if {[board_info [target_info name] exists hostname]} {
|
|
|
|
append result "[board_info [target_info name] hostname]"
|
|
|
|
}
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
Make native gdbserver boards no longer be "remote" (in DejaGnu terms)
This commit finally clears the "isremote" flag in the native-gdbserver
and native-stdio-gdbserver boards. The goal is to make all "native"
boards be considered not remote in DejaGnu terms, like the
native-extended-gdbserver board is too.
DejaGnu automatically considers boards remote if their names don't
match the local hostname. That means that native-gdbserver and
native-extended-gdbserver are considered remote by default by DejaGnu,
even though they run locally. native-extended-gdbserver, however,
overrides its isremote flag to force it to be not remote. So we are
in that weird state where native-gdbserver is considered remote, and
native-extended-gdbserver is considered not remote.
A recent set of commits fixed all the problems (and some more) exposed
by testing with --target_board=native-gdbserver and
--target_board=native-stdio-gdbserver with isremote forced off on
x86-64 GNU/Linux. I believe we're good to go now.
The native-stdio-gdbserver.exp/remote-stdio-gdbserver.exp boards
required deep non-obvious modifications unfortunately... The problem
is that if a board is not remote, then DejaGnu doesn't call
${board}_spawn / ${board}_exec at all, and the
native-stdio-gdbserver.exp board relies on those procedures being
called. To fix that, this commit redesigns how the stdio boards hook
into the testing framework to spawn gdbserver. IMO, this is a good
change anyway, because the way its done currently is a bit of a hack,
and the result turns out to be simpler, even. With this commit, they
now no longer load the "gdbserver" generic config, and hook at the
mi_gdb_target_load/gdb_reload level instead, making them more like
traditional board files.
To share code between native-stdio-gdbserver.exp and
remote-stdio-gdbserver.exp, a new shared stdio-gdbserver-base.exp file
is created.
Instead of having each native board clear isremote manually, boards
source the new "local-board.exp" file.
This also adds a new section to testsuite/README file discussing
local/remote/native, so that we can easily refer to it.
gdb/testsuite/ChangeLog:
2017-10-16 Pedro Alves <palves@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca>
* README (Local vs Remote vs Native): New section.
* boards/local-board.exp: New file, with bits factored out from
...
* boards/native-extended-gdbserver.exp: ... here. Load
"local-board".
* boards/native-gdbserver.exp: Load "local-board".
(${board}_spawn, ${board}_exec): Delete.
* boards/native-stdio-gdbserver.exp: Most contents factored out to
...
* boards/stdio-gdbserver-base.exp: ... this new file.
* boards/native-stdio-gdbserver.exp: Reimplement, by loading
"stdio-gdbserver-base" and defining a get_target_remote_pipe_cmd
procedure.
* boards/remote-stdio-gdbserver.exp: Load stdio-gdbserver-base
instead of native-stdio-gdbserver. Don't set gdb_server_prog nor
stdio_gdbserver_command.
(${board}_get_remote_address, ${board}_get_comm_port)
(${board}_download, ${board}_upload): Delete.
(get_target_remote_pipe_cmd): New.
2017-10-16 20:24:21 +01:00
|
|
|
proc get_target_remote_pipe_cmd { } {
|
|
|
|
set target_exec [gdbserver_download_current_prog]
|
2013-05-21 17:58:46 +00:00
|
|
|
set rsh_cmd "[board_info [target_info name] rsh_prog] [get_remote_login]"
|
2021-12-10 11:43:20 +00:00
|
|
|
set gdbserver "[board_info [target_info name] gdb_server_prog]"
|
|
|
|
return "$rsh_cmd $gdbserver --once stdio $target_exec"
|
2013-05-21 17:58:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc ${board}_file { dest op args } {
|
|
|
|
if { $op == "delete" } {
|
2018-03-08 17:54:25 -05:00
|
|
|
return [remote_exec target "rm -f $args"]
|
2013-05-21 17:58:46 +00:00
|
|
|
}
|
|
|
|
return [eval [list standard_file $dest $op] $args]
|
|
|
|
}
|
2022-10-29 09:43:32 +02:00
|
|
|
|
|
|
|
proc ${board}_spawn { board cmd } {
|
|
|
|
global board_info
|
|
|
|
|
|
|
|
set remote [board_info $board hostname]
|
|
|
|
set username [board_info $board username]
|
|
|
|
set RSH [board_info $board rsh_prog]
|
|
|
|
|
|
|
|
spawn $RSH -t -l $username $remote $cmd
|
|
|
|
set board_info($board,fileid) $spawn_id
|
|
|
|
return $spawn_id
|
|
|
|
}
|