Initialization files

Initialization files are supported in both DBX and GDB modes.

GDB mode

When using the default command line mode, or when -gdb is specified on the command line, the debugger reads .gdbinit in the user's home directory before attaching to or starting a target executable.

After attaching or starting a target, if the current directory is not the user's home directory, the debugger reads .gdbinit in the current directory.

The debugger will read any command files specified by the -x option in addition to .gdbinit. Additionally, it will read the command history recorded in the history file (which defaults to ./.gdb_history).

Use the following options to manage initialization files:

idb -gdb -x <command file>

This option processes the command file named after processing .gdbinit. More than one -x <command file> option can be used on the command line. The files will be processed in left-to-right order.

idb -gdb -n[x]

Options -n and -nx cause the debugger to skip processing .gdbinit. Even with the -n or -nx option, files specified with -x will still be processed.

DBX mode

Before attaching to or starting a target executable and before processing command line qualifiers, the debugger reads .idbrc in the current directory and executes it. If there is no .idbrc in the current directory, the debugger tries to read it from the user's home directory:

~/.idbrc

If the -i option is passed, defining another initialization file, then it will be used instead of .idbrc

After the target process has been loaded or attached to, and after processing command line qualifiers, the debugger reads .dbxinit in the current directory and executes it. If there is no .dbxinit in the current directory, the debugger tries to read it from the user's home directory:

~/.dbxinit

If the option -c is passed, defining another initialization file, then it will be used instead of .dbxinit.

Some examples of the difference between .idbrc and .dbxinit are shown in the following table:

Example Command

If Used in .idbrc

If Used in .dbxinit

Assume the command "set $stoponattach = 1" is in one of these files and you invoked the debugger as:

% idb -pid process_id executable_file

The debugger attaches and stops. The debugger attaches and waits for you to press Ctrl+C; subsequent attaches will stop.
Assume the command "stop in main" is in one of these files. The debugger generates a message that there is no main in which to place a breakpoint, because there is no target yet. The debugger sets the breakpoint (assuming there is a main in the target).