Re: [PATCH v2 24/25] Add new command to create extra console/mi UI channels

Pedro Alves
2016-05-26T16:03:46Z

On 05/26/2016 04:46 PM, Eli Zaretskii wrote:
>> Cc: gdb-patches@sourceware.org
>> From: Pedro Alves <palves@redhat.com>
>> Date: Thu, 26 May 2016 12:43:01 +0100
>>
>> I've been thinking a bit on how to make this all work on Windows,
>> with Eclipse, and my current thinking is that instead of some hack to
>> embed a native console window inside the GUI, better would be to reuse
>> the same Eclipse terminal emulator widget, and coax gdb
>> to send the right terminal escape sequences for cursor movement
>> and character placement as a Unix gdb would.
>
> Sorry, I know nothing about this "Eclipse terminal emulator widget".

Just think of it as a terminal emulator, like xterm or any other.

>
> In any case, this is Eclipse-specific, right?

Other frontends will probably follow the same approach.

>> The problems will probably be around isatty checks in
>> readline and ncurses, as you suggested.
>>
>> There may also be #ifdef WIN32 bits in those libraries that
>> are #ifdef-ing out code that we'll need, assuming terminal == console,
>> though I haven't really checked.
>
> Right.
>
>> The isatty problem looks very much like the problem a native Windows/mingw
>> program has when run on a Cygwin terminal (and MSYS/MSYS2, which are
>> Cygwin forks), since Cygwin emulates pseudo terminals via named pipes.
>> See, e.g.,:
>>
>> http://www.spinics.net/lists/git/msg274348.html
>
> Cygwin also owns the libc it uses, so it's easy to work around the
> related problems. MinGW cannot do that easily.

I think you misunderstand. That patch is against a native mingw program
(git mingw port). The patch is a clever hack that makes msvcrt's "isatty"
return true when input/output is connected to a named pipe that has a name
that is recognized as being a MSYS pty.

>
>> BTW, while investigating this, I found that since some recent
>> update to Windows 10, Windows consoles now supports ansi/vt100
>> escape sequences, finally:
>>
>> http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-%28v1511%29-Console-Host-Enhancements
>>
>> This further reinforces to me the idea of using ansi escapes on
>> Windows Eclipse/gdb too.
>
> Not sure how that is related, since the emulator is not a console for
> the program that runs on it.

I mean that going forward, with that, it won't sound so strange for
native Windows console applications to output ansi escape sequences
instead of using the console APIs to control cursor positioning, etc.

Thanks,
Pedro Alves