Re: building gdb with TUI support on Windows

Eli Zaretskii
2014-12-26T08:04:27Z

> Date: Fri, 26 Dec 2014 02:13:36 +0200
> From: Ofir Cohen <ofircohenn@gmail.com>
>
> I'm trying to build gdb from source with TUI support on Windows.
> I'm using msys2 with MinGWx64.
> It seems non-trivial, and is accompanied by undesired behavior.
>
> I'm addressing this mailing list after a long period of trying by myself
> and because I couldn't find a decent place where this could be solved.
>
> I manage to build by commenting out tputs() implementation in
> gdb/windows-termcap.c
> (so the ncurses tputs is used instead).

Are you sure this is the only place where you need changes in order to
use ncurses? There used to be quite a few places where GDB and
readline worked around the missing curses library on Windows, and
those places were never modified to account for ncurses being
available on Windows. When I build GDB, even without TUI, I need to
hide libncurses from the configure script in order to build a working
debugger.

> However, when I run: "gdb --tui" from msys2 I get a "TUI mode not
> supported".

I would suggest to debug this: find out where this message is coming
from, and use GDB (without TUI ;-) to investigate the reasons.

> When I run it from DOS (with mingw64 paths in the PATH), it runs but
> I cannot move the text cursor to left arrow and right arrow), and
> even more annoying, I can't use the CTRL+R (history lookup).
>
> I saw some post about gdb with TUI support on Windows:
> http://migeel.sk/blog/2009/04/15/compiling-gdb-under-windows/
>
> But it didn't help.
>
> Do you have any idea how to get it done right?

Eventually, the only way to solve this is to debug the binary you
build. Find the code that handles the arrow keys and Ctrl-R, and step
through it to understand what's wrong.

It is also worth looking into the second change mentioned by the above
article (although it's very old, and might be no longer applicable):
it seems to hint that GDB uses a pipe to communicate with readline,
which might be one reason for problems, since pipes are notoriously
unportable between Posix and Windows platforms.

Or maybe someone else did build GDB with TUI on Windows, and they will
respond shortly.

Good luck.