Current File : //usr/share/gdb/python/gdb/printing.pyo |
�
�� Rc @ s� d Z d d l Z d d l Z d d l Z d d l Z e j d d k rX e Z e Z n d e
f d � � YZ d e
f d � � YZ e
d � Z d
e f d � � YZ d d d
� � YZ d e f d � � YZ d S( s+ Utilities for working with pretty-printers.i����Ni i t
PrettyPrinterc B s# e Z d Z d d � Z d � Z RS( s A basic pretty-printer.
Attributes:
name: A unique string among all printers for the context in which
it is defined (objfile, progspace, or global(gdb)), and should
meaningfully describe what can be pretty-printed.
E.g., "StringPiece" or "protobufs".
subprinters: An iterable object with each element having a `name'
attribute, and, potentially, "enabled" attribute.
Or this is None if there are no subprinters.
enabled: A boolean indicating if the printer is enabled.
Subprinters are for situations where "one" pretty-printer is actually a
collection of several printers. E.g., The libstdc++ pretty-printer has
a pretty-printer for each of several different types, based on regexps.
c C s | | _ | | _ t | _ d S( N( t namet subprinterst Truet enabled( t selfR R ( ( s% /usr/share/gdb/python/gdb/printing.pyt __init__3 s c C s t d � � d S( Ns PrettyPrinter __call__( t NotImplementedError( R t val( ( s% /usr/share/gdb/python/gdb/printing.pyt __call__8 s N( t __name__t
__module__t __doc__t NoneR R ( ( ( s% /usr/share/gdb/python/gdb/printing.pyR s t SubPrettyPrinterc B s e Z d Z d � Z RS( s� Baseclass for sub-pretty-printers.
Sub-pretty-printers needn't use this, but it formalizes what's needed.
Attributes:
name: The name of the subprinter.
enabled: A boolean indicating if the subprinter is enabled.
c C s | | _ t | _ d S( N( R R R ( R R ( ( s% /usr/share/gdb/python/gdb/printing.pyR G s ( R
R R R ( ( ( s% /usr/share/gdb/python/gdb/printing.pyR = s c C s� t | d � r/ t | d � r/ t d � � n t | d � r] t | d � r] t d � � n t | d � s{ t d � � n | d k r� t j d � r� t j d t � n t } n/ t j d � r� t j d
| j | j f � n t | d � r�t | j t � st d � � n | j j
d � d
k r9t d � � n d
} xi | j D][ } t | d � r�| j | j k r�| r�| j | =Pq�t
d | j � � n | d } qIWn | j j d
| � d S( s� 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.
R
R s printer missing attribute: nameR s"