gdb: objfile-gdbdotext file
23.4.1 The 'OBJFILE-gdb.EXT' file
---------------------------------
When a new object file is read, GDB looks for a file named
'OBJFILE-gdb.EXT' (we call it SCRIPT-NAME below), where OBJFILE is the
object file's name and where EXT is the file extension for the extension
language:
'OBJFILE-gdb.gdb'
GDB's own command language
'OBJFILE-gdb.py'
Python
'OBJFILE-gdb.scm'
Guile
SCRIPT-NAME is formed by ensuring that the file name of OBJFILE is
absolute, following all symlinks, and resolving '.' and '..' components,
and appending the '-gdb.EXT' suffix. If this file exists and is
readable, GDB will evaluate it as a script in the specified extension
language.
If this file does not exist, then GDB will look for SCRIPT-NAME file
in all of the directories as specified below.
Note that loading of these files requires an accordingly configured
'auto-load safe-path' (Auto-loading safe path).
For object files using '.exe' suffix GDB tries to load first the
scripts normally according to its '.exe' filename. But if no scripts
are found GDB also tries script filenames matching the object file
without its '.exe' suffix. This '.exe' stripping is case insensitive
and it is attempted on any platform. This makes the script filenames
compatible between Unix and MS-Windows hosts.
'set auto-load scripts-directory [DIRECTORIES]'
Control GDB auto-loaded scripts location. Multiple directory
entries may be delimited by the host platform path separator in use
(':' on Unix, ';' on MS-Windows and MS-DOS).
Each entry here needs to be covered also by the security setting
'set auto-load safe-path' (set auto-load safe-path).
This variable defaults to '$debugdir:$datadir/auto-load'. The
default 'set auto-load safe-path' value can be also overriden by
GDB configuration option '--with-auto-load-dir'.
Any reference to '$debugdir' will get replaced by
DEBUG-FILE-DIRECTORY value (Separate Debug Files) and any
reference to '$datadir' will get replaced by DATA-DIRECTORY which
is determined at GDB startup (Data Files). '$debugdir' and
'$datadir' must be placed as a directory component -- either alone
or delimited by '/' or '\' directory separators, depending on the
host platform.
The list of directories uses path separator (':' on GNU and Unix
systems, ';' on MS-Windows and MS-DOS) to separate directories,
similarly to the 'PATH' environment variable.
'show auto-load scripts-directory'
Show GDB auto-loaded scripts location.
'add-auto-load-scripts-directory [DIRECTORIES...]'
Add an entry (or list of entries) to the list of auto-loaded
scripts locations. Multiple entries may be delimited by the host
platform path separator in use.
GDB does not track which files it has already auto-loaded this way.
GDB will load the associated script every time the corresponding OBJFILE
is opened. So your '-gdb.EXT' file should be careful to avoid errors if
it is evaluated more than once.