Previous: Python API, Up: Python


23.2.3 Auto-loading

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]
Enable or disable the Python auto-loading feature.


maint show python auto-load
Show whether Python auto-loading is enabled or disabled.

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.