Bug 17774 - gdb on Windows TUI mode: arrow keys do not work
Summary: gdb on Windows TUI mode: arrow keys do not work
Status: RESOLVED OBSOLETE
Alias: None
Product: gdb
Classification: Unclassified
Component: tui (show other bugs)
Version: 7.8
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-30 18:08 UTC by Ofir
Modified: 2021-04-02 19:56 UTC (History)
2 users (show)

See Also:
Host: x86_64-w64-mingw32
Target: x86_64-w64-mingw32
Build: x86_64-w64-mingw32
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ofir 2014-12-30 18:08:54 UTC
Hi,
I'm building gdb on Windows with TUI support (--enable-tui) using msys2 with MinGWx64, and the arrow keys do not respond when in TUI mode.

========
Scenario
========
1) Start gdb --tui (from DOS, with MinGWx64 bin dir in the PATH)
2) Move focus to gdb's CLI window (Ctrl+x, o)
2) Type any command (do not press Enter yet)
3) Click on the left/right keyboard arrow keys

Expected: text cursor will move to the left/right
Actual: nothing happens.

Moreover, the up/down keys (history lookup), do not respond either.

On Linux, OTOH, it works and the arrow keys respond (Ubuntu 12.04 with sudo apt-get install gdb).


====================
Debugging the issue
====================
A shallow investigation, debugging of gdb with gdb, showed that
wgetch() function (deep in the call-stack, invoked indirectly by
stdin_event_handler), is blocking and doesn't return when the
arrow-keys are issued.

When gdb is not in TUI mode, however, getch() is called instead,
returns promptly and issues
the associated dispatch handler.
I have a mailing list thread at "gdb at sourceware dot org":
http://comments.gmane.org/gmane.comp.gdb.devel/35208

This is as far as I could get.


=======================
More interesting facts
=======================
1) When you exit TUI mode (Ctrl+x, a), the arrow keys
   function just fine and everything works.
2) Ctrl+p works (but up arrow key doesn't)
3) Ctrl+b/Ctrl+f work (but left/right arrow keys do not)
4) Ctrl+d works (but delete doesn't).



==========
Resources
==========
1) msys2 + MinGWx64
2) PDCurses (instead of ncurses)
3) .././configure --enable-tui --with-expat --build=x86_64-w64-mingw32; make
4) set PATH=C:\msys64\mingw64\bin; gdb --tui

Thanks,
Ofir
Comment 1 Tom Tromey 2018-09-02 23:19:35 UTC
gdb is really at the mercy of the curses implementation here.
So, I would suggest contacting the PDCurses maintainers.
If there's something gdb is doing incorrectly here, then we could
address that; but first we'd have to know what it is.
Comment 2 Tom Tromey 2021-04-02 19:56:59 UTC
No response in a while.