]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog-2014-2021
testsuite: Introduce $inferior_spawn_id
authorPedro Alves <palves@redhat.com>
Tue, 7 Apr 2015 17:19:30 +0000 (18:19 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 7 Apr 2015 17:28:38 +0000 (18:28 +0100)
commitf71c18e755dac28c61a5e5c94fbc8a84eb573679
tree6fe77f411bef994213c7e43c959b681f3fbd8c9e
parent6423214fcb912a5d402ffcb84d6f61f2b900a900
testsuite: Introduce $inferior_spawn_id

Some important tests, like gdb.base/interrupt.exp end up skipped
against gdbserver, because they depend on inferior I/O, which
gdbserver doesn't do.

This patch adds a mechanism that makes it possible to make them work.
It adds a new "inferior_spawn_id" global that is the spawn ID used for
I/O interaction with the inferior.  By default, for native targets, or
remote targets that can do I/O through GDB (semi-hosting) this will be
the same as the gdb/host spawn ID.  Otherwise, the board may set this
to some other spawn ID.  When debugging with GDBserver, this will be
set to GDBserver's spawn ID.

Then tests can use send_inferior instead of send_gdb to send input to
the inferior, and use expect's "-i" switch to select which spawn ID to
use for matching input/output.  That is, something like this will now
work:

  send_inferior "echo me\n"
  gdb_test_multiple "continue" "test msg" {
    -i "$inferior_spawn_id" -re "echo me\r\necho\r\n" {
      ...
    }
  }

Or even:

  gdb_test_multiple "continue" "test msg" {
    -i "$inferior_spawn_id" -re "hello world" {
      ...
    }
    -i "$gdb_spawn_id" -re "error.*$gdb_prompt $" {
      ...
    }
  }

Of course, by default, gdb_test_multiple still matches with
$gdb_spawn_id.

gdb/testsuite/ChangeLog:
2015-04-07  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (inferior_spawn_id): New global.
(gdb_test_multiple): Handle "-i".  Reset the spawn id to GDB's
spawn id after processing the user code.
(default_gdb_start): Set inferior_spawn_id.
(send_inferior): New procedure.
* lib/gdbserver-support.exp (gdbserver_start): Set
inferior_spawn_id.
(close_gdbserver, gdb_exit): Unset inferior_spawn_id.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp
gdb/testsuite/lib/gdbserver-support.exp