GDB (xrefs)
Classes | Functions | Variables
gdb.printing Namespace Reference

Classes

class  _EnumInstance
 
class  FlagEnumerationPrinter
 
class  PrettyPrinter
 
class  RegexpCollectionPrettyPrinter
 
class  SubPrettyPrinter
 

Functions

def register_pretty_printer
 
def add_builtin_pretty_printer (name, regexp, printer)
 

Variables

 basestring = str
 
 long = int
 
tuple _builtin_pretty_printers = RegexpCollectionPrettyPrinter("builtin")
 

Function Documentation

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

Definition at line 284 of file printing.py.

Referenced by gdb.printing.FlagEnumerationPrinter.__call__().

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 76 of file printing.py.

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

Variable Documentation

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

Definition at line 278 of file printing.py.

gdb.printing.basestring = str

Definition at line 26 of file printing.py.

gdb.printing.long = int