binutils-gdb/gdb/testsuite/lib
Anders Granlund 717cf30c82 Introduce gdb_interact in testsuite
gdb_interact is a small utility that we have found quite useful to debug
test cases.

Putting gdb_interact in a test suspends it and allows to interact with
gdb to inspect whatever you want. You can then type ">>>" to resume the
test execution. Of course, this is only for gdb devs. It wouldn't make
sense to leave a gdb_interact permanently in a test case.

When starting the interaction with the user, the script prints this
banner:

+------------------------------------------+
| Script interrupted, you can now interact |
| with by gdb. Type >>> to continue.       |
+------------------------------------------+

Notes:
* When gdb is launched, the gdb_spawn_id variable (lib/gdb.exp) is
  assigned -1. Given the name, I would expect it to contain the gdb
  expect spawn id, which is needed for interact. I changed all places
  that set gdb_spawn_id to -1 to set it to the actual gdb spawn id
  instead.

* When entering the "interact" mode, the last (gdb) prompt is already
  eaten by expect, so it doesn't show up on the terminal. Subsequent
  prompts do appear though. We tried to print "(gdb)" just before the
  interact to replace it. However, it could be misleading if you are
  debugging an MI test case, it makes you think that you are typing in a
  CLI prompt, when in reality it's MI. In the end I decided that since
  the feature is for developers who know what they're doing and that one
  is normally consciously using gdb_interact, the script doesn't need
  to babysit the user.

* There are probably some quirks depending on where in the script
  gdb_interact appears (e.g. it could interfere with following
  commands and make them fail), but it works for most cases. Quirks can
  always be fixed later.

The idea and original implementation was contributed by Anders
Granlund, a colleague of mine. Thanks to him.

gdb/testsuite/ChangeLog:

	* gdb.base/statistics.exp: Assign spawn id to gdb_spawn_id.
	* gdb.base/valgrind-db-attach.exp: Same.
	* gdb.base/valgrind-infcall.exp: Same.
	* lib/mi-support.exp (default_mi_gdb_start): Same.
	* lib/prompt.exp (default_prompt_gdb_start): Same.
	* lib/gdb.exp (default_gdb_spawn): Same.
	(gdb_interact): New.
2015-01-22 15:49:08 -05:00
..
ada.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
append_gdb_boards_dir.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
cache.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
cell.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
cl_util.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
cl_util.h Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
compiler.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
compiler.cc Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
cp-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
d-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
dwarf.exp Require numeric attributes to specify the form. 2015-01-11 15:45:43 -08:00
fortran.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
future.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
gdb-guile.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
gdb-python.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
gdb-utils.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
gdb.exp Introduce gdb_interact in testsuite 2015-01-22 15:49:08 -05:00
gdbserver-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
go.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
java.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
mi-support.exp Introduce gdb_interact in testsuite 2015-01-22 15:49:08 -05:00
objc.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
opencl.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
opencl_hostapp.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
opencl_kernel.cl gdb: 2010-11-05 14:31:30 +00:00
pascal.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
perftest.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
prelink-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
prompt.exp Introduce gdb_interact in testsuite 2015-01-22 15:49:08 -05:00
range-stepping-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
read1.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
selftest-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
set_unbuffered_mode.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
trace-support.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00