Make native gdbserver boards no longer be "remote" (in DejaGnu terms)
authorPedro Alves <palves@redhat.com>
Mon, 16 Oct 2017 19:24:21 +0000 (20:24 +0100)
committerPedro Alves <palves@redhat.com>
Mon, 16 Oct 2017 19:24:21 +0000 (20:24 +0100)
commit739b3f1d8ff7072dcc66240c25b026c6433bda1a
tree5ed793149e700f8b248d3bfb43051b28ca195cb1
parentfe68b9530f6ec45d57838b96dbe11723b90467f4
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.
gdb/testsuite/ChangeLog
gdb/testsuite/README
gdb/testsuite/boards/local-board.exp [new file with mode: 0644]
gdb/testsuite/boards/native-extended-gdbserver.exp
gdb/testsuite/boards/native-gdbserver.exp
gdb/testsuite/boards/native-stdio-gdbserver.exp
gdb/testsuite/boards/remote-stdio-gdbserver.exp
gdb/testsuite/boards/stdio-gdbserver-base.exp [new file with mode: 0644]