8sa1-binutils-gdb/gdb/testsuite/lib
Tom de Vries 2016d3e60f [gdb/testsuite] Reduce errors after gdb exit in default_gdb_start
When running test-case gdb.base/readnever.exp with target board readnow, and
without commit 96038148d0 "[gdb/testsuite] Skip gdb.base/readnever.exp with
target board readnow", we run into a bunch of errors, starting with:
...
spawn gdb -nw -nx -data-directory data-directory -ex set sysroot -readnow \
  --readnever^M
gdb: '--readnow' and '--readnever' cannot be specified simultaneously^M
ERROR: : spawn id exp9 not open
    while executing
"expect {
-i exp9 -timeout 10
        -re "$gdb_prompt $" {
            verbose "Setting height to 0." 2
        }
...

The illegal combination of --readnow and --readnever causes gdb to start,
print an error message and exit.  There's a gdb_expect in default_gdb_start
that is supposed to detect the initial gdb prompt and handle related problems,
but since there's no eof case it succeeds, and default_gdb_start continues as
if the gdb prompt had been detected, causing the error above.

Fix this by adding an eof case to the gdb_expect, such that we have the more
accurate:
...
ERROR: (eof) GDB never initialized.
...

Further errors are triggered in clean_restart, because we're not testing for
gdb_start success.  Fix this by detecting gdb_start failure, and bailing out.

Finally, we're running into further errors in gdb.base/readnever.exp because
we're not testing for clean_restart success.  Fix this by making clean_restart
return -1 upon error, and testing for this.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-04-24  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (default_gdb_start): Handle eof.
	(clean_restart): Detect and handle gdb_start failure.  Return -1 upon
	failure.
	* gdb.base/readnever.exp: Handle clean_restart failure.
2020-04-24 12:21:49 +02:00
..
ada.exp [gdb/testsuite] Fix gdb.ada/catch_ex_std.exp gnatlink FAIL 2020-04-13 18:53:14 +02:00
append_gdb_boards_dir.exp
build-piece.exp
cache.exp [gdb/testsuite] Add cache_verify option for gdb_caching_procs 2020-03-16 14:39:07 +01:00
cl_util.c
cl_util.h
compile-support.exp
compiler.c
compiler.cc
completion-support.exp [gdb/testsuite] Give up after consecutive timeouts in completion-support.exp 2020-03-17 08:56:35 +01:00
cp-support.exp
d-support.exp
data-structures.exp
dtrace.exp
dwarf.exp gdb/testsuite: Move helper function into lib/dwarf.exp 2020-04-14 12:13:06 +01:00
fortran.exp
future.exp
gdb-guile.exp
gdb-python.exp
gdb-utils.exp
gdb.exp [gdb/testsuite] Reduce errors after gdb exit in default_gdb_start 2020-04-24 12:21:49 +02:00
gdbserver-support.exp [gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp 2020-04-02 09:46:00 +02:00
gen-perf-test.exp
gnat_debug_info_test.adb
go.exp
memory.exp
mi-support.exp
objc.exp
opencl_hostapp.c
opencl_kernel.cl
opencl.exp
pascal.exp
pdtrace.in
perftest.exp
prelink-support.exp
prompt.exp
range-stepping-support.exp
read1.c
rust-support.exp
selftest-support.exp
set_unbuffered_mode.c
sym-info-cmds.exp
trace-support.exp
tuiterm.exp
unbuffer_output.c
valgrind.exp