Well, this is a very common and ancient idiom that is used
everywhere throughout the test suite.
You have to assume that we don't care about anything between
the ".*" and the "$gdb_prompt $". If we do, the test is wrong,
but if it consumes more output than it was meant to, the
following tests will fail.
To give more context about the whole effort, I have to say that this was
one psychologically tough patch to review, because there are lots of
little things that I would have wanted to improve. But Pedro is right
that we should limit ourselves to semi-mechanical changes and not get
carried away by trying to make things perfect. If the original test was
already erroneous, we can fix that as a followup patch. That could be
another mechanical patch...