This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MI testsuite to use PTY for inferior
On Fri, Aug 19, 2005 at 06:27:21PM -0400, Bob Rossi wrote:
> > Funny thing is that if I run mi-console.exp alone, it usually
> > (although not always) succeeds.
> >
> > Attached are a gdb.log for a failing run and a passing run.
>
> OK, I've tracked down why mi-console.exp breaks. Also, I can reproduce
> it. The problem is slightly difficult to fix because of race conditions
> so I was hoping to get some advice from people who might have had
> similar experience with the testsuite.
Nice job tracking this down.
> This splits up the regex matching into 2 commands, which makes sense.
> The problem is, in mi_gdb_test when it goes to match 47\\^running, it is
> possible that either just that has been outputted by GDB (Yay, match!),
> or that also the 47\\*stopped... output has also been output by GDB. In
> this case, the testcase fails because the regex in mi_gdb_test does not
> match the 'end anchor' of the output from GDB. Thus the race condition.
>
> I'm still thinking of ways to fix this without totally hacking the
> testsuite, any ideas?
>
> To reproduce this problem, put 'sleep 1' just before the gdb_expect line
> in mi-support.exp:mi_gdb_test. That gives GDB enough time to output
> both items that need to be matched.
Well, let's see. I'd recommend adding support for multiple prompts to
mi_gdb_test so that we don't lose the "unexpected output" case;
otherwise we get nasty timeouts. I'm thinking of, roughly, this
control flow.
gdb_expect {
....
-re "^running\n$mi_gdb_prompt" {
# Note the lack of a trailing anchor.
# This will leave everything after that prompt in expect's
# buffer, only consuming things before it.
pass 1
}
-re ".*$mi_gdb_prompt$" {
fail
return
}
}
gdb_expect {
....
-re "\*stopped\n$mi_gdb_prompt" {
pass 1
}
-re ".*$mi_gdb_prompt$" {
fail
return
}
}
I haven't tried it. Does the idea make sense?
--
Daniel Jacobowitz
CodeSourcery, LLC