When a new object file is read (for example, due to the file
command, or because the inferior has loaded a shared library),
gdb will look for Python support scripts in several ways:
objfile-gdb.py and .debug_gdb_scripts
section.
The auto-loading feature is useful for supplying application-specific debugging commands and scripts.
Auto-loading can be enabled or disabled.
maint set python auto-load [yes|no]
maint show python auto-load
When reading an auto-loaded file, gdb sets the
current objfile. This is available via the gdb.current_objfile
function (see Objfiles In Python). This can be useful for
registering objfile-specific pretty-printers.