2.1.3 What gdb Does During Startup
- Sets up the command interpreter as specified by the command line (see interpreter).
- Reads the system-wide init file (if --with-system-gdbinit was used when building gdb; see System-wide configuration and settings) and executes all the commands in that file.
- Reads the init file (if any) in your home directory1 and executes all the commands in that file.
- Processes command line options and operands.
- Reads and executes the commands from init file (if any) in the current working directory. This is only done if the current directory is different from your home directory. Thus, you can have more than one init file, one generic in your home directory, and another, specific to the program you are debugging, in the directory where you invoke gdb.
- Reads command files specified by the -x option. See Command Files, for more details about gdb command files.
- Reads the command history recorded in the history file. See Command History, for more details about the command history and the files where gdb records it.
Init files use the same syntax as command files (see Command Files) and are processed by gdb in the same way. The init file in your home directory can set options (such as set complaints) that affect subsequent processing of command line options and operands. Init files are not executed if you use the -nx option (see Choosing Modes).
To display the list of init files loaded by gdb at startup, you can use gdb --help.
The gdb init files are normally called .gdbinit. The DJGPP port of gdb uses the name gdb.ini, due to the limitations of file names imposed by DOS filesystems. The Windows ports of gdb use the standard name, but if they find a gdb.ini file, they warn you about that and suggest to rename the file to the standard name.
DOS/Windows systems, the home directory is the one pointed to by the
HOME environment variable.