a Wh@sddlZddlZddlZddlZddlZddlZejddkrXeZe Z e Z e ZejjZn6GdddZddlm Z m Z GdddejZeZdaz ddlZWneyd aYn0d azddlZeejd rdaWneyYn0eed rejZneZd d ZdaddZddZ ddZ!ddZ"ddZ#ddZ$ddZ%ddZ&Gdd d eZ'Gd!d"d"eZ(d#d$Z)d%d&Z*d'd(Z+Gd)d*d*eZ,d+d,Z-d-d.Z.Gd/d0d0eZ/Gd1d2d2eZ0Gd3d4d4e0Z1Gd5d6d6e0Z2Gd7d8d8eZ3Gd9d:d:eZ4Gd;d<dd>eZ6Gd?d@d@eZ7GdAdBdBeZ8GdCdDdDeZ9GdEdFdFeZ:GdGdHdHeZ;dIdJZdOdPZ?GdQdRdReZ@GdSdTdTeZAGdUdVdVeZBGdWdXdXeZCGdYdZdZeZDGd[d\d\eZEd]d^ZFGd_d`d`eZGGdadbdbeZHGdcddddeZIGdedfdfeZJGdgdhdheZKGdidjdjeZLGdkdldleZMGdmdndneZNdodpZOGdqdrdreNZPGdsdtdteNZQGdudvdveNZRGdwdxdxeNZSGdydzdzeZTGd{d|d|eZUGd}d~d~eZVGdddeZWGdddeZXGdddeZYGdddeZZGdddeZ[GdddeZ\GdddeZ]GdddeZ^GdddeZ_GdddeZ`GdddeZagdZbgdZcGdddeZdGdddeZeGdddeZfGdddeZgGdddeZhGdddeZiGdddeZjGdddeZkGdddeZlGdddeZmdanGdddeZoddZpGdddeZqdddZrddZsddZtddZueudS)Nc@seZdZdZddZdS)Iteratora:Compatibility mixin for iterators Instead of writing next() methods for iterators, write __next__() methods and use this mixin to make them work in Python 2 as well as Python 3. Idea stolen from the "six" documentation: cCs|SN)__next__selfr1/usr/share/gcc-11/python/libstdcxx/v6/printers.pynext?sz Iterator.nextN)__name__ __module__ __qualname____doc__r rrrr r4s r)imapizipc@s(eZdZdZddZddZddZdS) UTCz5Concrete tzinfo class representing the UTC time zone.cCs tdSNrdatetimeZ timedeltardtrrr utcoffsetIsz UTC.utcoffsetcCsdS)Nrrrrrr tznameLsz UTC.tznamecCs tdSrrrrrr dstOszUTC.dstN)r r r rrrrrrrr rFsrTFZ TypePrinter ValuePrintercCsv|}d|j|f}z t|WSty4Yn0|}t|r\|djr\|dj}qt dt ||fqdS)Nz%s::%srzCannot find type %s::%s) strip_typedefstaggdb lookup_type RuntimeErrorfieldslen is_base_classtype ValueErrorstr)Zorignametypsearchr rrr find_typens   r)z__8::c Gsd|ddd|D}z t|WStjy}zXt|vr|ddtd}zt|WWYd}~StjyYn0|WYd}~n d}~00dS)z8 Lookup template specialization templ. z{}<{}>, cSsg|] }t|qSr)r%).0arrr z%lookup_templ_spec..::N)formatjoinrrerror_versioned_namespacereplace)Ztemplargsterrr lookup_templ_specs r9c Csd|vrd|}zt|d}Wn|d}Yn0|}z t||WStjyt|drt|dddr|dd d }zt||WYStjyYn0Yd S0d S) a Lookup specialization of template nodename corresponding to containertype. nodename - The name of a class template, as a String containertype - The container, as a gdb.Type Return a gdb.Type for the corresponding specialization of nodename, or None if the type cannot be found. e.g. lookup_node_type('_List_node', gdb.lookup_type('std::list')) will return a gdb.Type for the type std::_List_node. r/std:: value_typerZstdzstd::__cxx1998z std::__debugZ __gnu_debugz ::__cxx1998::r0N)r)template_argumentrr9rr3is_member_of_namespacer5)nodenameZ containertypevaltyperrr lookup_node_types(  r@cGs>t|tjrt|}t|}|D]}||dr dSq dS)z Test whether a type is a member of one of the specified namespaces. The type can be specified as a string or a gdb.Type object. r/TF) isinstancerTyper%strip_versioned_namespace startswith)r'Z namespaces namespacerrr r=s r=cCs2t|tjr|j}dt|f}td||duS)z Test whether a type is a specialization of the named class template. The type can be specified as a string or a gdb.Type object. The template should be the name of a class template as a string, without any 'std' qualification. z(%s)?%sz ^std::%s<.*>$N)rArrBrr4rematch)x template_namerrr is_specialization_ofs  rJcCs |tdS)N)r5r4)typenamerrr rCsrCcCs<d}d}tjddkr&t|||dStj|||ddSdS)zCRemove "fundamentals_vN" inline namespace from qualified type name.z&^std::experimental::fundamentals_v\d::std::experimental::rrr0)countN)sys version_inforFsub)r'patternreplrrr strip_fundts_namespaces rTcCsRt|}|dd}d}dD]}|||d|}q|d}||d|}|S)zARemove known inline namespaces from the canonical name of a type.std::__cxx11::r:rM)Zfundamentals_v1Zfundamentals_v2r/z filesystem::zv1::)rCr5)type_strZexpt_nsZlfts_nsZfs_nsrrr strip_inline_namespacess rWcCs<d}g}z|||Wn|YS0|d7}qdS)z-Return a type's template arguments as a list.rr0N)appendr<)type_objn template_argsrrr get_template_arg_lists r\c@s(eZdZdZddZddZddZdS) SmartPtrIteratorz@An iterator for smart pointer types with a single 'child' value.cCs ||_dSr_valrvalrrr __init__szSmartPtrIterator.__init__cCs|Srrrrrr __iter__szSmartPtrIterator.__iter__cCs$|jdurtd|j|_}d|fS)Nzget()r_ StopIterationr`rrr r s zSmartPtrIterator.__next__Nr r r rrbrcrrrrr r]sr]c@s0eZdZdZddZddZddZdd Zd S) SharedPointerPrinterzP Print a shared_ptr, weak_ptr, atomic, or atomic. cCst||_||_|d|_dSN_M_ptr)rC _typenamer__pointerrrLrarrr rbs zSharedPointerPrinter.__init__cCs t|jSr)r]rkrrrr childrenszSharedPointerPrinter.childrencCsR|jdkrD|jddd}||d}t|jdjd}||S|jddS)Nz std::atomicZ _M_refcountZ_M_val_M_irpointerZ_M_pi)rjr_r)r#cast)rZptr_valZptr_typerrr _get_refcountss    z#SharedPointerPrinter._get_refcountscCspd}|}|jjd}tt|}|dkr`|d}|d}|dkrPd|}nd||df}d|j||fS) NemptyrZ _M_use_countZ _M_weak_countzexpired, weak count %dzuse count %d, weak count %dr0z %s<%s> (%s))rqr_r#r<rCr%rj)rstateZ refcountstargZusecountZ weakcountrrr to_string(s  zSharedPointerPrinter.to_stringN)r r r rrbrmrqrurrrr rgs  rgcCs|j}|djs&tdt|j||dj}|j}t|dkr^tdt|j|djdkrt|dS|djr||djStdt|jdS)zBReturn the tuple element stored in a _Tuple_impl base class.z-Unsupported implementation for std::tuple: %sr _M_head_implN)r#r r"r$r%rpr!r&)rabasesZ head_baser rrr _tuple_impl_get9s$        rycCsdtt|j}||krtd||jdj}|dkr\||jdj}|d8}q4t|S)z6Return the result of std::get(val) on a std::tuple.z0Out of range index for std::get on std::tuplerr0)r!r\r#r$rpr ry)rZraZ tuple_sizenoderrr tuple_getQs r{cCsd|jdj}t|ds(t|dr6|dd}n$t|drJ|d}ntdt|td|S)z4Return the result of val.get() on a std::unique_ptr.rZ__uniq_ptr_dataZ__uniq_ptr_impl_M_ttuplez-Unsupported implementation for unique_ptr: %s)r#r rrJr$r%r{)raZ impl_typeZ tuple_memberrrr unique_ptr_get_s    r~c@s(eZdZdZddZddZddZdS) UniquePointerPrinterzPrint a unique_ptr.cCs ||_dSrr^rlrrr rbtszUniquePointerPrinter.__init__cCstt|jSr)r]r~r_rrrr rmwszUniquePointerPrinter.childrencCs|jjd}dt|S)Nrzstd::unique_ptr<{}>)r_r#r<r1r%rr7rrr ruzszUniquePointerPrinter.to_stringN)r r r rrbrmrurrrr rqsrcCs|dj|S)z7Return the value held in a __gnu_cxx::__aligned_membuf. _M_storage)addressrpro dereference)Zbufr?rrr get_value_from_aligned_membufsrcCsnzJ|jdj}|dkr$|dWS|dkrH|jd}t|d|WSWn Yn0tdt|jdS)z-Return the value held in an _List_node<_Val>.r0_M_datarr!Unsupported implementation for %sNr#r r&r<rr$r%rzmemberr?rrr get_value_from_list_nodes  rc@s8eZdZdZGdddeZddZddZdd Zd S) StdListPrinterzPrint a std::list.c@s$eZdZddZddZddZdS)zStdListPrinter._iteratorcCs"||_|d|_|j|_d|_dSN_M_nextr) _nodetype_baser_head_countrnodetypeheadrrr rbs z!StdListPrinter._iterator.__init__cCs|Srrrrrr rcsz!StdListPrinter._iterator.__iter__cCsR|j|jkrt|j|j}|d|_|j}|jd|_t|}d||fS)Nrr0[%d])rrrerprrrr)reltrNrarrr rs   z!StdListPrinter._iterator.__next__Nr r r rbrcrrrrr _iteratorsrcCst||_||_dSrrCrjr_rlrrr rbs zStdListPrinter.__init__cCs(td|jj}|||jddS)N _List_node_M_impl_M_noder@r_r#rorrrrrr rmszStdListPrinter.childrencCs0|jdd}|d|jkr&d|jSd|jS)Nrrrempty %s%s)r_rrj)rZheadnoderrr rus zStdListPrinter.to_stringN r r r rrrrbrmrurrrr rs rc@seZdZddZddZdS)NodeIteratorPrintercCs$||_||_||_t||j|_dSr)r_rj _contnamer@r#r)rrLraZcontnamer>rrr rbszNodeIteratorPrinter.__init__cCs:|jdsd|jS|jd|j}tt|S)Nrz(non-dereferenceable iterator for std::%s)r_rrprrorr%rrrzrrr rus    zNodeIteratorPrinter.to_stringN)r r r rbrurrrr rsrc@seZdZdZddZdS)StdListIteratorPrinterzPrint std::list::iterator.cCst|||dddS)Nlistrrrbrlrrr rbszStdListIteratorPrinter.__init__Nr r r rrbrrrr rsrc@seZdZdZddZdS)StdFwdListIteratorPrinterz"Print std::forward_list::iterator.cCst|||dddS)N forward_list_Fwd_list_noderrlrrr rbs z"StdFwdListIteratorPrinter.__init__Nrrrrr rsrc@s8eZdZdZGdddeZddZddZdd Zd S) StdSlistPrinterzPrint a __gnu_cxx::slist.c@s$eZdZddZddZddZdS)zStdSlistPrinter._iteratorcCs||_|dd|_d|_dS)N_M_headrrrrrrrrr rbsz"StdSlistPrinter._iterator.__init__cCs|Srrrrrr rcsz"StdSlistPrinter._iterator.__iter__cCsL|jdkrt|j|j}|d|_|j}|jd|_d||dfS)Nrrr0rr)rrerprrr)rrrNrrr rs   z"StdSlistPrinter._iterator.__next__Nrrrrr rsrcCs ||_dSrr^rlrrr rbszStdSlistPrinter.__init__cCs td|jj}|||jS)N__gnu_cxx::_Slist_node)r@r_r#rrorrrr rmszStdSlistPrinter.childrencCs|jdddkrdSdS)Nrrrzempty __gnu_cxx::slistz__gnu_cxx::slistr^rrrr ruszStdSlistPrinter.to_stringNrrrrr rs rc@s eZdZdZddZddZdS)StdSlistIteratorPrinterz!Print __gnu_cxx::slist::iterator.cCs ||_dSrr^rlrrr rbsz StdSlistIteratorPrinter.__init__cCs<|jdsdStd|jj}t|jd|dS)Nrz1non-dereferenceable iterator for __gnu_cxx::slistrr)r_r@r#ror%rprrrrr rus  z!StdSlistIteratorPrinter.to_stringNr r r rrbrurrrr rsrc@s@eZdZdZGdddeZddZddZdd Zd d Z d S) StdVectorPrinterzPrint a std::vector.c@s$eZdZddZddZddZdS)zStdVectorPrinter._iteratorcCs^||_|rH|d|_d|_|d|_|d|_|jj}d|j|_n ||_||_d|_ dS)N_M_pr _M_offset) _bitvec_item_so_finish_forr#sizeof_isizer)rstartfinishZbitvecityperrr rb s    z#StdVectorPrinter._iterator.__init__cCs|Srrrrrr rcsz#StdVectorPrinter._iterator.__iter__cCs|j}|jd|_|jr|j|jkr4|j|jkr4tt|jd|j>@}|jd|_|j|j krv|jd|_d|_d||fS|j|jkrt|j}|jd|_d||fSdS)Nr0rr) rrrrrrreboolrr)rrNrrrr rs         z#StdVectorPrinter._iterator.__next__Nrrrrr r srcCs*t||_||_|jdjtjk|_dSr) rCrjr_r#r<coderTYPE_CODE_BOOL_is_boolrlrrr rb0s zStdVectorPrinter.__init__cCs$||jdd|jdd|jS)Nr_M_start _M_finish)rr_rrrrr rm6s zStdVectorPrinter.childrenc Cs|jdd}|jdd}|jdd}|jr|jddd}|jddd}|jddd}|j}d|j}||||}|||}d|jt|t|fSd |jt||t||fSdS) NrrrZ_M_end_of_storagerrrz"%s of length %d, capacity %dz%s of length %d, capacity %d)r_rrr#rrjint) rrrendZforZbllengthZcapacityrrr ru;s"   zStdVectorPrinter.to_stringcCsdSNarrayrrrrr display_hintMszStdVectorPrinter.display_hintN) r r r rrrrbrmrurrrrr rs %rc@s eZdZdZddZddZdS)StdVectorIteratorPrinterzPrint std::vector::iterator.cCs ||_dSrr^rlrrr rbTsz!StdVectorIteratorPrinter.__init__cCs |jdsdSt|jdS)NZ _M_currentz,non-dereferenceable iterator for std::vectorr_r%rrrrr ruWs z"StdVectorIteratorPrinter.to_stringNrrrrr rQsrc@s eZdZdZddZddZdS)StdBitIteratorPrinterz@Print std::vector's _Bit_iterator and _Bit_const_iterator.cCs ||_dSrr^rlrrr rb`szStdBitIteratorPrinter.__init__cCs.|jdsdSt|jdd|jd>@S)Nrz2non-dereferenceable iterator for std::vectorr0rr_rrrrrr rucs   zStdBitIteratorPrinter.to_stringNrrrrr r]src@s eZdZdZddZddZdS)StdBitReferencePrinterz#Print std::vector::reference.cCs ||_dSrr^rlrrr rbmszStdBitReferencePrinter.__init__cCs*|jdsdSt|jd|jd@S)Nrz$invalid std::vector::referenceZ_M_maskrrrrr rups z StdBitReferencePrinter.to_stringNrrrrr rjsrc@s8eZdZdZGdddeZddZddZdd Zd S) StdTuplePrinterzPrint a std::tuple.c@s0eZdZeddZddZddZddZd S) zStdTuplePrinter._iteratorcCsNt|dkr"t|djdrBdSn t|dkr2dSt|dkrBdStddS)Nrr0Z __tuple_baseTrFz4Top of tuple tree does not consist of a single node.)r!rJr#r$)nodesrrr _is_nonempty_tuple}s   z,StdTuplePrinter._iterator._is_nonempty_tuplecCs:||_|jj}||r0|j|dj|_d|_dSr)rr#r rrpr)rrrrrr rbs   z"StdTuplePrinter._iterator.__init__cCs|Srrrrrr rcsz"StdTuplePrinter._iterator.__iter__cCs|js t|jj}t|dkr&tt|dkr:tdt|dkr`|j|dj}d|_n&|j|dj}|j|dj|_|jd|_|j}t|dks|djdkrd|jd|fSd|jd|dfSdS)Nrrz/Cannot parse more than 2 nodes in a tuple tree.r0rwr) rrer#r r!r$rprr&)rrimplr rrr rs&       z"StdTuplePrinter._iterator.__next__N)r r r staticmethodrrbrcrrrrr r|s   rcCst||_||_dSrrrlrrr rbs zStdTuplePrinter.__init__cCs ||jSr)rr_rrrr rmszStdTuplePrinter.childrencCs(t|jjdkrd|jSd|jS)Nrrz %s containing)r!r_r#r rjrrrr rus zStdTuplePrinter.to_stringNrrrrr rys Erc@s0eZdZdZddZddZddZdd Zd S) StdStackOrQueuePrinterz!Print a std::stack or std::queue.cCst||_t|d|_dS)Nc)rCrjrdefault_visualizer _visualizerrlrrr rbs zStdStackOrQueuePrinter.__init__cCs |jSr)rrmrrrr rmszStdStackOrQueuePrinter.childrencCsd|j|jfS)Nz%s wrapping: %s)rjrrurrrr rusz StdStackOrQueuePrinter.to_stringcCst|jdr|jSdS)Nr)hasattrrrrrrr rs  z#StdStackOrQueuePrinter.display_hintN)r r r rrbrmrurrrrr rs rc@s0eZdZdZddZddZddZdd Zd S) RbtreeIteratorzf Turn an RB-tree-based container (std::map, std::set etc.) into a Python iterable object. cCs2|ddd|_|dddd|_d|_dS)Nr|rZ _M_node_countZ _M_header_M_leftr)_size_noder)rZrbtreerrr rbszRbtreeIterator.__init__cCs|Srrrrrr rcszRbtreeIterator.__iter__cCs t|jSr)rrrrrr __len__szRbtreeIterator.__len__cCs|j|jkrt|j}|jd|_|j|jkr|j}|drh|d}|dr|d}qLnB|d}||dkr|}|d}qt|d|kr|}||_|S)Nr0Z_M_rightrZ _M_parent)rrrerr)rresultrzparentrrr rs$       zRbtreeIterator.__next__N)r r r rrbrcrrrrrr rs rcCsnzJ|jdj}|dkr$|dWS|dkrH|jd}t|d|WSWn Yn0tdt|jdS)z0Return the value held in an _Rb_tree_node<_Val>.r0Z_M_value_fieldrrrNrrrrr get_value_from_Rb_tree_node s  rc@s eZdZdZddZddZdS)StdRbtreeIteratorPrinterz2Print std::map::iterator, std::set::iterator, etc.cCs"||_td|jj}||_dSN _Rb_tree_node)r_r@r#ro _link_type)rrLrarrrr rb!sz!StdRbtreeIteratorPrinter.__init__cCs0|jdsdS|jd|j}tt|S)Nrz6non-dereferenceable iterator for associative container)r_rprrr%rrrrr ru&s z"StdRbtreeIteratorPrinter.to_stringNrrrrr rsrc@s eZdZdZddZddZdS)StdDebugIteratorPrinterz-Print a debug enabled version of an iterator.cCs ||_dSrr^rlrrr rb0sz StdDebugIteratorPrinter.__init__cCsbtd}|jjd}|j|d}|s|j}n |g}|j}|j|}g}d}||kr||}d}|dkr|d@dkr|d||d|df|d}|d?}qp|d}q\|S)NZ_M_wrr0rr)r_r#rrTYPE_CODE_ARRAYtargetrrX) rZwordsZwtypeZtsizeZnwordsrZbytewbitrrr rms,       zStdBitsetPrinter.childrenN)r r r rrbrurmrrrr rsrc@s@eZdZdZGdddeZddZddZdd Zd d Z d S) StdDequePrinterzPrint a std::deque.c@s$eZdZddZddZddZdS)zStdDequePrinter._itercCs(||_||_||_||_||_d|_dSr)r_p_end_last _buffer_sizer)rrzrrlastZ buffer_sizerrr rbs zStdDequePrinter._iter.__init__cCs|Srrrrrr rcszStdDequePrinter._iter.__iter__cCsr|j|jkrtd|j|jf}|jd|_|jd|_|j|jkrn|jd|_|jd|_|j|j|_|S)Nrr0r)rrrerrrrr)rrrrr rs      zStdDequePrinter._iter.__next__Nrrrrr rsrcCsHt||_||_|jd|_|jj}|dkr>td||_nd|_dS)Nrir0) rCrjr_r#r<Z_elttyperrr)rrLrasizerrr rbs zStdDequePrinter.__init__cCsx|jdd}|jdd}|d|dd}|d|d}|d|d}|j|||}d |jtt|fS) Nrrrrr0_M_last_M_cur_M_firstr)r_rrjrlong)rrrZdelta_nZdelta_sZdelta_errrr ruszStdDequePrinter.to_stringcCs@|jdd}|jdd}||d|d|d|d|jS)Nrrrrrr)r_rr)rrrrrr rms  zStdDequePrinter.childrencCsdSrrrrrr rszStdDequePrinter.display_hintNrrrrr rs   rc@s eZdZdZddZddZdS)StdDequeIteratorPrinterzPrint std::deque::iterator.cCs ||_dSrr^rlrrr rbsz StdDequeIteratorPrinter.__init__cCs |jdsdSt|jdS)Nrz+non-dereferenceable iterator for std::dequerrrrr ru s z!StdDequeIteratorPrinter.to_stringNrrrrr r sr c@s(eZdZdZddZddZddZdS) StdStringPrinterz'Print a std::basic_string of some kind.cCs||_|ddk|_dS)Nz::__cxx11::basic_stringrv)r_find _new_stringrlrrr rbszStdStringPrinter.__init__cCs|jj}|jtjkr|}|jdd}|jrL|jd}||j}n<| }t t |d }||d}| d}t|dr|j|dS|j|dS) NZ _M_dataplusrZ_M_string_lengthz::_Repr0Z _M_length lazy_stringr)r_r#rr TYPE_CODE_REFrrrpr unqualifiedrr%rorrrstring)rr#ptrrZrealtypeZreptypeheaderrrr rus      zStdStringPrinter.to_stringcCsdSNrrrrrr r-szStdStringPrinter.display_hintNr r r rrbrurrrrr r sr cCs"|d}|d}|d}|||fS)z'Access the streambuf put area pointers.Z _M_out_begZ _M_out_curZ _M_in_endr) streambufpbasepptregptrrrr access_streambuf_ptrs1src@s(eZdZdZddZddZddZdS) StdStringBufPrinterzPrint a std::basic_stringbuf.cCs ||_dSrr^)r_rarrr rb<szStdStringBufPrinter.__init__cCsJt|j\}}}|r@|r ||kr0|j||dS|j||dS|jdS)NrZ _M_string)rr_r)rrrrrrr ru?s  zStdStringBufPrinter.to_stringcCsdSrrrrrr rIsz StdStringBufPrinter.display_hintNrrrrr r9s rc@s(eZdZdZddZddZddZdS) StdStringStreamPrinterz Print a std::basic_stringstream.cCsZ||_||_dd|jDd}td||jtd|_ |j |djk|_ dS)NcSsg|]}|jr|jqSr)r"r#)r+frrr r-Xr.z3StdStringStreamPrinter.__init__..rZ__streamz$__stream->rdbuf() _M_stringbuf) r_rjr#r rZset_convenience_variablerprparse_and_eval _streambuf_was_redirected)rrLraZbasetyperrr rbPs  zStdStringStreamPrinter.__init__cCs$|jrd|j|jfS|jdS)Nz%s redirected to %sr!)r$rjr#rr_rrrr ru]s  z StdStringStreamPrinter.to_stringcCs|jr dSdSr)r$rrrr rcsz#StdStringStreamPrinter.display_hintNrrrrr rMs rc@s$eZdZddZddZddZdS)Tr1HashtableIteratorcCsf|d|_d|_|d|_t|jd|_d|_|j|jkrb|j|j|_|jrTqb|jd|_q2dS)NZ _M_bucketsrZ_M_bucket_countZ_Noder0)_buckets_bucket _bucket_countr)r#ro _node_typer)r hashtablerrr rbjs   zTr1HashtableIterator.__init__cCs|Srrrrrr rcvszTr1HashtableIterator.__iter__cCs|jdkrt|j|j}|d}|d|_|jdkr||jd|_|j|jkr||j|j|_|jrnq||jd|_qL|S)NrZ_M_vrr0)rrerpr)rr'r(r&)rrzrrrr rys     zTr1HashtableIterator.__next__Nrrrrr r%is r%c@s$eZdZddZddZddZdS)StdHashtableIteratorcCsR|dd|_|jd}|jdd}tdt||r>dnd}||_dS) NZ_M_before_begin_M_nxtr0 rzstd::__detail::_Hash_nodetrueZfalse)rr#r<r9r%ror))rr*r?cachedZ node_typerrr rbs   zStdHashtableIterator.__init__cCs|Srrrrrr rcszStdHashtableIterator.__iter__cCsR|jdkrt|j|j}|d|_|dj}||jd}|S)Nrr,r) rrerpr)rrr#r<ro)rrvalptrrrr rs   zStdHashtableIterator.__next__Nrrrrr r+sr+c@s<eZdZdZddZddZddZedd Zd d Z d S) Tr1UnorderedSetPrinterz1Print a std::unordered_set or tr1::unordered_set.cCst||_||_dSrrrlrrr rbs zTr1UnorderedSetPrinter.__init__cCs|jdr|jS|jdSNstd::tr1_M_hrjrDr_rrrr _hashtables z!Tr1UnorderedSetPrinter._hashtablecCs|d}d|jt|fSNZ_M_element_countrr6rjrrrNrrr rus z Tr1UnorderedSetPrinter.to_stringcCsd|SNrrirrr _format_countsz$Tr1UnorderedSetPrinter._format_countcCs@t|jt}|jdr.t|t|St|t |SNr3) rr= itertoolsrNrjrDrr%r6r+)rcounterrrr rms zTr1UnorderedSetPrinter.childrenN) r r r rrbr6rurr=rmrrrr r1s r1c@s\eZdZdZddZddZddZedd Zed d Z ed d Z ddZ ddZ dS)Tr1UnorderedMapPrinterz1Print a std::unordered_map or tr1::unordered_map.cCst||_||_dSrrrlrrr rbs zTr1UnorderedMapPrinter.__init__cCs|jdr|jS|jdSr2r5rrrr r6s z!Tr1UnorderedMapPrinter._hashtablecCs|d}d|jt|fSr7r8r9rrr rus z Tr1UnorderedMapPrinter.to_stringccs|D]}|D] }|Vq qdSrr)rrr<rrr _flattenszTr1UnorderedMapPrinter._flattencCs|d|dfSNrrr)rrrr _format_onesz"Tr1UnorderedMapPrinter._format_onecCsd|Sr:rr;rrr r=sz$Tr1UnorderedMapPrinter._format_countcCsdt|jt}|jdr@|t|jt| }t ||S|t|jt | }t ||Sr>) rr=r?rNrjrDrBrDr%r6rr+)rr@datarrr rms  zTr1UnorderedMapPrinter.childrencCsdSrrrrrr rsz#Tr1UnorderedMapPrinter.display_hintN) r r r rrbr6rurrBrDr=rmrrrrr rAs    rAc@s8eZdZdZGdddeZddZddZdd Zd S) StdForwardListPrinterzPrint a std::forward_list.c@s$eZdZddZddZddZdS)zStdForwardListPrinter._iteratorcCs||_|d|_d|_dSrrrrrr rbs z(StdForwardListPrinter._iterator.__init__cCs|Srrrrrr rcsz(StdForwardListPrinter._iterator.__iter__cCsl|jdkrt|j|j}|d|_|j}|jd|_|dj}||jd }d||fS)Nrrr0rr) rrerprrrrr#r<ro)rrrNr0rrr rs    z(StdForwardListPrinter._iterator.__next__Nrrrrr rsrcCs||_t||_dSr)r_rCrjrlrrr rbszStdForwardListPrinter.__init__cCs(td|jj}|||jddS)Nrrrrrrrr rmszStdForwardListPrinter.childrencCs*|jddddkr d|jSd|jS)Nrrrrrrr_rjrrrr rus zStdForwardListPrinter.to_stringNrrrrr rFs rFc@sBeZdZdZd ddZddZGdddeZd d Zd d Z dS)SingleObjContainerPrinterz8Base class for printers of containers of single objects.NcCs||_||_||_dSr)_contained_valuer_hint)rraZvizhintrrr rbsz"SingleObjContainerPrinter.__init__cCs(ts t|Stjtj|p&t|S)z5Return type as a string after applying type printers.)_use_type_printingr%rtypesapply_type_recognizersget_type_recognizers)rr#rrr _recognizesz$SingleObjContainerPrinter._recognizec@s$eZdZddZddZddZdS)z$SingleObjContainerPrinter._containedcCs ||_dSrr^r`rrr rbsz-SingleObjContainerPrinter._contained.__init__cCs|Srrrrrr rc"sz-SingleObjContainerPrinter._contained.__iter__cCs"|jdurt|j}d|_d|fS)Nz[contained value]rd)rZretvalrrr r%s  z-SingleObjContainerPrinter._contained.__next__Nrrrrr _containedsrQcCs6|jdur|dSt|jdr*|jS||jS)Nrm)rIrQrrrmrrrr rm,s     z"SingleObjContainerPrinter.childrencCs(t|jdr"t|jdr"|jS|jS)Nrmr)rrrrJrrrr r3s    z&SingleObjContainerPrinter.display_hint)N) r r r rrbrPrrQrmrrrrr rHs  rHcCsN|j}tjddkr"t|}nt|}zt|jj WSYdS0dS)z{Find the name of the function referred to by the gdb.Value f, which should contain a function pointer from the program.rrN) rrrOrPr rrZ block_for_pcfunctionr&)r rrr function_pointer_to_name;s  rScs4eZdZdZfddZddZeddZZS)StdExpAnyPrinterz+Print a std::any or std::experimental::any.c st||_t|j|_||_d|_d}d}|jd}|dkr~t|}|sXtd|jd|}t ||}|std|j| d} d| vrg} t D]B} z(t d| | d} | t| WqtjyYq0qt| dkrtd | d} n t| } | d|_d}d | vr8|jd d j}n(d | vrR|jd d}ntd|j||j}t|}tt |||dS)NZ _M_managerrzInvalid function pointer in %szi({0}::_Manager_\w+<.*>)::_S_manage\((enum )?{0}::_Op, (const {0}|{0} const) ?\*, (union )?{0}::_Arg ?\*\)zUnknown manager function in %sr0 std::stringzstd::string(?!\w)z;Cannot uniquely determine std::string type used in std::anyz::_Manager_internalrZ _M_bufferz::_Manager_externalri)rCrjrTr__contained_typerSr$r1rFrGgrouprT _string_typesrQrXrrr3r!r<rrprorrsuperrb)rrLracontained_value visualizerZmgrfuncZrxmZmgrnameZmgrtypessrHZmgrtyper0 __class__rr rbVsf               zStdExpAnyPrinter.__init__cCsT|jdurd|jSd|j}t|jdr8||jS||j}|tt|S)N%s [no contained value]z%s containing rm)rVrjrrrurPrCr%)rdescr?rrr rus     zStdExpAnyPrinter.to_stringcs@ttdh}ddddtg}|fdd|DO}|S)NrUzAbasic_string, std::allocator >r:rUcsh|] }|qSrr)r+qr^rr r.z1StdExpAnyPrinter._string_types..)r%rrrr4)ZstringsZqualsrrdr rXszStdExpAnyPrinter._string_types) r r r rrbrurrX __classcell__rrr_r rTSs  D rTcs(eZdZdZfddZddZZS)StdExpOptionalPrinterz5Print a std::optional or std::experimental::optional.cst||_t|j|_|d}|jdr8|d}|}n*|d}|d}z |d}Wn Yn0t|}|std}tt|||dS)N _M_payloadzstd::experimental _M_engaged_M_value) rCrjrTrDrrrYrgrb)rrLraZpayloadZengagedrZr[r_rr rbs$      zStdExpOptionalPrinter.__init__cCs:|jdurd|jSt|jdr4d|j|jfS|jS)Nrarmz%s containing %s)rIrjrrrurrrr rus   zStdExpOptionalPrinter.to_stringr r r rrbrurfrrr_r rgs rgcs(eZdZdZfddZddZZS)StdVariantPrinterzPrint a std::variant.cst|j}t||_|d|_|jt|krs*     zStdErrorCodePrinter.to_string)r r r rrrbrr classmethodrrrrrurrrr rs     * rc@s eZdZdZddZddZdS)StdRegexStatePrinterz/Print a state node in the NFA for a std::regex.cCs||_||_dSrrGrlrrr rb[szStdRegexStatePrinter.__init__cCst|jd}|r|dd}|jd}dddddddddddddd }||}d ||}|dur|jd |durd |||jd |}d |S) NZ _M_opcoderZaltZsubexprnegZ backref_index) repeat alternativeZ subexpr_beginZ subexpr_endZline_begin_assertionZline_end_assertionZ word_boundaryZsubexpr_lookaheadZbackrefrGZacceptZdummyunknownzopcode={}, next={}Z_M_z {}, {}={}z{%s})r%r_r1)rZopcodeZnext_idZvariantsvr^rrr ru_s"   zStdRegexStatePrinter.to_stringNrrrrr rXsrc@s@eZdZdZGdddeZddZddZdd Zd d Z d S) StdSpanPrinterzPrint a std::span.c@s$eZdZddZddZddZdS)zStdSpanPrinter._iteratorcCsd|_||_||_dSr)r_beginr)rrrrrr rbysz!StdSpanPrinter._iterator.__init__cCs|Srrrrrr rc~sz!StdSpanPrinter._iterator.__iter__cCs8|j|jkrt|j}|jd|_d||j|fS)Nr0r)rrrerrr9rrr rs   z!StdSpanPrinter._iterator.__next__Nrrrrr rxsrcCsLt||_||_td}|jd|kr:|dd|_n|jd|_dS)Nzstatic_cast(-1)r0Z _M_extentZ_M_extent_value)rCrjr_rr"r#r<r)rrLraZsize_maxrrr rbs   zStdSpanPrinter.__init__cCsd|j|jfSNz%s of length %drjrrrrr ruszStdSpanPrinter.to_stringcCs||jd|jSrh)rr_rrrrr rmszStdSpanPrinter.childrencCsdSrrrrrr rszStdSpanPrinter.display_hintN) r r r rrrrbrurmrrrrr rus  rc@s0eZdZdZddZddZddZdd Zd S) StdInitializerListPrinterzPrint a std::initializer_list.cCs||_||_|d|_dS)Nrv)rjr_rrlrrr rbsz"StdInitializerListPrinter.__init__cCsd|j|jfSrrrrrr rusz#StdInitializerListPrinter.to_stringcCst|jd|jS)NZ_M_array)rrr_rrrrr rmsz"StdInitializerListPrinter.childrencCsdSrrrrrr rsz&StdInitializerListPrinter.display_hintN)r r r rrbrurmrrrrr rs rc@s(eZdZdZddZddZddZdS) StdAtomicPrinterzPrint a std:atomic.cCsrt||_||_d|_|jjd|_|jjdurnt|jj}|dsR|drn|d}t |||_|j |_ dS)Nrzstd::shared_ptr = { %s }) rrurprrZ TYPE_CODE_INTr_ TYPE_CODE_FLT TYPE_CODE_PTRrrjr%r`rrr rus     zStdAtomicPrinter.to_stringN)r r r rrbrrurrrr rs rc@s eZdZdZddZddZdS)StdFormatArgsPrinterzPrint a std::basic_format_args.cCst||_||_dSrrrlrrr rbs zStdFormatArgsPrinter.__init__cCst|jj}t|dd}|tdkr0d}n|tdkrDd}nd}|jd}|dkrbd |S|dkrt|jd }d ||fS) Nrr0rzstd::format_argswchar_tzstd::wformat_argszstd::basic_format_argsZ_M_packed_sizez%s with 1 argumentZ_M_unpacked_sizez%s with %d arguments)r\r_r#rr)rZtargsrr'rrrr rus   zStdFormatArgsPrinter.to_stringNrrrrr rsrc@s0eZdZdZddZddZddZdd Zd S) StdChronoDurationPrinterzPrint a std::chrono::duration.cCst||_||_dSrrrlrrr rbs z!StdChronoDurationPrinter.__init__cCs*|jjd}|d}|d}||fS)Nr0r)r_r#r<)rZperiodrdenrrr _ratios  zStdChronoDurationPrinter._ratiocCs|\}}|dkrF|dkr dS|dkr,dS|dkr8dS|dkr|dSn6|dkr||d krZd S|d krfd S|d krrdSd|Sd||S)Nr0r^iZmsi@Busiʚ;r<minihiQdz[{}]sz[{}/{}]s)rr1)rrrrrr _suffixs&  z StdChronoDurationPrinter._suffixcCs4|jd}|jjtjkr$d|}d||S)N__rz%gz"std::chrono::duration = {{ {}{} }})r_r#rrrrr1r)rrrrr rus z"StdChronoDurationPrinter.to_stringN)r r r rrbrrrurrrr rs rc@s*eZdZdZddZddZd ddZd S) StdChronoTimePointPrinterz Print a std::chrono::time_point.cCst||_||_dSrrrlrrr rbs z"StdChronoTimePointPrinter.__init__cCsv|jjd}t|j}|dks(|dkr,dS|dkr8dS|dkrDdS|d krPd S|d kr\d S|d krhdSd|dfS)Nrzstd::chrono::_V2::system_clockzstd::chrono::system_clock)zstd::chrono::sys_timerzstd::chrono::utc_clock)zstd::chrono::utc_timeNzstd::chrono::gps_clock)zstd::chrono::gps_timeNzstd::chrono::tai_clock)zstd::chrono::tai_timeNzstd::filesystem::__file_clock)zstd::chrono::file_timelumzstd::chrono::local_t)zstd::chrono::local_timerz {} time_point)r_r#r<rCr&r1)rclockr&rrr _clocks" z StdChronoTimePointPrinter._clockFcCs|\}}|jd}|d}t|jj|}|}d}|dur|\} } || | |} ztj| t } d | }Wn Yn0d|||f} |r| Sd|| fS)NZ__drrKz [{:%Y-%m-%d %H:%M:%S}]z%d%s%sz %s = { %s }) rr_rr#r&rrrZ fromtimestamp _utc_timezoner1)rZabbrevroffsetrrprintersuffixtimerrZsecsrr^rrr ru1s$   z#StdChronoTimePointPrinter.to_stringN)F)r r r rrbrrurrrr rsrc@s eZdZdZddZddZdS)StdChronoZonedTimePrinterz Print a std::chrono::zoned_time.cCst||_||_dSrrrlrrr rbIs z"StdChronoZonedTimePrinter.__init__cCs@|jdd}|jd}t|jj|}|d}d||S)NZ_M_zone_M_nameZ_M_tpTz%std::chrono::zoned_time = {{ {} {} }})r_rrr#r&rur1)rZzonerrrrr ruMs   z#StdChronoZonedTimePrinter.to_stringNrrrrr rFsr) NZJanuaryZFebruaryZMarchZAprilZMayZJuneZJulyZAugustZ SeptemberZOctoberZNovemberZDecember)SundayZMondayZTuesdayZ WednesdayZThursdayZFridayZSaturdayrc@s eZdZdZddZddZdS)StdChronoCalendarPrinterzDPrint a std::chrono::day, std::chrono::month, std::chrono::year etc.cCst||_||_dSrrrlrrr rb_s z!StdChronoCalendarPrinter.__init__c Csv|j}|j}d|vr$|dkr$|d}|dr6|d}|dkrPdt|dS|d kr||d ksl|ttkrtd |St|S|dkrd |S|d kr|d}|dks|ttkrd|Sdt|S|dkrd|dt|dS|dkrd|dS|dkrd||dS|dkr,d|S|dkrFd||dS|dkr`d||dS|dkrvd||S|dkrd |||dS|dkrd||d!S|d"krd |||dS|d#krd |||dS|d$rrd%}|d&dkr"d't|d(d)t|d&}t|d*d+}t|dd+}t|d,d+}|d-rb| }d.||||SdS)/Nmonthz std::chrono::year_month_day_lastZ_M_mzstd::chrono::yearZ_M_yzstd::chrono::dayz{}Z_M_dzstd::chrono::monthr0z%d is not a valid monthz{}yzstd::chrono::weekdayZ_M_wdrz%d is not a valid weekdayzstd::chrono::weekday_indexedz{}[{}]rmzstd::chrono::weekday_lastz{}[last]zstd::chrono::month_dayz{}/{}zstd::chrono::month_day_lastz{}/lastzstd::chrono::month_weekdayZ_M_wdizstd::chrono::month_weekday_lastZ_M_wdlzstd::chrono::year_monthzstd::chrono::year_month_dayz{}/{}/{}Z_M_mdlzstd::chrono::year_month_weekdayz$std::chrono::year_month_weekday_lastzstd::chrono::hh_mm_ssrKZfractional_widthz.{:0{}d}Z_M_ssZ_M_rr4r_M_sZ _M_is_negz{:02}:{:02}:{:02}{})r_rjrDr1rr!monthsweekdays) rrar'r]yZwdZfractrr^rrr rucsj                z"StdChronoCalendarPrinter.to_stringNrrrrr r\src@s eZdZdZddZddZdS)StdChronoTimeZonePrinterz4Print a chrono::time_zone or chrono::time_zone_link.cCst||_||_dSrrrlrrr rbs z!StdChronoTimeZonePrinter.__init__cCs6d|j|jdf}|jdr2|d|jd7}|S)NrtrZ_linkz -> %sZ _M_target)rjr_r)rr%rrr rus z"StdChronoTimeZonePrinter.to_stringNrrrrr rsrc@s eZdZdZddZddZdS)StdChronoLeapSecondPrinterzPrint a chrono::leap_second.cCst||_||_dSrrrlrrr rbs z#StdChronoLeapSecondPrinter.__init__cCs.|jdd}d|dk}d|jt||fS)Nrrz+-rz %s %d (%c))r_rjabs)rdaterrrr rus z$StdChronoLeapSecondPrinter.to_stringNrrrrr rsrc@s eZdZdZddZddZdS)StdChronoTzdbPrinterzPrint a chrono::tzdb.cCst||_||_dSrrrlrrr rbs zStdChronoTzdbPrinter.__init__cCsd|j|jdfS)Nz%s %sversion)rjr_rrrr ruszStdChronoTzdbPrinter.to_stringNrrrrr rsrc@s eZdZdZddZddZdS)StdChronoTimeZoneRulePrinterzPrint a chrono::time_zone rule.cCst||_||_dSrrrlrrr rbs z%StdChronoTimeZoneRulePrinter.__init__c Cs|jd}|d}t|d}dddddddd}|d}d |||d }|d krdd ||}nVt|d }|dkrd||}n4|dkrd} nd} |d}d| d || d||}d|jd|jd|jd|S)NonkindrstZndZrd)r0rrZ day_of_monthz{}{}Zthrz{} {}Z day_of_weekr0z last {} in {}r)rz<=)rz>=z{} {} {} {} {}z.time_zone rule {} from {} to {} starting on {}r&fromto)r_rr1getr) rrrrsuffixesdayZ ordinal_dayrweekday directionrrr rus0    z&StdChronoTimeZoneRulePrinter.to_stringNrrrrr rsrc@s eZdZdZddZddZdS)StdLocalePrinterzPrint a std::locale.cCs||_||_dSrrGrlrrr rbszStdLocalePrinter.__init__cst|jdd}d}|ddkr&d}nBt|jd}t|jd}|d}|d}d||}||i}d } | |kr|| dkr|| }|| }d |||}|||<| d } qvt|} t| d kr|}nt| d krh| \} } t |} d| | d kr | }| n| | d kr8| }| durht fd d | D}d|}d||S)NrZ_M_namesrKr*z::_S_categoriesz::_S_categories_sizez{}={}r0z{};{}={}rc3s|]\}}|kr|VqdSrr)r+rrZotherrr r.z-StdLocalePrinter.to_string..z with "{}={}"zstd::locale = "{}"{}) r_rr"rjrr1rsvaluesr!rrNr items)rrmodr&ZcatsZncatrZrZ cat_namesr<Z uniq_namesZn1Zn2Z name_listrrr rusD            zStdLocalePrinter.to_stringNrrrrr rsrc@s eZdZdZddZddZdS)StdIntegralConstantPrinterz*Print a std::true_type or std::false_type.cCs||_||_dSrrGrlrrr rb sz#StdIntegralConstantPrinter.__init__cCsL|jjd}|jjd}|jtjkr4|r0dSdSt|j}d|||S)Nrr0zstd::true_typezstd::false_typez {}<{}, {}>) r_r#r<rrrrCrjr1)rr;rrLrrr ru s  z$StdIntegralConstantPrinter.to_stringNrrrrr r src@s eZdZdZddZddZdS)StdTextEncodingPrinterzPrint a std::text_encoding.cCs||_||_dSrrGrlrrr rb$ szStdTextEncodingPrinter.__init__cCs<|jd}|ddkr$|jdS|ddkr4dS|dS)NZ_M_repZ_M_idr0rrr)r_r)rZreprrr ru( s    z StdTextEncodingPrinter.to_stringNrrrrr r! srcs$eZdZfddZddZZS) RxPrintercs$tt|||_||_d|_dSNT)rYrrbr& _functionenabled)rr&rRr_rr rb3 szRxPrinter.__init__cCs:|js dS|jjtjkr,ttjdr,|}||j |S)Nreferenced_value) rr#rrrrValuerrr&)rrrrr invoke9 s  zRxPrinter.invoke)r r r rbrrfrrr_r r2 s rcsHeZdZfddZddZddZddZed d Zd d Z Z S) Printercs6tt|||_g|_i|_d|_td|_ dS)NTz^([a-zA-Z0-9_:]+)(<.*>)?$) rYrrbr& _subprinters_lookuprrFcompile _compiled_rx)rr&r_rr rbH s zPrinter.__init__cCs<|j|std|t||}|j|||j|<dS)Nz0libstdc++ programming error: "%s" does not match)r rGr$rr rXr )rr&rRrrrr addP s   z Printer.addcCs>||||d|vr:tddt|}||||dS)N__cxx11z^(std|__gnu_cxx)::z\g<0>%s)r rFrQr4)rbaser&rRZvbaserrr add_version[ szPrinter.add_versioncCs$||||||d||dS)Nz __cxx1998::)r)rrr&rRrrr add_containerc szPrinter.add_containercCs&|jtjkr|}|}|jSr)rrrrrrr)r#rrr get_basic_typeg s  zPrinter.get_basic_typecCsr||j}|sdS|j|}|s(dS|d}|jjtjkrTttj drT| }||j vrn|j | |SdS)Nr0r) rr#r rGrWrrrrrrr r)rrarLrGbasenamerrr __call__r s     zPrinter.__call__) r r r rbr rrrrrrfrrr_r rG s   rc@s0eZdZdZddZGdddeZddZdS) TemplateTypePrinteral A type printer for class templates with default template arguments. Recognizes specializations of class templates and prints them without any template arguments that use a default template argument. Type printers are recursively applied to the template arguments. e.g. replace 'std::vector >' with 'std::vector'. cCs||_||_d|_dSr)r&_defargsrrr&defargsrrr rb szTemplateTypePrinter.__init__c@s(eZdZdZddZddZddZdS) zTemplateTypePrinter._recognizerz-The recognizer class for TemplateTypePrinter.cCs||_||_dSr)r&rrrrr rb sz(TemplateTypePrinter._recognizer.__init__c Cs|jdurdS|j|js dSt|}g}d}tt|D]}||}|j|}|dur|j|}z|t |kr~WdSWn&t j y|j|krYdSYn0d}q<|rdS| | |q<|jd|jd}t|}|dd|dS)a If type_obj is a specialization of self.name that uses all the default template arguments for the class template, then return a string representation of the type without default arguments. Otherwise, return None. NFTr)rrDr&r\ranger!rrr1rrr3rX_recognize_subtyper rWr2) rrYr[Zdisplayed_argsZrequire_defaultedrZrtZdefargrIrrr recognize s2     z)TemplateTypePrinter._recognizer.recognizecCs|jtjkr||dS|jtjkrj||}t|drR|dSd|| ddfS|jtj kr||dSt tdr|jtj kr||dStj tj |}|r|St|S)zxConvert a gdb.Type to a string by applying recognizers, or if that fails then simply converting to a string.rz[]z%s[%d]r0&TYPE_CODE_RVALUE_REFz&&)rrrrrrr%rrrrrrrMrNrO)rrYrVrrr r s$      z2TemplateTypePrinter._recognizer._recognize_subtypeN)r r r rrbrrrrrr _recognizer s1r cCs||j|jSz1Return a recognizer object for this type printer.)r r&rrrrr instantiate szTemplateTypePrinter.instantiateNr r r rrbobjectr r"rrrr r s Prcstd||}tj||td||}tj||d|vrdttfdd|D}t||}tj||td||}tj||dS)a Add a type printer for a class template with default template arguments. Args: name (str): The template-name of the class template. defargs (dict int:string) The default template arguments. Types in defargs can refer to the Nth template-argument using {N} (with zero-based indices). e.g. 'unordered_map' has these defargs: { 2: 'std::hash<{0}>', 3: 'std::equal_to<{0}>', 4: 'std::allocator >' } r:zstd::__debug::rc3s"|]\}}||dfVqdS)r:N)r5)r+rZrrrr r sz0add_one_template_type_printer..N)rrrMregister_type_printerr4dictr)objr&rrrr%r add_one_template_type_printer s r)c@s2eZdZdZd ddZGdddeZddZdS) FilteringTypePrintera A type printer that uses typedef names for common template specializations. Args: template (str): The class template to recognize. name (str): The typedef-name that will be used instead. targ1 (str, optional): The first template argument. Defaults to None. Checks if a specialization of the class template 'template' is the same type as the typedef 'name', and prints it as 'name' instead. e.g. if an instantiation of std::basic_istream is the same type as std::istream then print it as std::istream. If targ1 is provided (not None), match only template specializations with this type as the first template argument, e.g. if template='basic_string' and targ1='char' then only match 'basic_string' and not 'basic_string'. This rejects non-matching specializations more quickly, without needing to do GDB type lookups. NcCs||_||_||_d|_dSr) _templater&_targ1rrtemplater&targ1rrr rb- szFilteringTypePrinter.__init__c@s eZdZdZddZddZdS)z FilteringTypePrinter._recognizerz.The recognizer class for FilteringTypePrinter.cCs||_||_||_d|_dSr)r+r&r, _type_objr-rrr rb6 sz)FilteringTypePrinter._recognizer.__init__cCs|jdurdS|jdurz|jdurDd|j|j}|j|sVdSn|j|jsVdSzt|j |_Wn Yn0|jdurdStj |j}tj |}||krt |jS|j dddkr|jjdd}|jdd}||krt |jSdS)z If type_obj starts with self._template and is the same type as self.name then return self.name, otherwise None. Nz{}<{}r/rv basic_string __cxx11::rK)rr0r,r1r+rDrrr&rrMrrWrr5)rrYr^t1t2s1s2rrr r< s6        z*FilteringTypePrinter._recognizer.recognizeN)r r r rrbrrrrr r 3 sr cCs||j|j|jSr!)r r+r&r,rrrr r"f sz FilteringTypePrinter.instantiate)Nr#rrrr r* s 3r*cCsXtd|d||}tj||d|vrTdt}t|||||}tj||dS)Nr:r)r*rrMr&r4)r(r.r&r/rrrrr add_one_type_printerk s r7cCs8tsdSdD]p}t|d|dd|dt|d|dd|dt|dd|dd|dt|d|dd |dq d D]r}d D]"}t|d ||d||dqd D]@}t|d ||d||dt|d||d||dqqdD]z}d D](}t||d||dd|dqdD]B}t||d||ddD]}t||||||qPq0qt|dddD]}t|dd|qt|ddt|ddt|ddt|dd t|d!d"t|d!d#t|d$d%t|d$d&t|d'd(d)}dD](}t||d||dd |dqt|d*dd+it|d,dd-it|d.dd-it|d/dd-it|d0dd-it|d1dd-it|d2d3d4d5t|d6d3d4d5t|d7d3d-d8t|d9d3d-d8t|d:d;dd;ddequezstd::allocator<{0}>rrz __cxx11::listvectorrzstd::less<{0}>z)std::allocator>)rrmultimaprs)r0rmultiset unordered_mapzstd::hash<{0}>zstd::equal_to<{0}>)rrunordered_multimap unordered_set)r0rrunordered_multiset)rLr7r))r(ZchrHZabiZdurrrrr register_type_printerst s " "             rLcCs8trtj|tn|dur t}|jtt|dS)z4Register libstdc++ pretty-printers with objfile Obj.N) _use_gdb_pprZprintingZregister_pretty_printerlibstdcxx_printerZpretty_printersrXrL)r(rrr register_libstdcxx_printers s  rOcCsPtdatddttddttddttddttddttddttddttdd ttdd t tdd t tdd t tdd t tddt tddt tddt tddt tddttddtttjdr.tddttddttdttdttdttdttdttdt tdt tdttddttdd ttdd!ttdd"ttdd#ttdd$ttdd%ttd&dttd&d ttd&d!ttd&d"ttd&d#ttd&d$ttdd'ttdd(ttdd)ttdd)td*D]*}tdd+|ttdd+|tqtd,d-ttd,d.ttdd/ttd0d1t td2ttd3ttd4ttd5ttd6ttd7d8t!td7d9t"td7d:t#td;ddz std::chrono::ZdurationZ time_pointZintegral_constantzstd::__detail::Z_Statezstd::__debug::unordered_mapzstd::__debug::unordered_setz std::__debug::unordered_multimapz std::__debug::unordered_multisetzstd::__debug::forward_listz$std::experimental::fundamentals_v1::anyZoptionalr=z#std::experimental::filesystem::v1::rz,std::experimental::filesystem::v1::__cxx11::zstd::filesystem::zstd::filesystem::__cxx11::ZvariantZ _Node_handleZpartial_orderingZ weak_orderingrspanZbasic_format_args)rrZyearrZweekday_indexedZ weekday_lastZ month_dayZmonth_day_lastZ month_weekdayZmonth_weekday_lastZ year_monthZyear_month_dayZyear_month_day_lastZyear_month_weekdayZyear_month_weekday_lastZhh_mm_ssZ time_zoneZtime_zone_linkZ zoned_timeZ leap_secondZtzdbZ text_encodingz __gnu_cxx::ZslistZ_List_iteratorZ_List_const_iteratorZ_Rb_tree_iteratorZ_Rb_tree_const_iteratorZ_Deque_iteratorZ_Deque_const_iteratorZ__normal_iteratorZ _Bit_iteratorZ_Bit_const_iteratorZ_Bit_referenceZ_Slist_iteratorZ_Fwd_list_iteratorZ_Fwd_list_const_iteratorz__gnu_debug::_Safe_iterator);rrNrr rrrrrrrrrrrrrrrrr rgrAr1rFrrrrrrrrrTrgrurwrrlrorrrrrrrrrrrrr rrrrrr)Zsstreamrrrr build_libstdcxx_dictionary s          rS)N)vrr?rFrOrrrPr$rrrziprrr timezoneZutcrZtzinforrMZ gdb.printingrrLZ gdb.typesrrMrZ printer_baser)r4r9r@r=rJrCrTrWr\r]rgryr{r~rrrrrrrrrrrrrrrrrrrrrrrrr r rrrr%r+r1rArFrHrSrTrgrlrorurwrrrrrrrrrrrrrrrrrrrrrrrrrNrr)r*r7rLrOrSrrrr s        %   (&"I  U(*$/A " /%-^!,5I!{'$*/?  ",Ce%T oT