Site Tools


wiki:gdb-tui

Table of Contents

GDB TUI (Text User Interface)

GDB TUI is a visual interface showing source code and a command window side-by-side. Useful for seeing code context while stepping, but slower than command-line.

gdb -tui ./program               # start GDB with TUI enabled
# or in GDB:
(gdb) tui enable                 # toggle TUI on
(gdb) Ctrl+X, A                  # toggle TUI (keyboard shortcut)

TUI splits the terminal: upper window shows source or assembly; lower window is the command prompt. As you step, the upper window highlights the current line. Source context is always visible.

Layout commands switch the upper window display:

(gdb) layout src                 # source code only (default)
(gdb) layout asm                 # assembly only
(gdb) layout split               # source + assembly side-by-side
(gdb) layout regs                # registers + source
(gdb) layout next                # cycle to next layout

Navigation in TUI:

  • Arrow keys in source window scroll and select
  • Ctrl+N / Ctrl+P navigate command history
  • Ctrl+B / Ctrl+F move cursor in command window
  • Ctrl+L refresh display
  • Ctrl+X, A toggle TUI mode

The source window shows breakpoints as B+ or B (enabled/disabled). The current line is highlighted. Clicking on a line sets a breakpoint (in some terminal emulators).

TUI is slower than pure command-line (rendering overhead), especially on slow connections. For production debugging or remote access, prefer command-line. For learning or complex stepping, TUI provides visual context that speeds understanding.

TUI requires a terminal that supports escape sequences. Piping or redirecting breaks it—use the command window directly for such cases.

wiki/gdb-tui.md · Last modified: by 127.0.0.1