new-ui and Windows

Pedro Alves
Mon May 15 22:49:00 GMT 2017

On 05/15/2017 01:38 PM, Jonah Graham wrote:
> Hello gdb devs,
> I am looking to support the new-ui functionality[1] for Eclipse CDT on
> Windows [2]. I have been using it on Linux and have been enjoying it.
> Having a full GDB CLI available within Eclipse is a great improvement.

Awesome, great to hear.

> I would like to know if new-ui is supposed to work on Windows with
> mingw host?

The original focus was on GNU/Linux.  Even though I/we kept the
idea of supporting Windows down the road in mind, we knew there'd
likely be more work required to get there.

WinPTY takes care of the Windows console<->pty bridging for "free",
fortunately, which I think means we're mostly there.

> The new-ui attempts to open a tty with
> top.c:open_terminal_stream() which calls open(). On Windows, AFAIK,
> this can only open a normal file.

What kind of file would you like to pass to gdb?  My original idea
was that on Windows you'd pass down the path to a bidirectional/duplex
named pipe, and things would Just Work (TM).  Doesn't open() work on
such named pipe paths?  If not, then the "struct serial" abstraction
seems to know about named pipes already (ser-mingw.c), so maybe it'd work
to adjust the new-ui code to use serial_open instead.

If other kinds of files are more convenient, I'm definitely open to
patches teaching gdb about them.

> If this is supposed to work on Windows already, an example of how to
> do it would be great. I can take that and see where I can get next.
> Any thoughts much appreciated.

The next issue you'll run into is that the new-ui mechanism only
really works if the active target backend supports asynchronous
debugging.  The Linux backends supports it.  Windows _remote_ debugging
supports it.  But Windows _native_ debugging does not (gdb blocks in
windows-nat.c -> WaitForDebugEvent).  If you're interested, I can guide you
in the direction of fixing the latter.  Just let me know.

Pedro Alves

More information about the Gdb mailing list