gdb.printing (Debugging with GDB)
From Get docs
Gdb/docs/latest/gdb/gdb 002eprinting
Next: gdb.types, Up: Python modules [Contents][Index]
23.3.4.1 gdb.printing
This module provides a collection of utilities for working with pretty-printers.
PrettyPrinter (name, subprinters=None)- This class specifies the API that makes ‘
info pretty-printer’, ‘enable pretty-printer’ and ‘disable pretty-printer’ work. Pretty-printers should generally inherit from this class. SubPrettyPrinter (name)- For printers that handle multiple types, this class specifies the corresponding API for the subprinters.
RegexpCollectionPrettyPrinter (name)- Utility class for handling multiple printers, all recognized via regular expressions. See Writing a Pretty-Printer, for an example.
FlagEnumerationPrinter (name)- A pretty-printer which handles printing of
enumvalues. Unlike GDB’s built-inenumprinting, this printer attempts to work properly when there is some overlap between the enumeration constants. The argumentnameis the name of the printer and also the name of theenumtype to look up. register_pretty_printer (obj, printer, replace=False)- Register
printerwith the pretty-printer list ofobj. IfreplaceisTruethen any existing copy of the printer is replaced. Otherwise aRuntimeErrorexception is raised if a printer with the same name already exists.