gdb.printing (Debugging with ROCGDB)

Next: gdb.types, Up: Python modules [Contents][Index]

#### 24.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 `enum` values. Unlike ROCGDB’s built-in `enum` printing, this printer attempts to work properly when there is some overlap between the enumeration constants. The argument name is the name of the printer and also the name of the `enum` type to look up.

`register_pretty_printer (obj, printer, replace=False)`

  Register printer with the pretty-printer list of obj. If replace is `True` then any existing copy of the printer is replaced. Otherwise a `RuntimeError` exception is raised if a printer with the same name already exists.