Contents|Index|Previous|Next
Command files

A command file for GDB is a file of lines that are GDB commands.

Comments (lines starting with #) may also be included. An empty line in a command file does nothing; it does not mean to repeat the last command, as it would from the terminal. When you start GDB, it automatically executes commands from its init files. These are files named ‘.gdbinit’. GDB reads the init file (if any) in your home directory, then processes command line options and operands, and then reads the init file (if any) in the current working directory. This is so the init file in your home directory can set options (such as set complaints) which affect the processing of the command line options and operands. The init files are not executed if you use the ‘-nx’ option; see Choosing modes. On some configurations of GDB, the init file is known by a different name (these are typically environments where a specialized form of GDB may need to coexist with other forms, hence a different name for the specialized version’s init file). These are the environments with special init file names:

You can also request the execution of a command file with the source command:
Top|Contents|Index|Previous|Next