22.8 Automatically loading associated files =========================================== GDB sometimes reads files with commands and settings automatically, without being explicitly told so by the user. We call this feature "auto-loading". While auto-loading is useful for automatically adapting GDB to the needs of your project, it can sometimes produce unexpected results or introduce security risks (e.g., if the file comes from untrusted sources).
· Init File in the Current Directory 'set/show/info auto-load local-gdbinit' · libthread_db.so.1 file 'set/show/info auto-load libthread-db' · Auto-loading safe path 'set/show/info auto-load safe-path' · Auto-loading verbose mode 'set/show debug auto-load' There are various kinds of files GDB can automatically load. In addition to these files, GDB supports auto-loading code written in various extension languages. Auto-loading extensions. Note that loading of these associated files (including the local '.gdbinit' file) requires accordingly configured 'auto-load safe-path' (Auto-loading safe path). For these reasons, GDB includes commands and options to let you control when to auto-load files and which files should be auto-loaded. 'set auto-load off' Globally disable loading of all auto-loaded files. You may want to -init-eval-command::) such as: $ gdb -iex "set auto-load off" untrusted-executable corefile Be aware that system init file (System-wide configuration) File::) still get read (as they come from generally trusted directories). To prevent GDB from auto-loading even those init files, use the '-nx' option (Mode Options), in addition to 'set auto-load no'. 'show auto-load' Show whether auto-loading of each specific 'auto-load' file(s) is enabled or disabled. (gdb) show auto-load gdb-scripts: Auto-loading of canned sequences of commands scripts is on. libthread-db: Auto-loading of inferior specific libthread_db is on. local-gdbinit: Auto-loading of .gdbinit script from current directory is on. python-scripts: Auto-loading of Python scripts is on. safe-path: List of directories from which it is safe to auto-load files is $debugdir:$datadir/auto-load. scripts-directory: List of directories from which to load auto-loaded scripts is $debugdir:$datadir/auto-load. 'info auto-load' Print whether each specific 'auto-load' file(s) have been auto-loaded or not. (gdb) info auto-load gdb-scripts: Loaded Script Yes /home/user/gdb/gdb-gdb.gdb libthread-db: No auto-loaded libthread-db. local-gdbinit: Local .gdbinit file "/home/user/gdb/.gdbinit" has been loaded. python-scripts: Loaded Script Yes /home/user/gdb/gdb-gdb.py These are GDB control commands for the auto-loading: set auto-load off. Disable auto-loading globally. show auto-load. Show setting of all kinds of files. info auto-load. Show state of all kinds of files. set auto-load gdb-scripts. Control for GDB command scripts. show auto-load gdb-scripts. Show setting of GDB command scripts. info auto-load gdb-scripts. Show state of GDB command scripts. set auto-load python-scripts.Control for GDB Python scripts. show auto-load python-scripts.Show setting of GDB Python scripts. info auto-load python-scripts.Show state of GDB Python scripts. set auto-load guile-scripts. Control for GDB Guile scripts. show auto-load guile-scripts.Show setting of GDB Guile scripts. info auto-load guile-scripts.Show state of GDB Guile scripts. set auto-load scripts-directory.Control for GDB auto-loaded scripts location. show auto-load scripts-directory.Show GDB auto-loaded scripts location. add-auto-load-scripts-directory.Add directory for auto-loaded scripts location list. set auto-load local-gdbinit. Control for init file in the current directory. show auto-load local-gdbinit.Show setting of init file in the current directory. info auto-load local-gdbinit.Show state of init file in the current directory. set auto-load libthread-db. Control for thread debugging library. show auto-load libthread-db. Show setting of thread debugging library. info auto-load libthread-db. Show state of thread debugging library. set auto-load safe-path. Control directories trusted for automatic loading. show auto-load safe-path. Show directories trusted for automatic loading. add-auto-load-safe-path. Add directory trusted for automatic loading.