This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp
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