2.1.3 What ROCGDB Does During Startup
Here’s the description of what ROCGDB does during session 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 ROCGDB; see System-wide configuration and settings) and the files in the system-wide
gdbinit directory (if --with-system-gdbinit-dir was used) and executes
all the commands in those files. The files need to be named with a .gdb
extension to be interpreted as ROCGDB commands, or they can be written
in a supported scripting language with an appropriate file extension.
- Reads the init file (if any) in your home directory1 and executes all the commands in
that file.
- Executes commands and command files specified by the ‘-iex’ and
‘-ix’ options in their specified order. Usually you should use the
‘-ex’ and ‘-x’ options instead, but this way you can apply
settings before ROCGDB init files get executed and before inferior
gets loaded.
- Processes command line options and operands.
- Reads and executes the commands from init file (if any) in the current
working directory as long as ‘set auto-load local-gdbinit’ is set to
‘on’ (see Init File in the Current 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
ROCGDB.
- If the command line specified a program to debug, or a process to
attach to, or a core file, ROCGDB loads any auto-loaded
scripts provided for the program or for its loaded shared libraries.
See Auto-loading.
If you wish to disable the auto-loading during startup,
you must do something like the following:
$ gdb -iex "set auto-load python-scripts off" myprogram
Option ‘-ex’ does not work because the auto-loading is then turned
off too late.
- Executes commands and command files specified by the ‘-ex’ and
‘-x’ options in their specified order. See Command Files, for
more details about ROCGDB 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 ROCGDB records it.
Init files use the same syntax as command files (see Command Files) and are processed by ROCGDB 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 ROCGDB init files are normally called .gdbinit.
The DJGPP port of ROCGDB uses the name gdb.ini, due to
the limitations of file names imposed by DOS filesystems. The Windows
port of ROCGDB uses the standard name, but if it finds a
gdb.ini file in your home directory, it warns you about that
and suggests to rename the file to the standard name.