public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/testsuite: make sure to consume the prompt in gdb.base/unwind-on-each-insn.exp
Date: Tue, 25 Oct 2022 14:37:33 +0000 (GMT)	[thread overview]
Message-ID: <20221025143733.6E1A43856DC8@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7699dfc8d5896556e700bd6cb36d76dd43252e98

commit 7699dfc8d5896556e700bd6cb36d76dd43252e98
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Tue Oct 25 09:50:56 2022 -0400

    gdb/testsuite: make sure to consume the prompt in gdb.base/unwind-on-each-insn.exp
    
    This test fails quite reliably for me when ran as:
    
        $ taskset -c 1 make check TESTS="gdb.base/unwind-on-each-insn.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
    
    or more simply:
    
        $ make check-read1 TESTS="gdb.base/unwind-on-each-insn.exp"
    
    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:
    
        FAIL: gdb.base/unwind-on-each-insn.exp: gdb_breakpoint: set breakpoint 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 foo: get hexadecimal valueof "$sp"
        ... many more ...
    
    Use -wrap to make gdb_test_multiple consume the prompt.
    
    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.
    
    Change-Id: I2b7328c8844c7e98921ea494c4c05107162619fc
    Reviewed-By: Bruno Larsen <blarsen@redhat.com>

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 } {
 
 	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)
 	}
     }

                 reply	other threads:[~2022-10-25 14:37 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=20221025143733.6E1A43856DC8@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@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).