gdb can be configured to have a system-wide init file; this file will be read and executed at startup (see What gdb does during startup).
Here is the corresponding configure option:
If gdb has been configured with the option --prefix=$prefix, it may be subject to relocation. Two possible cases:
If the configured location of the system-wide init file (as given by the
--with-system-gdbinit option at configure time) is in the
data-directory (as specified by --with-gdb-datadir at configure
time) or in one of its subdirectories, then gdb will look for the
system-wide init file in the directory specified by the
--data-directory command-line option.
Note that the system-wide init file is only read once, during gdb
initialization. If the data-directory is changed after gdb has
started with the
set data-directory command, the file will not be