[PATCH 8/8] [gdb/tui] Fix TUI for TERM=ansi
Tom de Vries
tdevries@suse.de
Fri Apr 14 11:02:53 GMT 2023
On 4/13/23 16:17, Tom de Vries via Gdb-patches wrote:
> On 4/13/23 16:08, Tom de Vries via Gdb-patches wrote:
>> @@ -1144,6 +1148,11 @@ init_page_info (void)
>> /* Get the screen size from Readline. */
>> rl_get_screen_size (&rows, &cols);
>> + if (gdb_stdout->isatty ()) {
>> + readline_hidden_cols = COLS - cols;
>> + gdb_assert (readline_hidden_cols >= 0);
>> + gdb_assert (readline_hidden_cols <= 1);
>> + }
>> lines_per_page = rows;
>> chars_per_line = cols;
>
> Reading this over once more, I noticed this is missing a fix for an
> assertion failure we run into when doing:
> ...
> $ TERM=blabla gdb
> ...
>
> So, this bit is missing:
> ...
> - if (gdb_stdout->isatty ()) {
> + if (gdb_stdout->isatty () && COLS != 0) {
> ...
>
I also ran into trouble with this version. It's not a good idea to use
COLS, because it's just a copy of the env variable COLUMNS at the time
of curses startup. So, I can trigger one of the asserts by doing:
...
$ COLUMNS=<some-n> gdb
...
Here's an updated version, using the COLUMNS value as written by
readline instead.
Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-gdb-tui-Fix-TUI-for-TERM-ansi.patch
Type: text/x-patch
Size: 5598 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20230414/28040727/attachment-0001.bin>
More information about the Gdb-patches
mailing list