Re: building gdb with TUI support on Windows

Ofir Cohen
2014-12-27T13:53:41Z

Hi Eli,
Thank you for your prompt response.
Only the windows-termcap.c needed changes.

I was hoping to spare myself debugging gdb's code by getting a good
advice here, but it seems like it's the only way.

It seems like there is something wrong with the keys binding, because
Ctrl+P - works, but up arrow doesn't
Ctrl+D - works, but delete doesn't..

So either I'll get response from someone who has been there before, or
I'll debug it myself as you suggested.

Thanks,
Ofir Cohen

On 26 December 2014 at 10:04, Eli Zaretskii <eliz@gnu.org> wrote:
>> 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.