GDB TUI
25.4 TUI-specific Commands
The TUI has specific commands to control the text windows. These commands are always available, even when GDB is not in the TUI mode. When GDB is in the standard mode, most of these commands will automatically switch to the TUI mode.
Note that if GDB’s stdout is not connected to a terminal, or GDB has been started with the machine interface interpreter (see The GDB/MI Interface), most of these commands will fail with an error, because it would not be possible or desirable to enable curses window management.
tui enable
Activate TUI mode. The last active TUI window layout will be used if TUI mode has previously been used in the current debugging session, otherwise a default layout is used.
tui disable
Disable TUI mode, returning to the console interpreter.
info win
List and give the size of all displayed windows.
layout name
Changes which TUI windows are displayed. In each layout the command window is always displayed, the name parameter controls which additional windows are displayed, and can be any of the following:
next
Display the next layout.
prev
Display the previous layout.
src
Display the source and command windows.
asm
Display the assembly and command windows.
split
Display the source, assembly, and command windows.
regs
When in src layout display the register, source, and command windows. When in asm or split layout display the register, assembler, and command windows.
focus name
Changes which TUI window is currently active for scrolling. The name parameter can be any of the following:
next
Make the next window active for scrolling.
prev
Make the previous window active for scrolling.
src
Make the source window active for scrolling.
asm
Make the assembly window active for scrolling.
regs
Make the register window active for scrolling.
cmd
Make the command window active for scrolling.
refresh
Refresh the screen. This is similar to typing C-L.
tui reg group
Changes the register group displayed in the tui register window to group. If the register window is not currently displayed this command will cause the register window to be displayed. The list of register groups, as well as their order is target specific. The following groups are available on most targets:
next
Repeatedly selecting this group will cause the display to cycle through all of the available register groups.
prev
Repeatedly selecting this group will cause the display to cycle through all of the available register groups in the reverse order to next.
general
Display the general registers.
float
Display the floating point registers.
system
Display the system registers.
vector
Display the vector registers.
all
Display all registers.
update
Update the source window and the current execution point.
winheight name +count
winheight name -count
Change the height of the window name by count lines. Positive counts increase the height, while negative counts decrease it. The name parameter can be one of src (the source window), cmd (the command window), asm (the disassembly window), or regs (the register display window).
25.2 TUI Key Bindings
The TUI installs several key bindings in the readline keymaps (see Command Line Editing). The following key bindings are installed for both TUI mode and the GDB standard mode.
C-x C-a
C-x a
C-x 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.
This key binding uses the bindable Readline function tui-switch-mode.
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.
This key binding uses the bindable Readline function tui-delete-other-windows.
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.
This key binding uses the bindable Readline function tui-change-windows.
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.
This key binding uses the bindable Readline function tui-other-window.
C-x s
Switch in and out of the TUI SingleKey mode that binds single keys to GDB commands (see TUI Single Key Mode).
This key binding uses the bindable Readline function next-keymap.
The following key bindings only work in the TUI mode:
PgUp
Scroll the active window one page up.
PgDn
Scroll the active window one page down.
Up
Scroll the active window one line up.
Down
Scroll the active window one line down.
Left
Scroll the active window one column left.
Right
Scroll the active window one column right.
C-L
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.
https://sourceware.org/gdb/onlinedocs/gdb/TUI-Commands.html
https://sourceware.org/gdb/current/onlinedocs/gdb/TUI-Keys.html