GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Functions | Variables
gdb.printing Namespace Reference

Classes

class  _EnumInstance
 
class  FlagEnumerationPrinter
 
class  PrettyPrinter
 
class  RegexpCollectionPrettyPrinter
 
class  SubPrettyPrinter
 

Functions

def register_pretty_printer (obj, printer, replace=False)
 
def add_builtin_pretty_printer (name, regexp, printer)
 

Variables

RegexpCollectionPrettyPrinter _builtin_pretty_printers = RegexpCollectionPrettyPrinter("builtin")
 

Detailed Description

Utilities for working with pretty-printers.

Function Documentation

◆ add_builtin_pretty_printer()

def gdb.printing.add_builtin_pretty_printer (   name,
  regexp,
  printer 
)

◆ register_pretty_printer()

def gdb.printing.register_pretty_printer (   obj,
  printer,
  replace = False 
)
Register pretty-printer PRINTER with OBJ.

The printer is added to the front of the search list, thus one can override
an existing printer if one needs to.  Use a different name when overriding
an existing printer, otherwise an exception will be raised; multiple
printers with the same name are disallowed.

Arguments:
    obj: Either an objfile, progspace, or None (in which case the printer
        is registered globally).
    printer: Either a function of one argument (old way) or any object
        which has attributes: name, enabled, __call__.
    replace: If True replace any existing copy of the printer.
        Otherwise if the printer already exists raise an exception.

Returns:
    Nothing.

Raises:
    TypeError: A problem with the type of the printer.
    ValueError: The printer's name contains a semicolon ";".
    RuntimeError: A printer with the same name is already registered.

If the caller wants the printer to be listable and disableable, it must
follow the PrettyPrinter API.  This applies to the old way (functions) too.
If printer is an object, __call__ is a method of two arguments:
self, and the value to be pretty-printed.  See PrettyPrinter.

Definition at line 72 of file printing.py.

Referenced by gdb.printing.FlagEnumerationPrinter.__call__(), and gdb.printing.SubPrettyPrinter.__init__().

Variable Documentation

◆ _builtin_pretty_printers

RegexpCollectionPrettyPrinter gdb.printing._builtin_pretty_printers = RegexpCollectionPrettyPrinter("builtin")
protected

Definition at line 277 of file printing.py.