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 (obj, printer, replace=False)
def | add_builtin_pretty_printer (name, regexp, printer)

## Variables
| basestring
| long
| _builtin_pretty_printers

## Function Documentation

## ◆ add_builtin_pretty_printer()

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

Definition at line 284 of file printing.py.

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

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

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

## Variable Documentation

## ◆ _builtin_pretty_printers

gdb.printing._builtin_pretty_printers
| private

Definition at line 278 of file printing.py.

## ◆ basestring

gdb.printing.basestring

Definition at line 26 of file printing.py.

## ◆ long

gdb.printing.long

Definition at line 27 of file printing.py.

Referenced by gdb.printing._EnumInstance.to_string().