public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.multi/attach-no-multi-process.exp with check-readmore
Date: Sun, 1 May 2022 18:07:09 +0200	[thread overview]
Message-ID: <20220501160708.GA18741@delia.home> (raw)

Hi,

When running test-case gdb.multi/attach-no-multi-process.exp with
check-readmore, I get:
...
(gdb) attach 13411^M
Attaching to Remote target^M
No unwaited-for children left.^M
(gdb) Reading symbols from attach-no-multi-process...^M
Reading symbols from /lib64/libm.so.6...^M
(No debugging symbols found in /lib64/libm.so.6)^M
Reading symbols from /lib64/libc.so.6...^M
(No debugging symbols found in /lib64/libc.so.6)^M
Reading symbols from /lib64/ld-linux-x86-64.so.2...^M
(No debugging symbols found in /lib64/ld-linux-x86-64.so.2)^M
0x00007f5df1fffc8a in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6^M
FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: \
  attach to the program via remote (timeout)
...

The problem is that the attach output is matched using gdb_test, which uses
the '$gdb_prompt $' regexp, and this does not handle the case that '(gdb) ' is
not the last available output.

Fix this by using a gdb_test_multiple instead with a '$gdb_prompt ' regexp, so
without the '$' anchor.

Tested on x86_64-linux with native, check-read1 and check-readmore.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.multi/attach-no-multi-process.exp with check-readmore

---
 gdb/testsuite/gdb.multi/attach-no-multi-process.exp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.multi/attach-no-multi-process.exp b/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
index 081579fb964..66b210f882c 100644
--- a/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
+++ b/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
@@ -32,6 +32,7 @@ if {[build_executable "build" $testfile $srcfile {debug}] == -1} {
 
 proc test {target_non_stop} {
     global binfile
+    global gdb_prompt
 
     save_vars { ::GDBFLAGS } {
 	# If GDB and GDBserver are both running locally, set the sysroot to avoid
@@ -64,9 +65,11 @@ proc test {target_non_stop} {
     set spawn_id_list [spawn_wait_for_attach [list $binfile]]
     set test_spawn_id [lindex $spawn_id_list 0]
     set testpid [spawn_id_get_pid $test_spawn_id]
-    gdb_test "attach $testpid" \
-	"Attaching to Remote target.*" \
-	"attach to the program via remote"
+    gdb_test_multiple "attach $testpid" "attach to the program via remote" {
+	-re "Attaching to Remote target.*\[\r\n\]+$gdb_prompt " {
+	    pass $gdb_test_name
+	}
+    }
 
     # Check that we have two threads.  Bad GDB duplicated the
     # thread coming from the remote when target-non-stop is off;

                 reply	other threads:[~2022-05-01 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220501160708.GA18741@delia.home \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).