From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69728 invoked by alias); 1 Mar 2019 13:10:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 69710 invoked by uid 89); 1 Mar 2019 13:10:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=flushed, Hx-languages-length:3336 X-HELO: mail-wr1-f67.google.com Received: from mail-wr1-f67.google.com (HELO mail-wr1-f67.google.com) (209.85.221.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Mar 2019 13:10:39 +0000 Received: by mail-wr1-f67.google.com with SMTP id q1so25838414wrp.7 for ; Fri, 01 Mar 2019 05:10:38 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id n189sm12689722wmb.28.2019.03.01.05.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Mar 2019 05:10:36 -0800 (PST) Subject: Re: [PATCH 00/16] Add styling to the gdb CLI and TUI To: Tom Tromey , Eli Zaretskii References: <20181128001435.12703-1-tom@tromey.com> <83k1kxfzwo.fsf@gnu.org> <8736rja4i8.fsf@tromey.com> <83r2f3caje.fsf@gnu.org> <87o9a61qvz.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <7975162f-0b68-4826-6d6c-839d7953937d@redhat.com> Date: Fri, 01 Mar 2019 13:10:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87o9a61qvz.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-03/txt/msg00005.txt.bz2 On 11/30/2018 04:17 PM, Tom Tromey wrote: >>>>>> "Eli" == Eli Zaretskii 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. The Windows console in Windows 10 Anniversary Update supports ANSI escape sequences: [1] https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences [2] https://blogs.msdn.microsoft.com/commandline/2017/04/11/windows-10-creators-update-whats-new-in-bashwsl-windows-console/ Basically, GDB needs to call SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING at early startup to enable the feature. There's an example at the bottom of page [1] above. I have no idea whether that interacts badly with readline or curses, but it seems like the ideal solution going forward. Thanks, Pedro Alves