This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [resubmit] gdb.base, r*.exp thru w*.exp
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: Frederic Riss <frederic dot riss at gmail dot com>
- Cc: Michael Snyder <msnyder at vmware dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 15 Jun 2010 12:19:15 -0400
- Subject: Re: [resubmit] gdb.base, r*.exp thru w*.exp
- References: <4BF59BBB.8020603@vmware.com> <AANLkTimG38HTcyRN2hr5If0lcUCHY_84j3V_JmEne-Ha@mail.gmail.com>
On Tue, Jun 15, 2010 at 05:55:48PM +0200, Frederic Riss wrote:
> On 20 May 2010 22:29, Michael Snyder <msnyder@vmware.com> wrote:
> > Index: setshow.exp
> > --- setshow.exp 5 May 2010 18:06:58 -0000 ? ? ? 1.14
> > +++ setshow.exp 20 May 2010 20:24:11 -0000
> > @@ -54,27 +54,25 @@ if { ![runto_main] } {
> > ?#test set annotate 2
> > -send_gdb "set annotate 2\n"
> > -gdb_expect {
> > - ? ? ? -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? { pass "set annotate 2" }
> > - ? ? ? timeout ? ? ? ? ? ? ? ? { fail "(timeout) set annotate 2" }
> > +
> > +gdb_test_multiple "set annotate 2" "set annotate 2" {
> > + ? ?-re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
> > + ? ?pass "set annotate 2"
> > ? ? }
> > +}
>
> Before that commit, the test seemed 100% reliable.
This hunk unfortunately exhibits a common subtle pitfall :-(
You can use bare gdb_expect with a string that contains gdb_prompt not
at the end, or contains more than one gdb_prompt, although it's a bit
tricky. You can't do the same with gdb_test_multiple, because it has
patterns like ".*$gdb_prompt $" -> FAIL. If the output comes out
buffered in such a way that the prompt is written separately from the
post-prompt text, this will match before GDB is done printing output.
--
Daniel Jacobowitz
CodeSourcery