### 23.5 Auto-loading extensions ¶

GDB provides two mechanisms for automatically loading extensions when a new object file is read (for example, due to the `file` command, or because the inferior has loaded a shared library): `objfile-gdb.ext` (see The `objfile-gdb.ext` file) and the `.debug_gdb_scripts` section of modern file formats like ELF (see The `.debug_gdb_scripts` section). For a discussion of the differences between these two approaches see Which flavor to choose?.

The auto-loading feature is useful for supplying application-specific debugging commands and features.

Auto-loading can be enabled or disabled, and the list of auto-loaded scripts can be printed. See the ‘`auto-loading`’ section of each extension language for more information. For GDB command files see Controlling auto-loading native GDB scripts. For Python files see Python Auto-loading.

Note that loading of this script file also requires accordingly configured `auto-load safe-path` (see Security restriction for auto-loading).