GIF89a; EcchiShell v1.0
//proc/self/root/usr/share/gdb/python/ó ›à Rc@sÓdZddlZddlZddlZddlZejddkrXeZeZ nde fd„ƒYZ de fd„ƒYZ e d „Zd e fd „ƒYZd dd „ƒYZde fd„ƒYZdS(s+Utilities for working with pretty-printers.iÿÿÿÿNiit PrettyPrintercBs#eZdZdd„Zd„ZRS(sA 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. cCs||_||_t|_dS(N(tnamet subprinterstTruetenabled(tselfRR((s%/usr/share/gdb/python/gdb/printing.pyt__init__3s  cCstdƒ‚dS(NsPrettyPrinter __call__(tNotImplementedError(Rtval((s%/usr/share/gdb/python/gdb/printing.pyt__call__8sN(t__name__t __module__t__doc__tNoneRR (((s%/usr/share/gdb/python/gdb/printing.pyRs tSubPrettyPrintercBseZdZd„ZRS(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. cCs||_t|_dS(N(RRR(RR((s%/usr/share/gdb/python/gdb/printing.pyRGs (R R R R(((s%/usr/share/gdb/python/gdb/printing.pyR=scCsÂt|dƒ r/t|dƒ r/tdƒ‚nt|dƒr]t|dƒ r]tdƒ‚nt|dƒs{tdƒ‚n|dkr³tjdƒrªtjd tƒnt}n/tjdƒrâtjd |j|jfƒnt|dƒr«t|jt ƒstd ƒ‚n|jj d ƒd kr9t dƒ‚nd }xi|j D][}t|dƒrš|j|jkrš|r„|j |=Pqšt d|jƒ‚n|d}qIWn|j jd |ƒdS(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 Rsprinter missing attribute: nameRs"printer missing attribute: enabledR s#printer missing attribute: __call__tverboses)Registering global %s pretty-printer ... s)Registering %s pretty-printer for %s ... sprinter name is not a stringt;issemicolon ';' in printer names%pretty-printer already registered: %siN(thasattrt TypeErrorR tgdbt parametertwriteRtfilenamet isinstancet basestringtfindt ValueErrortpretty_printerst RuntimeErrortinsert(tobjtprintertreplacetitp((s%/usr/share/gdb/python/gdb/printing.pytregister_pretty_printerLs8"    ! tRegexpCollectionPrettyPrintercBs?eZdZdefd„ƒYZd„Zd„Zd„ZRS(syClass for implementing a collection of regular-expression based pretty-printers. Intended usage: pretty_printer = RegexpCollectionPrettyPrinter("my_library") pretty_printer.add_printer("myclass1", "^myclass1$", MyClass1Printer) ... pretty_printer.add_printer("myclassN", "^myclassN$", MyClassNPrinter) register_pretty_printer(obj, pretty_printer) tRegexpSubprintercBseZd„ZRS(cCsAttj|ƒj|ƒ||_||_tj|ƒ|_dS(N( tsuperR$R%Rtregexpt gen_printertretcompilet compiled_re(RRR'R(((s%/usr/share/gdb/python/gdb/printing.pyR¥s  (R R R(((s%/usr/share/gdb/python/gdb/printing.pyR%¤scCstt|ƒj|gƒdS(N(R&R$R(RR((s%/usr/share/gdb/python/gdb/printing.pyR«scCs#|jj|j|||ƒƒdS(soAdd a printer to the list. The printer is added to the end of the list. Arguments: name: The name of the subprinter. regexp: The regular expression, as a string. gen_printer: A function/method that given a value returns an object to pretty-print it. Returns: Nothing. N(RtappendR%(RRR'R(((s%/usr/share/gdb/python/gdb/printing.pyt add_printer®scCsbtjj|jƒj}|s"dSx9|jD].}|jr,|jj |ƒr,|j |ƒSq,WdS(s1Lookup the pretty-printer for the provided value.N( Rttypestget_basic_typettypettagR RRR+tsearchR((RRttypenameR((s%/usr/share/gdb/python/gdb/printing.pyR Ås(R R R RR%RR-R (((s%/usr/share/gdb/python/gdb/printing.pyR$˜s    t _EnumInstancecBseZd„Zd„ZRS(cCs||_||_dS(N(t enumeratorsR(RR5R((s%/usr/share/gdb/python/gdb/printing.pyRÚs cCs§g}t|jƒ}t}xH|jD]=\}}||@dkr%|j|ƒ||@}t}q%q%W| sy|dkr|jd|ƒnd|jdj|ƒfS(Niss 0x%x [%s]s | (tlongRtFalseR5R,Rtjoin(Rt flag_listtvt any_foundte_namete_value((s%/usr/share/gdb/python/gdb/printing.pyt to_stringÞs   (R R RR>(((s%/usr/share/gdb/python/gdb/printing.pyR4Ùs tFlagEnumerationPrintercBs eZdZd„Zd„ZRS(sÈA pretty-printer which can be used to print a flag-style enumeration. A flag-style enumeration is one where the enumerators are or'd together to create values. The new printer will print these symbolically using '|' notation. The printer must be registered manually. This printer is most useful when an enum is flag-like, but has some overlap. GDB's built-in printing will not handle this case, but this printer will attempt to.cCs#tt|ƒj|ƒt|_dS(N(R&R?RR7t initialized(Rt enum_type((s%/usr/share/gdb/python/gdb/printing.pyRõscCsš|jsyt|_tj|jƒ}g|_x0|jƒD]"}|jj|j|jfƒq:W|jj dd„ƒn|j r’t |j|ƒSdSdS(NtkeycSs|jS(N(tenumval(tx((s%/usr/share/gdb/python/gdb/printing.pyts( R@RRt lookup_typeRR5tfieldsR,RCtsortRR4R (RRtflagstfield((s%/usr/share/gdb/python/gdb/printing.pyR ùs     (R R R RR (((s%/usr/share/gdb/python/gdb/printing.pyR?ìs ((R Rt gdb.typesR)tsyst version_infotstrRtintR6tobjectRRR7R#R$R4R?(((s%/usr/share/gdb/python/gdb/printing.pyts       LA