Stumbled across the gdb (the Gnu Debugger) Text User Interface (TUI) quite by accident during a debug session. Here are the key bindings:
- ‘C-x C-a’
- Enter or leave the TUI mode. When leaving the TUI mode, the curses window management stops and GDB operates using its standard mode, writing on the terminal directly. When reentering the TUI mode, control is given back to the curses windows. The screen is then refreshed.
- ‘C-x 1’
- Use a TUI layout with only one window. The layout will either be ‘source’ or ‘assembly’. When the TUI mode is not active, it will switch to the TUI mode. Think of this key binding as the Emacs ‘C-x 1’ binding.
- ‘C-x 2’
- Use a TUI layout with at least two windows. When the current layout already has two windows, the next layout with two windows is used. When a new layout is chosen, one window will always be common to the previous layout and the new one. Think of it as the Emacs ‘C-x 2’ binding.
- ‘C-x o’
- Change the active window. The TUI associates several key bindings (like scrolling and arrow keys) with the active window. This command gives the focus to the next TUI window. Think of it as the Emacs ‘C-x o’ binding.
- ‘C-x s’
- Switch in and out of the TUI SingleKey mode that binds single keys to GDB commands (*note TUI Single Key Mode::).
The following key bindings only work in the TUI mode:
- Scroll the active window one page up.
- Scroll the active window one page down.
- Scroll the active window one line up.
- Scroll the active window one line down.
- Scroll the active window one column left.
- Scroll the active window one column right.
- Refresh the screen.
Because the arrow keys scroll the active window in the TUI mode, they are not available for their normal use by readline unless the command window has the focus. When another window is active, you must use other readline key bindings such as ‘C-p’, ‘C-n’, ‘C-b’ and ‘C-f’ to control the command window.