Objfiles In Python

gdb loads symbols for an inferior from various symbol-containing files (see Files). These include the primary executable file, any shared libraries used by the inferior, and any separate debug info files (see Separate Debug Files). gdb calls these symbol-containing files objfiles.

The following objfile-related functions are available in the gdb module:

— Function: current_objfile

When auto-loading a Python script (see Auto-loading), gdb sets the “current objfile” to the corresponding objfile. This function returns the current objfile. If there is no current objfile, this function returns None.

— Function: objfiles

Return a sequence of all the objfiles current known to gdb. See Objfiles In Python.

Each objfile is represented by an instance of the gdb.Objfile class.

— Instance Variable of Objfile: filename

The file name of the objfile as a string.

— Instance Variable of Objfile: pretty_printers

The pretty_printers attribute is a list of functions. It is used to look up pretty-printers. A Value is passed to each function in order; if the function returns None, then the search continues. Otherwise, the return value should be an object which is used to format the value. See Pretty Printing API, for more information.