Re: [PATCH 00/16] Add styling to the gdb CLI and TUI

Tom Tromey
2018-11-30T16:17:44Z

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Tom> I think it should work, but you'd have to "set style enabled on" first.

Eli> Maybe a TUI invocation should "set style enabled on" on all platforms?
Eli> Or at least on those that use ncurses?

That would possibly override the user's setting. It's probably better
to simply implement the console support for Windows. Or, change how the
disabling is done on Windows -- right now it is done by changing the
default for this setting, but perhaps it could be done some other way.

Is it possible to ssh in to a Windows machine and then use gdb? That's
one scenario where you may want to keep the ANSI terminal escape
sequences in the output. It also may affect how calls to the Windows
API are handled.

Eli> One problem with this approach is that it needs to fix the escape
Eli> sequences for the relevant attributes, whereas AFAIU your code
Eli> simply uses the terminfo that happens to be in effect, is that
Eli> right?

This patch series uses ANSI escape sequences for the styling; and the
TUI decodes these and turns them into curses calls.

Tom> Doing it that way can't work due to buffering.

Eli> Not sure I understand. Console output is generally line-buffered, and
Eli> there's fflush to force writing any buffered output before applying
Eli> text attributes. Am I missing something?

utils.c implements its own buffering. Previous to this series this was
only done when "wrap_column > 0", but patch #1 changes this code to
always buffer.

This is a problem for other approaches because styles are emitted inline
with other text; and then flushed as a unit.

Tom> Also, this approach would be undesirable anyway, because GNU Source
Tom> Highlight emits escape codes -- that's why I abandoned my earlier
Tom> plan of implementing styling as objects in the utils.c buffer.

Eli> What is GNU Source Highlight, and what is its relevance to the issue
Eli> at hand?

GNU Source Highlight is used to style source text.

https://www.gnu.org/software/src-highlite/

Support for using it is added to gdb in patch #15.

Tom> Instead, I think filtering the escape sequences is really the only
Tom> way.

Eli> The problem with that is that it hard-codes the SGR sequences concepts
Eli> right into the design, and the escape sequences are unknown in advance
Eli> on systems where there's no terminfo.

Only terminals using the ANSI sequences are supported by this series, at
least for the CLI. The TUI can support more in theory, though I have no
way to test that.

Tom