diff options
author | Tom de Vries <tdevries@suse.de> | 2021-06-07 15:46:34 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-06-07 15:46:34 +0200 |
commit | b0e2f96b56b5bbddcd60ca87a0517a460d03dfb4 (patch) | |
tree | 0f2e6df22c3d8980f9030e5360ecdca42def900e | |
parent | 409cac34d9328d81ff7d17a51707e7898a7be960 (diff) | |
download | binutils-b0e2f96b56b5bbddcd60ca87a0517a460d03dfb4.zip binutils-b0e2f96b56b5bbddcd60ca87a0517a460d03dfb4.tar.gz binutils-b0e2f96b56b5bbddcd60ca87a0517a460d03dfb4.tar.bz2 |
[gdb/testsuite] Fix gdb.base/run-attach-while-running.exp
With a testsuite setup modified to make expect wait a little bit longer for
gdb output (see PR27957), I reliably run into:
...
27 return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
(gdb) ^M
Thread 2 "run-attach-whil" stopped.^M
0x00007f13c85a74c0 in __GI___nanosleep () at nanosleep.c:27^M
27 return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
FAIL: gdb.base/run-attach-while-running.exp: threaded=1: \
run-or-attach=attach: non-stop=on: test: attach to process (timeout)
...
The problem is that we're trying to match the gdb_prompt using gdb_test which
uses '$gdb_prompt $'. The terminating '$' prevents the match.
Fix this by rewriting the gdb_test into a gdb_test_multiple and dropping the
'$'.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-07 Tom de Vries <tdevries@suse.de>
PR testsuite/27908
* gdb.base/run-attach-while-running.exp (test): Don't match prompt
after attach using '$gdb_prompt $'.
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/run-attach-while-running.exp | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 75e500a..1524b82 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2021-06-07 Tom de Vries <tdevries@suse.de> + PR testsuite/27908 + * gdb.base/run-attach-while-running.exp (test): Don't match prompt + after attach using '$gdb_prompt $'. + +2021-06-07 Tom de Vries <tdevries@suse.de> + * gdb.base/info-types.exp.tcl: Remove "File .*" matching from regexp matching state machine. diff --git a/gdb/testsuite/gdb.base/run-attach-while-running.exp b/gdb/testsuite/gdb.base/run-attach-while-running.exp index 7c16aa6..1cc754a 100644 --- a/gdb/testsuite/gdb.base/run-attach-while-running.exp +++ b/gdb/testsuite/gdb.base/run-attach-while-running.exp @@ -33,6 +33,8 @@ unset binfile # - run-or-attach: "run" or "attach" proc_with_prefix test { non-stop threaded run-or-attach } { + global gdb_prompt + if { ${run-or-attach} == "attach" && ![can_spawn_for_attach] } { unsupported "attach not supported" return @@ -91,7 +93,11 @@ proc_with_prefix test { non-stop threaded run-or-attach } { set test_spawn_id [spawn_wait_for_attach $::binfile] set test_pid [spawn_id_get_pid $test_spawn_id] - gdb_test "attach $test_pid" "Attaching to program: .*" "attach to process" + gdb_test_multiple "attach $test_pid" "attach to process" { + -re "Attaching to program: .*$gdb_prompt " { + pass $gdb_test_name + } + } gdb_exit kill_wait_spawned_process $test_spawn_id |