[gdb/testsuite] Make prompt matching in Term::wait_for more strict

On x86_64-freebsd, I run into:
...
Box Dump (80 x 24) @ (0, 0):
    0 (gdb) maint info screen
    1 Number of characters gdb thinks are in a line is 90.
    2 Number of characters readline reports are in a line is 89.
    3 Number of characters curses thinks are in a line is 90.
    4 Number of characters environment thinks are in a line is 90 (COLUMNS).
    5 Number of lines gdb thinks are in a page is 40.
    6 Number of lines readline reports are in a page is 40.
    7 Number of lines curses thinks are in a page is 40.
    8 Number of lines environment thinks are in a page is 40 (LINES).
    9 Readline wrapping mode: readline (terminal is not auto wrap capable, last column
   10 .
   11 (gdb) tui disable
   12 (gdb) tui disable
   13 (gdb) maint info screen
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
FAIL: gdb.tui/resize-2.exp: again: curses width 80
...

The problem is that the prompt matching in Term::wait for is not strict enough.

It will accept a line:
...
(gdb) foo
...
as long as the cursor is pointing just after the prompt, like so:
...
(gdb) foo
      ^
...

Fix this by also checking that the line is empty.

Tested on x86_64-linux.
2 files changed