From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 6E1A43856DC8; Tue, 25 Oct 2022 14:37:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E1A43856DC8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666708653; bh=Y5OE5V4dvqbrQvK+C44Nm2FN/2wByoE7Gw6es/DqjEw=; h=From:To:Subject:Date:From; b=DpolTp4wlF/9VpyIdznHusmZky8fCemvaXJ8vhdNKX1UKkxf+V//s5ipwwxpLlLtI oloCqN499tLfPieZq17CgYUelpQioTgCaEdqPz4DfHAApIZowXbkdyHhx/lbRtfOyQ Qb447/xueHbsJRwJD6v9bg/iR56FAPBWQKo3O3bc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: make sure to consume the prompt in gdb.base/unwind-on-each-insn.exp X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 0f2cd53cf4f730136e2b275e8279d8bc348a9a88 X-Git-Newrev: 7699dfc8d5896556e700bd6cb36d76dd43252e98 Message-Id: <20221025143733.6E1A43856DC8@sourceware.org> Date: Tue, 25 Oct 2022 14:37:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7699dfc8d589= 6556e700bd6cb36d76dd43252e98 commit 7699dfc8d5896556e700bd6cb36d76dd43252e98 Author: Simon Marchi Date: Tue Oct 25 09:50:56 2022 -0400 gdb/testsuite: make sure to consume the prompt in gdb.base/unwind-on-ea= ch-insn.exp =20 This test fails quite reliably for me when ran as: =20 $ taskset -c 1 make check TESTS=3D"gdb.base/unwind-on-each-insn.exp= " RUNTESTFLAGS=3D"--target_board=3Dnative-gdbserver" =20 or more simply: =20 $ make check-read1 TESTS=3D"gdb.base/unwind-on-each-insn.exp" =20 The problem is that the gdb_test_multiple call that grabs the frame id from "maint print frame-id" does not consume the prompt. Well, it does sometimes due to the trailing .*, but not always. If the prompt is not consumed, the tests that follow get confused: =20 FAIL: gdb.base/unwind-on-each-insn.exp: gdb_breakpoint: set breakpo= int at *foo FAIL: gdb.base/unwind-on-each-insn.exp: disassemble foo FAIL: gdb.base/unwind-on-each-insn.exp: get $sp and frame base in f= oo: get hexadecimal valueof "$sp" ... many more ... =20 Use -wrap to make gdb_test_multiple consume the prompt. =20 While at it, remove the bit that consumes the command name and do exp_continue, it's not really necessary. And for consistency, do the same changes to the gdb_test_multiple that consumes the stack address, although that one was fine, it did consume the prompt explicitly. =20 Change-Id: I2b7328c8844c7e98921ea494c4c05107162619fc Reviewed-By: Bruno Larsen Diff: --- gdb/testsuite/gdb.base/unwind-on-each-insn.exp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp b/gdb/testsuite= /gdb.base/unwind-on-each-insn.exp index faa6a1a3f06..3b48805cff8 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp @@ -44,11 +44,7 @@ proc get_sp_and_fba { testname } { =20 set fba "" gdb_test_multiple "info frame" "" { - -re "^info frame\r\n" { - exp_continue - } - - -re "^Stack level ${::decimal}, frame at ($::hex):\r\n.*$::gdb_prompt= $" { + -re -wrap ".*Stack level ${::decimal}, frame at ($::hex):.*" { set fba $expect_out(1,string) } } @@ -62,11 +58,7 @@ proc get_sp_and_fba { testname } { proc get_fid { } { set fid "" gdb_test_multiple "maint print frame-id" "" { - -re "^maint print frame-id\r\n" { - exp_continue - } - - -re "^frame-id for frame #${::decimal}: (\[^\r\n\]+).*" { + -re -wrap ".*frame-id for frame #${::decimal}: (.*)" { set fid $expect_out(1,string) } }