old-cross-binutils/gdb/testsuite/lib
Pedro Alves f71c18e755 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.
2015-04-07 18:28:38 +01:00
..
ada.exp
append_gdb_boards_dir.exp
cache.exp
cell.exp
cl_util.c
cl_util.h
compiler.c
compiler.cc
cp-support.exp
d-support.exp
dtrace.exp
dwarf.exp dwarf.exp: Allow generating a stub .debug_line section 2015-03-31 16:25:07 +02:00
fortran.exp
future.exp
gdb-guile.exp
gdb-python.exp
gdb-utils.exp
gdb.exp testsuite: Introduce $inferior_spawn_id 2015-04-07 18:28:38 +01:00
gdbserver-support.exp testsuite: Introduce $inferior_spawn_id 2015-04-07 18:28:38 +01:00
go.exp
java.exp
mi-support.exp Accept all-stop alternative in mi_expect_interrupt 2015-03-04 17:56:58 -05:00
objc.exp
opencl.exp
opencl_hostapp.c
opencl_kernel.cl
pascal.exp * lib/pascal.exp (gpc_compile): Rename dest arg to destfile. 2015-04-06 08:45:06 -07:00
pdtrace.in
perftest.exp
prelink-support.exp
prompt.exp
range-stepping-support.exp
read1.c
selftest-support.exp
set_unbuffered_mode.c
trace-support.exp
unbuffer_output.c