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

Classes

class  _EnumInstance
 
class  FlagEnumerationPrinter
 
class  NoOpArrayPrinter
 
class  NoOpPointerReferencePrinter
 
class  NoOpScalarPrinter
 
class  NoOpStructPrinter
 
class  PrettyPrinter
 
class  RegexpCollectionPrettyPrinter
 
class  SubPrettyPrinter
 

Functions

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

Variables

 _builtin_pretty_printers = RegexpCollectionPrettyPrinter("builtin")
 

Detailed Description

Utilities for working with pretty-printers.

Function Documentation

◆ add_builtin_pretty_printer()

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

◆ make_visualizer()

gdb.printing.make_visualizer ( value)
Given a gdb.Value, wrap it in a pretty-printer.

If a pretty-printer is found by the usual means, it is returned.
Otherwise, VALUE will be wrapped in a no-op visualizer.

Definition at line 357 of file printing.py.

Referenced by gdb.dap.varref.VariableReference._update_value().

◆ register_pretty_printer()

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.NoOpStructPrinter.children().

Variable Documentation

◆ _builtin_pretty_printers

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

Definition at line 394 of file printing.py.