[gdb/testsuite] Bail out after gdb_start error in gdb.threads/attach-slow-waitpid.exp

When building gdb using CFLAGS/CXXFLAGS+=-fsanitizer=address and
LDFLAGS+=-lasan, and running test-case gdb.threads/attach-slow-waitpid.exp,
we get:
...
spawn gdb -nw -nx -data-directory data-directory^M
==16079==ASan runtime does not come first in initial library list; \
  you should either link runtime to your application or manually preload \
  it with LD_PRELOAD.^M
ERROR: (eof) GDB never initialized.
ERROR: : spawn id exp10 not open
    while executing
"expect {
-i exp10 -timeout 120
        -re "Kill the program being debugged. .y or n. $" {
            send_gdb "y\n" answer
            verbose "\t\tKilling previous pro..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $body" NONE : spawn id exp10 not open
WARNING: remote_expect statement without a default case
ERROR: : spawn id exp10 not open
    while executing
"expect {
-i exp10 -timeout 120
        -re "Reading symbols from.*LZMA support was disabled.*$gdb_prompt $" {
            verbose "\t\tLoaded $arg into $GDB; .gnu_..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $body" NONE : spawn id exp10 not open
ERROR: Couldn't load attach-slow-waitpid into GDB (eof).
ERROR: Couldn't send attach 16070 to GDB.
UNRESOLVED: gdb.threads/attach-slow-waitpid.exp: attach to target
...

Bail out at the first ERROR, such that we have instead:
...
ERROR: (eof) GDB never initialized.
UNTESTED: gdb.threads/attach-slow-waitpid.exp: \
  Couldn't start GDB with preloaded lib
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-07-20  Tom de Vries  <tdevries@suse.de>

	* gdb.threads/attach-slow-waitpid.exp: Bail out if gdb_start fails.
This commit is contained in:
Tom de Vries
2020-07-20 10:54:31 +02:00
parent b3983e5f53
commit 6e22f11784
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2020-07-20 Tom de Vries <tdevries@suse.de>
* gdb.threads/attach-slow-waitpid.exp: Bail out if gdb_start fails.
2020-07-17 Tom de Vries <tdevries@suse.de> 2020-07-17 Tom de Vries <tdevries@suse.de>
* gdb.base/valgrind-infcall-2.c: New test. * gdb.base/valgrind-infcall-2.c: New test.

View File

@ -88,7 +88,12 @@ set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id] set testpid [spawn_id_get_pid $test_spawn_id]
# Start GDB with preload library in place. # Start GDB with preload library in place.
gdb_spawn_with_ld_preload $libobj if { [gdb_spawn_with_ld_preload $libobj] == -1 } {
# Make sure we get UNTESTED rather than UNRESOLVED.
set errcnt 0
untested "Couldn't start GDB with preloaded lib"
return -1
}
# Load binary, and attach to running program. # Load binary, and attach to running program.
gdb_load ${binfile} gdb_load ${binfile}