Next: , Previous: , Up: Invoking GDB   [Contents][Index]


2.1.3 What GDB Does During Startup

Here’s the description of what GDB does during session startup:

  1. Performs minimal setup required to initialize basic internal state.
  2. Reads commands from the early initialization file (if any) in your home directory. Only a restricted set of commands can be placed into an early initialization file, see Initialization Files, for details.
  3. Executes commands and command files specified by the ‘-eiex’ and ‘-eix’ command line options in their specified order. Only a restricted set of commands can be used with ‘-eiex’ and ‘eix’, see Initialization Files, for details.
  4. Sets up the command interpreter as specified by the command line (see interpreter).
  5. Reads the system wide initialization file and the files from the system wide initialization directory, see System Wide Init Files.
  6. Reads the initialization file (if any) in your home directory and executes all the commands in that file, see Home Directory Init File.
  7. 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 GDB init files get executed and before inferior gets loaded.
  8. Processes command line options and operands.
  9. Reads and executes the commands from the initialization 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 GDB. See Init File in the Current Directory during Startup.
  10. 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
    

    Option ‘-ex’ does not work because the auto-loading is then turned off too late.

  11. Executes commands and command files specified by the ‘-ex’ and ‘-x’ options in their specified order. See Command Files, for more details about GDB command files.
  12. Reads the command history recorded in the history file. See Command History, for more details about the command history and the files where GDB records it.

Next: , Previous: , Up: Invoking GDB   [Contents][Index]