]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Require minimum width in gdb.base/style.exp
authorTom de Vries <tdevries@suse.de>
Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)
commite83ef5d62595f04f9cbae7a1dc88a4aa56a0cc6d
tree7219d144c6413a4644758ece200e4ba699bdce31
parentc637feb9e17645f16ec3c6c06a494aa843bf6d6f
[gdb/testsuite] Require minimum width in gdb.base/style.exp

In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling,
which:
- determines a "desired width" by parsing the output of "info files",
- sets width to the "desired width", and
- runs "info files" again.

The "desired width" on my system is 88, but if I override it to 65, I run
into:
...
(gdb) info files^M
Symbols from "^[[32;49;22;27m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.base/style/style^[[m".^M
--Type <RET> for more, q to quit, c to continue without paging--^M
^MFAIL: gdb.base/style.exp: check pagination prompt styling (timeout)
...
with make target check, and with check-read1 into:
...
(gdb) info files^M
Symbols from "^[[32;49;22;27m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.base/style/style^[[m".^M
--Type <RET> for more, q to quit, c to continue without paging--^M
^M^[[A^M
Native process:^M
        Using the running image of child process 6179.^M
--Type <RET> for more, q to quit, c to continue without paging--ERROR: Window too small.
UNRESOLVED: gdb.base/style.exp: check pagination prompt styling
...

This is caused by the following.

The size of the pagination prompt is 64:
...
         1         2         3         4         5         6
1234567890123456789012345678901234567890123456789012345678901234
--Type <RET> for more, q to quit, c to continue without paging--
...
and because we have TERM=ansi and width == 65, readline wraps at 64:
...
(gdb) maint info screen
Number of characters gdb thinks are in a line is 65.
Number of characters readline reports are in a line is 64.
...

In other words, readline wraps when printing the pagination prompt.

This causes some unusual output, and the test is not prepared to handle this.

Fix this by requiring that desired_width is at least
<length of pagination prompt> + 2.

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
PR testsuite/33167
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33167
gdb/testsuite/gdb.base/style.exp
gdb/testsuite/lib/gdb.exp