From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 960983858D33; Sun, 1 May 2022 16:06:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 960983858D33 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.multi/attach-no-multi-process.exp with check-readmore X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: e9c5fe2f40e7da0f104624ee81c9720a7956e64c X-Git-Newrev: 94afbc7b1b27f03974133b3d620470e9725a21df Message-Id: <20220501160647.960983858D33@sourceware.org> Date: Sun, 1 May 2022 16:06:47 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2022 16:06:47 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D94afbc7b1b27= f03974133b3d620470e9725a21df commit 94afbc7b1b27f03974133b3d620470e9725a21df Author: Tom de Vries Date: Sun May 1 18:06:44 2022 +0200 [gdb/testsuite] Fix gdb.multi/attach-no-multi-process.exp with check-re= admore =20 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.s= o.6^M FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=3Doff: \ attach to the program via remote (timeout) ... =20 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 '(gd= b) ' is not the last available output. =20 Fix this by using a gdb_test_multiple instead with a '$gdb_prompt ' reg= exp, so without the '$' anchor. =20 Tested on x86_64-linux with native, check-read1 and check-readmore. Diff: --- 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/test= suite/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}]= =3D=3D -1} { =20 proc test {target_non_stop} { global binfile + global gdb_prompt =20 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 + } + } =20 # Check that we have two threads. Bad GDB duplicated the # thread coming from the remote when target-non-stop is off;