Next: Python modules, Previous: Python API, Up: Python
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 (see objfile-gdb.py file)
and .debug_gdb_scripts
section
(see dotdebug_gdb_scripts section).
The auto-loading feature is useful for supplying application-specific debugging commands and scripts.
Auto-loading can be enabled or disabled, and the list of auto-loaded scripts can be printed.
set auto-load-scripts [yes|no]
show auto-load-scripts
info auto-load-scripts [
regexp]
Also printed is the list of scripts that were mentioned in
the .debug_gdb_scripts
section and were not found
(see dotdebug_gdb_scripts section).
This is useful because their names are not printed when gdb
tries to load them and fails. There may be many of them, and printing
an error message for each one is problematic.
If regexp is supplied only scripts with matching names are printed.
Example:
(gdb) info auto-load-scripts Loaded Script Yes py-section-script.py full name: /tmp/py-section-script.py Missing my-foo-pretty-printers.py
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.