Here’s the description of what GDB does during session startup:
-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 GDB init files get executed and before inferior gets loaded.
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 GDB. See Init File in the Current Directory during Startup.
If the command line specified a program to debug, or a process to attach to, or a core file, GDB 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
-ex’ does not work because the auto-loading is then turned
off too late.
-ex’ and ‘
-x’ options in their specified order. See Command Files, for more details about GDB command files.