diff options
author | Tom de Vries <tdevries@suse.de> | 2020-04-24 12:21:49 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-04-24 12:21:49 +0200 |
commit | 2016d3e60f871ea77fb089b5bc7bcfacffab1eab (patch) | |
tree | 0d73d7da4ff4f4a925d4496c7bab510259258ddd /gdb/testsuite/gdb.base | |
parent | f80cb3b46ae19c6a7c39916916374410f5cc37bc (diff) | |
download | binutils-gdb-2016d3e60f871ea77fb089b5bc7bcfacffab1eab.tar.gz |
[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 96038148d0e "[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.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/readnever.exp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/readnever.exp b/gdb/testsuite/gdb.base/readnever.exp index ab2e18e2260..113176c1789 100644 --- a/gdb/testsuite/gdb.base/readnever.exp +++ b/gdb/testsuite/gdb.base/readnever.exp @@ -29,7 +29,9 @@ if { [lsearch -exact $GDBFLAGS -readnow] != -1 \ save_vars { GDBFLAGS } { append GDBFLAGS " --readnever" - clean_restart ${binfile} + if { [clean_restart ${binfile}] == -1 } { + return -1 + } } if ![runto_main] then { |