Next: , Previous: , Up: Guile API   [Contents][Index] Selecting Guile Pretty-Printers

The Guile list *pretty-printers* contains a set of <gdb:pretty-printer> registered objects. Printers in this list are called global printers, they’re available when debugging any inferior. In addition to this, each <gdb:objfile> object contains its own set of pretty-printers (see Objfiles In Guile).

Pretty-printer lookup is done by passing the value to be printed to the lookup function of each enabled object in turn. Lookup stops when a lookup function returns a non-#f value or when the list is exhausted.

GDB first checks the result of objfile-pretty-printers of each <gdb:objfile> in the current program space and iteratively calls each enabled lookup function in the list for that <gdb:objfile> until a non-#f object is returned. Lookup functions must return either a <gdb:pretty-printer-worker> object or #f. Otherwise an exception is thrown. If no pretty-printer is found in the objfile lists, GDB then searches the global pretty-printer list, calling each enabled function until a non-#f object is returned.

The order in which the objfiles are searched is not specified. For a given list, functions are always invoked from the head of the list, and iterated over sequentially until the end of the list, or a <gdb:pretty-printer-worker> object is returned.

For various reasons a pretty-printer may not work. For example, the underlying data structure may have changed and the pretty-printer is out of date.

The consequences of a broken pretty-printer are severe enough that GDB provides support for enabling and disabling individual printers. For example, if print frame-arguments is on, a backtrace can become highly illegible if any argument is printed with a broken printer.

Pretty-printers are enabled and disabled from Scheme by calling set-pretty-printer-enabled!. See Guile Pretty Printing API.

Next: , Previous: , Up: Guile API   [Contents][Index]