This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [resubmit] gdb.base, r*.exp thru w*.exp


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]