OS Manuals

/usr/bin/gdb

The GNU Debugger (multiarch)

From gdb-multiarch 18.1-r0 (os), captured 2026-11-05 by running gdb --help (exit 0). permalink

This is the GNU debugger.  Usage:

    gdb [options] [executable-file [core-file or process-id]]
    gdb [options] --args executable-file [inferior-arguments ...]

Selection of debuggee and its files:

  --args             Arguments after executable-file are passed to inferior.
  --no-escape-args   Like --args, but arguments are not escaped.
  --core=COREFILE    Analyze the core dump COREFILE.
  --exec=EXECFILE    Use EXECFILE as the executable.
  --pid=PID          Attach to running process PID.
  --directory=DIR    Search for source files in DIR.
  --se=FILE          Use FILE as symbol file and executable file.
  --symbols=SYMFILE  Read symbols from SYMFILE.
  --readnow          Fully read symbol files on first access.
  --readnever        Do not read symbol files.
  --write            Set writing into executable and core files.

Initial commands and command files:

  --command=FILE, -x Execute GDB commands from FILE.
  --init-command=FILE, -ix
		     Like -x but execute commands before loading inferior.
  --eval-command=COMMAND, -ex
		     Execute a single GDB command.
		     May be used multiple times and in conjunction
		     with --command.
  --init-eval-command=COMMAND, -iex
		     Like -ex but before loading inferior.
  --nh               Do not read ~/.gdbinit.
  --nx               Do not read any .gdbinit files in any directory.

Output and user interface control:

  --fullname         Output information used by emacs-GDB interface.
  --interpreter=INTERP
		     Select a specific interpreter / user interface.
  --tty=TTY          Use TTY for input/output by the program being debugged.
  -w                 Use the GUI interface.
  --nw               Do not use the GUI interface.
  --tui              Use a terminal user interface.
  -q, --quiet, --silent
		     Do not print version number on startup.

Operating modes:

  --batch            Exit after processing options.
  --batch-silent     Like --batch, but suppress all gdb stdout output.
  --return-child-result
		     GDB exit code will be the child's exit code.
  --configuration    Print details about GDB configuration and then exit.
  --help             Print this message and then exit.
  --version          Print version information and then exit.

Remote debugging options:

  -b BAUDRATE        Set serial port baud rate used for remote debugging.
  -l TIMEOUT         Set timeout in seconds for remote debugging.

Other options:

  --cd=DIR           Change current directory to DIR.
  --data-directory=DIR, -D
		     Set GDB's data-directory to DIR.

At startup, GDB reads the following early init files and executes their
commands:
   None found.

At startup, GDB reads the following init files and executes their commands:
   None found.

For more information, type "help" from within GDB, or consult the
GDB manual (available as on-line info or a printed manual).

Report bugs to <https://www.gnu.org/software/gdb/bugs/>.

You can ask GDB-related questions on the GDB users mailing list
(gdb@sourceware.org) or on GDB's IRC channel (#gdb on Libera.Chat).
Options (42)
OptionDescriptionSource
--argsArguments after executable-file are passed to inferior.help
--no-escape-argsLike --args, but arguments are not escaped.help
--core COREFILEAnalyze the core dump COREFILE.help + man
--exec EXECFILEUse EXECFILE as the executable.help + man
--pid PIDAttach GDB to an already running program, with the PID pid.help + man
--directory DIRSearch for source files in DIR.help + man
--se FILERead symbol table from file and use it as the executable file.help + man
--symbols SYMFILERead symbols from SYMFILE.help + man
--readnowRead all symbols from the given symfile on the first access.help + man
--readneverDo not read symbol files.help + man
--writeEnable writing into executable and core files.help + man
--init-command, -ix FILELike -x but execute commands before loading inferior.help
--eval-command, -ex COMMANDExecute a single GDB command.help + man + man
--init-eval-command, -iex COMMANDExecute GDB command before loading the inferior.help + man + man
--nhDo not execute commands from ~/.config/gdb/gdbinit, ~/.gdbinit, ~/.config/gdb/gdbearlyinit, or ~/.gdbearlyinithelp + man
--nxDo not read any .gdbinit files in any directory.help + man
--fullnameOutput information used by emacs-GDB interface.help + man
--interpreter INTERPSelect a specific interpreter / user interface.help
--tty TTYRun using device for your program's standard input and output.help + man
-wUse the GUI interface.help
--nwDo not use the GUI interface.help
--tuiOpen the terminal user interface.help + man
-q, --quiet, --silentDo not print version number on startup.help + man + man + man
--batchExit after processing options.help + man
--batch-silentRun in batch mode, just like --batch, but totally silent.help + man
--return-child-resultGDB's exit code will be the same as the child's exit code.help + man
--configurationPrint details about GDB configuration and then exit.help + man
--helpPrint this message and then exit.help + man
--versionPrint version information and then exit.help + man
-b BAUDRATESet the line speed (baud rate or bits per second) of any serial interface used by GDB for remote debugging.help + man
-l TIMEOUTSet timeout, in seconds, for remote debugging.help + man
--cd DIRRun GDB using directory as its working directory, instead of the current directory.help + man
--data-directory, -D DIRRun GDB using directory as its data directory.help + man + man
-hList all options, with brief explanations. (in the manual page but not in --help)man
-s fileRead symbol table from file. (in the manual page but not in --help)man
-e fileUse file as the executable file to execute when appropriate, and for examining pure data in conjunction with a core dump. (in the manual page but not in --help)man
-c fileUse file as a core dump to examine. (in the manual page but not in --help)man
--command file (in the manual page but not in --help)man
-x fileExecute GDB commands from file. (in the manual page but not in --help)man
-d directoryAdd directory to the path to search for source files. (in the manual page but not in --help)man
-nDo not execute commands from any .gdbinit or .gdbearlyinit initialization files. (in the manual page but not in --help)man
-fEmacs sets this option when it runs GDB as a subprocess. (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.