Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp
Date: Fri, 02 Dec 2016 17:48:00 -0000	[thread overview]
Message-ID: <4906c887-a561-be85-d918-34050f240d6d@redhat.com> (raw)
In-Reply-To: <7413a597-6c53-78ac-1426-d723742db408@codesourcery.com>

On 12/02/2016 05:40 PM, Luis Machado wrote:

> Doesn't gdb_test_multiple already check for a trailing $gdb_prompt?

gdb_test does, but gdb_test_multiple does not.

What gdb_test_multiple has, is an internal pattern that
matches the prompt if no other user-specified pattern
matches:

	-re "\r\n$gdb_prompt $" {
	    if ![string match "" $message] then {
		fail "$message"
	    }
	    set result 1
	}

That's why the second regexp here:

   gdb_test_multiple "...." "...." {
      -re "some pattern $gdb_prompt $ {
      }
      -re ".*$gdb_prompt $ {
         fail "...."
      }
   }

... is unnecessary.

But the gdb_prompt match in the first regexp is absolutely
necessary, otherwise you leave it dangling in the expect
buffer and confuse whatever comes after.  Whether that
causes trouble or not in a given dejagnu invocation is racy,
depends on how much expect pulls in to its internal buffer
at a time.  Often, "make check-read1" will make such problems
more reproducible.  But just don't introduce the problem in
the first place, please.  :-)

Thanks,
Pedro Alves


  reply	other threads:[~2016-12-02 17:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 17:06 Luis Machado
2016-12-02 17:30 ` Pedro Alves
2016-12-02 17:41   ` Luis Machado
2016-12-02 17:48     ` Pedro Alves [this message]
2016-12-02 19:02       ` [PATCH] [v2] " Luis Machado
2016-12-02 19:10         ` Pedro Alves
2016-12-02 19:37           ` Luis Machado

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=4906c887-a561-be85-d918-34050f240d6d@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    /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