Sourceware Bugzilla – Bug 15163
Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
Last modified: 2013-02-25 18:56:00 UTC
Having vi-like settings in ~/.inputrc
breaks entering/exiting TUI mode using C-x a or any other key combination documented at http://sourceware.org/gdb/download/onlinedocs/gdb/TUI-Keys.html.
1. Remove any ~/.inputrc file.
2. Run 'gdb'
3. Hit C-x a and observe TUI mode starting.
4. Quit gdb
5. Create a ~/.inputrc file containing two lines:
> set editing-mode vi
> set keymap vi
6. Run 'gdb'
7. Hit C-x a and observe ^X^A being echoed to the screen but TUI mode not starting.
I am unaware of any gdb command that will enter/exit TUI mode independently of the key combination. Is there one?
Observed generally throughout 7.x and reproduced just now on 7.5.1.
> I am unaware of any gdb command that will enter/exit TUI mode independently of
the key combination. Is there one?
Commands like "tui foo", and "layout next" enter the TUI.
I'm not aware of any GDB command to exit the TUI, and looking at the code, I can't find any that would do it as side effect.
However, TUI enter/exit is bound to the readline "tui-switch-mode" command/function:
> rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1);
One should be able to use that to bind any key combo to TUI enter/exit in the inputrc file, per the "Key Bindings" node in the readline manual. However, I'm not familiar readline's vi mode (emacs user here), and whether key bindings apply in that mode.
Let me know if that helps.
> However, TUI enter/exit is bound to the readline "tui-switch-mode"
> One should be able to use that to bind any key combo to TUI enter/exit in the
> inputrc file, per the "Key Bindings" node in the readline manual. However, I'm
> not familiar readline's vi mode (emacs user here), and whether key bindings
> apply in that mode.
I'm not familiar either. Thanks for the suggestion. I've tried
adding a few things like
to my ~/.inputrc without any luck. However, it seems that
1. Run 'gdb'
2. Hit Escape to enter vi command mode
3. Hit Control-E to enter Emacs mode ('emacs-editing-mode')
4. Hit Control-x a to enter the TUI
works. Though now I'm in Emacs mode and hitting Control-x a again
does not exit the TUI. And I can't seem to get "M-C-J" to trigger
vi-editing-mode again (though this is likely me being an idiot).
I'm afraid at this point I don't really know if there's a bug, or if there is, if it is GDB specific. As mentioned, I'm blissfully ignorant on vi things.
However, I'd think that if bash can handle the same style of key bindings in vi mode, then gdb should too. What does bash do?
> (though this is likely me being an idiot).
:-) Most probably not.
A gdb command to toggle the TUI off seems like something nice to have, as escape hatch out of broken-beyond-repair terminal settings though.