]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Make prompt matching in Term::wait_for more strict
authorTom de Vries <tdevries@suse.de>
Thu, 14 Aug 2025 13:18:34 +0000 (15:18 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 14 Aug 2025 13:18:34 +0000 (15:18 +0200)
commit588f68cd3e38c4b77c20b534f1998560d3bb079f
treec5eb3fa0237ee8b7428b4cc29d1d2ea18abf5e27
parent76060b138dbc0faa70a5da2af8519a0ae469caa2
[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.
gdb/testsuite/gdb.tui/tuiterm-2.exp
gdb/testsuite/lib/tuiterm.exp