3 `@sddlZddlZddlZddlZejddkr@eZeZe Z e Z nGdddZddlmZm Z da y ddlZWnek rda YnXdayddlZeejdrdaWnek rYnXd d Zd ad d ZddZddZddZGdddeZGdddZGdddZddZddZGdddZGd d!d!Z Gd"d#d#e Z!Gd$d%d%e Z"Gd&d'd'Z#Gd(d)d)Z$Gd*d+d+Z%Gd,d-d-Z&Gd.d/d/Z'Gd0d1d1Z(Gd2d3d3eZ)d4d5Z*Gd6d7d7Z+Gd8d9d9Z,d:d;Z-Gdd?d?Z/Gd@dAdAZ0GdBdCdCZ1GdDdEdEZ2GdFdGdGZ3GdHdIdIeZ4GdJdKdKeZ5GdLdMdMZ6GdNdOdOZ7GdPdQdQZ8GdRdSdSeZ9dTdUZ:GdVdWdWe9Z;GdXdYdYe9ZGd^d_d_Z?Gd`dadaZ@GdbdcdcZAGdddedeeZBGdfdgdgeZCdaDGdhdidieZEdjdkZFGdldmdmeZGdndoZHdpdqZIdrdsZJdtduZKeKdS)vNc@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|jS)N)__next__)selfr0/usr/share/gcc-8/python/libstdcxx/v6/printers.pynext<sz Iterator.nextN)__name__ __module__ __qualname____doc__rrrrrr1s r)imapizipTFZ TypePrinterc Csn|j}x`d|j|f}y tj|Stk r8YnX|jd}|js`tdt||f|j }q WdS)Nz%s::%srzCannot find type %s::%s) strip_typedefs unqualifiedgdb lookup_type RuntimeErrorfields is_base_class ValueErrorstrtype)ZorignametypsearchZfieldrrr find_typeUs  rz__8::cCs0trtjdt|f|dk Stjd||dk S)z1Test if a type is a given template instantiation.z^std::(%s)?%s<.*>$Nz ^std::%s<.*>$)_versioned_namespacerematch)r template_namerrris_specialization_ofhsr!cCstr|jtdS|S)N)rreplace)typenamerrrstrip_versioned_namespaceos r%cCsVt|}|jdd}d}x d D]}|j||d|}qW|d}|j|d|}|S) zARemove known inline namespaces from the canonical name of a type.zstd::__cxx11::zstd::zstd::experimental::fundamentals_v1fundamentals_v2z::z filesystem::zv1::)r&r')r%r#)type_strZexpt_nsZlfts_nsZfs_nsrrrstrip_inline_namespacesus  r)c Cs:d}g}x,y|j|j|Wn |S|d7}q WdS)z,Return a type's template arguments as a listrN)appendtemplate_argument)type_objn template_argsrrrget_template_arg_listsr0c@s(eZdZdZddZddZddZdS) SmartPtrIteratorz?An iterator for smart pointer types with a single 'child' valuecCs ||_dS)N)val)rr2rrr__init__szSmartPtrIterator.__init__cCs|S)Nr)rrrr__iter__szSmartPtrIterator.__iter__cCs$|jdkrtd|j|_}d|fS)Nzget())r2 StopIteration)rr2rrrrs zSmartPtrIterator.__next__N)r r r r r3r4rrrrrr1sr1c@s(eZdZdZddZddZddZdS) SharedPointerPrinterzPrint a shared_ptr or weak_ptrcCst||_||_|d|_dS)N_M_ptr)r%r$r2pointer)rr$r2rrrr3s zSharedPointerPrinter.__init__cCs t|jS)N)r1r8)rrrrchildrenszSharedPointerPrinter.childrencCsjd}|jdd}|dkrL|d}|d}|dkr (%s))r2r$rrr,)rstateZ refcountsZusecountZ weakcountrrr to_strings zSharedPointerPrinter.to_stringN)r r r r r3r9r<rrrrr6sr6c@s(eZdZdZddZddZddZdS) UniquePointerPrinterzPrint a unique_ptrcCs||_|jjdjj}tt|dr6|dd}n(tt|drN|d}ntdt||jjdj}|jdj}|jd}|jdkr|d|_n&|j r|j |j|_ntdt|dS) NrZ__uniq_ptr_impl_M_ttuplez-Unsupported implementation for unique_ptr: %sr* _M_head_implz6Unsupported implementation for tuple in unique_ptr: %s) r2rrrr!rrrr8rcast)rr$r2Z impl_typeZ tuple_memberZtuple_impl_typeZtuple_head_typeZ head_fieldrrrr3s    zUniquePointerPrinter.__init__cCs t|jS)N)r1r8)rrrrr9szUniquePointerPrinter.childrencCsdt|jjjdS)Nzstd::unique_ptr<%s>r)rr2rr,)rrrrr<szUniquePointerPrinter.to_stringN)r r r r r3r9r<rrrrr=sr=cCs|djj|jjS)z8Returns the value held in a __gnu_cxx::__aligned_membuf. _M_storage)addressrAr8 dereference)Zbufvaltyperrrget_value_from_aligned_membufsrFc CsjyF|jjdj}|dkr"|dS|dkrD|jjd}t|d|SWn YnXtdt|jdS)z-Returns the value held in an _List_node<_Val>r*_M_datarBrz!Unsupported implementation for %sN)rrrr,rFrr)nodememberrErrrget_value_from_list_nodes rJc@s8eZdZdZGdddeZddZddZdd Zd S) StdListPrinterzPrint a std::listc@s$eZdZddZddZddZdS)zStdListPrinter._iteratorcCs"||_|d|_|j|_d|_dS)N_M_nextr)nodetypebaserCheadcount)rrMrOrrrr3s z!StdListPrinter._iterator.__init__cCs|S)Nr)rrrrr4sz!StdListPrinter._iterator.__iter__cCsR|j|jkrt|jj|jj}|d|_|j}|jd|_t|}d||fS)NrLr*z[%d])rNrOr5rArMrDrPrJ)reltrPr2rrrrs   z!StdListPrinter._iterator.__next__N)r r r r3r4rrrrr _iteratorsrRcCst||_||_dS)N)r%r$r2)rr$r2rrrr3s zStdListPrinter.__init__cCs0t|jjd}|jj}|j||jddS)N_Node_M_impl_M_node)rr2rrr8rR)rrMrrrr9s zStdListPrinter.childrencCs6|jddj|jdddkr,d|jSd|jS)NrTrUrLzempty %sz%s)r2rCr$)rrrrr<s" zStdListPrinter.to_stringN) r r r r rrRr3r9r<rrrrrKs rKc@seZdZddZddZdS)NodeIteratorPrintercCs||_||_||_dS)N)r2r$contname)rr$r2rWrrrr3szNodeIteratorPrinter.__init__cCsN|jdsd|jSt|jjd}|jj}|jdj|j}tt |S)NrUz(non-dereferenceable iterator for std::%srS) r2rWrrrr8rArDrrJ)rrMrHrrrr< s    zNodeIteratorPrinter.to_stringN)r r r r3r<rrrrrVsrVc@seZdZdZddZdS)StdListIteratorPrinterzPrint std::list::iteratorcCstj|||ddS)Nlist)rVr3)rr$r2rrrr3szStdListIteratorPrinter.__init__N)r r r r r3rrrrrXsrXc@seZdZdZddZdS)StdFwdListIteratorPrinterz!Print std::forward_list::iteratorcCstj|||ddS)N forward_list)rVr3)rr$r2rrrr3sz"StdFwdListIteratorPrinter.__init__N)r r r r r3rrrrrZsrZc@s8eZdZdZGdddeZddZddZdd Zd S) StdSlistPrinterzPrint a __gnu_cxx::slistc@s$eZdZddZddZddZdS)zStdSlistPrinter._iteratorcCs||_|dd|_d|_dS)N_M_headrLr)rMrNrP)rrMrOrrrr3#sz"StdSlistPrinter._iterator.__init__cCs|S)Nr)rrrrr4(sz"StdSlistPrinter._iterator.__iter__cCsL|jdkrt|jj|jj}|d|_|j}|jd|_d||dfS)NrrLr*z[%d]rG)rNr5rArMrDrP)rrQrPrrrr+s   z"StdSlistPrinter._iterator.__next__N)r r r r3r4rrrrrrR"srRcCs ||_dS)N)r2)rr$r2rrrr34szStdSlistPrinter.__init__cCs(t|jjd}|jj}|j||jS)NrS)rr2rrr8rR)rrMrrrr97s zStdSlistPrinter.childrencCs|jdddkrdSdS)Nr]rLrzempty __gnu_cxx::slistz__gnu_cxx::slist)r2)rrrrr<<szStdSlistPrinter.to_stringN) r r r r rrRr3r9r<rrrrr\s r\c@s eZdZdZddZddZdS)StdSlistIteratorPrinterz Print __gnu_cxx::slist::iteratorcCs ||_dS)N)r2)rr$r2rrrr3Dsz StdSlistIteratorPrinter.__init__cCsD|jdsdSt|jjd}|jj}t|jdj|jdS)NrUz1non-dereferenceable iterator for __gnu_cxx::slistrSrG)r2rrrr8rrArD)rrMrrrr<Gs   z!StdSlistIteratorPrinter.to_stringN)r r r r r3r<rrrrr^Asr^c@s@eZdZdZGdddeZddZddZdd Zd d Z d S) StdVectorPrinterzPrint a std::vectorc@s$eZdZddZddZddZdS)zStdVectorPrinter._iteratorcCsb||_|rL|d|_|d|_|d|_|d|_|jjj}d|j|_n ||_||_d|_ dS)N_M_p _M_offsetr) bitvecitemsofinishforDrsizeofisizerP)rstartrfrcityperrrr3Rs     z#StdVectorPrinter._iterator.__init__cCs|S)Nr)rrrrr4`sz#StdVectorPrinter._iterator.__iter__cCs|j}|jd|_|jr|j|jkr4|j|jkr4t|jj}|d|j>@rRd}nd}|jd|_|j|jkr|jd|_d|_d||fS|j|jkrt|jj}|jd|_d||fSdS)Nr*rz[%d]) rPrcrdrfrergr5rDri)rrPrQZobitrrrrcs&         z#StdVectorPrinter._iterator.__next__N)r r r r3r4rrrrrrRQsrRcCs*t||_||_|jjdjtjk|_dS)Nr) r%r$r2rr,coderZTYPE_CODE_BOOLis_bool)rr$r2rrrr3zs zStdVectorPrinter.__init__cCs$|j|jdd|jdd|jS)NrT_M_start _M_finish)rRr2rm)rrrrr9s zStdVectorPrinter.childrenc Cs|jdd}|jdd}|jdd}|jr|jddd}|jddd}|jddd}|jddd}|jj}d|j}|||||d|}|||} d |jt|t| fSd |jt||t||fSdS) NrTrnroZ_M_end_of_storager`rarbr*z"%s of length %d, capacity %dz%s of length %d, capacity %d)r2rmrDrrhr$int) rrjrfendrergrkZbllengthZcapacityrrrr<s    zStdVectorPrinter.to_stringcCsdS)Narrayr)rrrr display_hintszStdVectorPrinter.display_hintN) r r r r rrRr3r9r<rtrrrrr_Ns )r_c@s eZdZdZddZddZdS)StdVectorIteratorPrinterzPrint std::vector::iteratorcCs ||_dS)N)r2)rr$r2rrrr3sz!StdVectorIteratorPrinter.__init__cCs |jdsdSt|jdjS)NZ _M_currentz,non-dereferenceable iterator for std::vector)r2rrD)rrrrr<s z"StdVectorIteratorPrinter.to_stringN)r r r r r3r<rrrrrusruc@s8eZdZdZGdddeZddZddZdd Zd S) StdTuplePrinterzPrint a std::tuplec@s$eZdZddZddZddZdS)zStdTuplePrinter._iteratorcCsR||_|jjj}t|dkr4|jj|dj|_nt|dkrHtdd|_dS)Nr*rz4Top of tuple tree does not consist of a single node.)rOrrlenrArrP)rrOnodesrrrr3s   z"StdTuplePrinter._iterator.__init__cCs|S)Nr)rrrrr4sz"StdTuplePrinter._iterator.__iter__cCs|js t|jjj}t|dkr&tt|dkr:tdt|dkr`|jj|dj}d|_n&|jj|dj}|jj|dj|_|jd|_|jj}t|dks|djdkrd|j|fSd|j|dfSdS)Nrrz/Cannot parse more than 2 nodes in a tuple tree.r*r@z[%d]) rOr5rrrwrrArPr)rrximplrrrrrs"       z"StdTuplePrinter._iterator.__next__N)r r r r3r4rrrrrrRs rRcCst||_||_dS)N)r%r$r2)rr$r2rrrr3s zStdTuplePrinter.__init__cCs |j|jS)N)rRr2)rrrrr9szStdTuplePrinter.childrencCs(t|jjjdkrd|jSd|jS)Nrzempty %sz %s containing)rwr2rrr$)rrrrr<s zStdTuplePrinter.to_stringN) r r r r rrRr3r9r<rrrrrvs :rvc@s0eZdZdZddZddZddZdd Zd S) StdStackOrQueuePrinterz Print a std::stack or std::queuecCst||_tj|d|_dS)Nc)r%r$rdefault_visualizer visualizer)rr$r2rrrr3s zStdStackOrQueuePrinter.__init__cCs |jjS)N)r}r9)rrrrr9szStdStackOrQueuePrinter.childrencCsd|j|jjfS)Nz%s wrapping: %s)r$r}r<)rrrrr<sz StdStackOrQueuePrinter.to_stringcCst|jdr|jjSdS)Nrt)hasattrr}rt)rrrrrts  z#StdStackOrQueuePrinter.display_hintN)r r r r r3r9r<rtrrrrrzs rzc@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>rTZ _M_node_countZ _M_header_M_leftr)sizerHrP)rZrbtreerrrr3szRbtreeIterator.__init__cCs|S)Nr)rrrrr4 szRbtreeIterator.__iter__cCs t|jS)N)rpr)rrrr__len__szRbtreeIterator.__len__cCs|j|jkrt|j}|jd|_|j|jkr|j}|jdrl|jd}xd|jdrh|jd}qNWnF|jd}x$||jdkr|}|jd}qzW|jd|kr|}||_|S)Nr*Z_M_rightrZ _M_parent)rPrr5rHrD)rresultrHparentrrrrs$      zRbtreeIterator.__next__N)r r r r r3r4rrrrrrrs rc CsjyF|jjdj}|dkr"|dS|dkrD|jjd}t|d|SWn YnXtdt|jdS)z0Returns the value held in an _Rb_tree_node<_Val>r*Z_M_value_fieldrBrz!Unsupported implementation for %sN)rrrr,rFrr)rHrIrErrrget_value_from_Rb_tree_node(s rc@s eZdZdZddZddZdS)StdRbtreeIteratorPrinterz2Print std::map::iterator, std::set::iterator, etc.cCsb||_|jjjdj}dt|d}trB|jdtrBt|}tjd|}|jj |_ dS)Nrz_Rb_tree_node<>zstd::) r2rr,rrr startswithrrr8 link_type)rr$r2rErMrrrr3=sz!StdRbtreeIteratorPrinter.__init__cCs0|jdsdS|jdj|jj}tt|S)NrUz6non-dereferenceable iterator for associative container)r2rArrDrr)rrHrrrr<Fs z"StdRbtreeIteratorPrinter.to_stringN)r r r r r3r<rrrrr:s rc@s eZdZdZddZddZdS)StdDebugIteratorPrinterz,Print a debug enabled version of an iteratorcCs ||_dS)N)r2)rr$r2rrrr3Osz StdDebugIteratorPrinter.__init__cCsbtjd}|jjjd}|jj|d}|std||_nd|_dS)Nrir*) r%r$r2rr,Zelttyperhrpr)rr$r2rrrrr3s zStdDequePrinter.__init__cCsx|jdd}|jdd}|d|dd}|d|d}|d|d}|j|||}d |jtt|fS) NrTrnrorUr*_M_last_M_cur_M_firstz %s with %s)r2rr$rlong)rrjrqZdelta_nZdelta_sZdelta_errrrr< szStdDequePrinter.to_stringcCs@|jdd}|jdd}|j|d|d|d|d|jS)NrTrnrorUrr)r2rr)rrjrqrrrr9szStdDequePrinter.childrencCsdS)Nrsr)rrrrrtszStdDequePrinter.display_hintN) r r r r rrr3r<r9rtrrrrrs   rc@s eZdZdZddZddZdS)StdDequeIteratorPrinterzPrint std::deque::iteratorcCs ||_dS)N)r2)rr$r2rrrr3#sz StdDequeIteratorPrinter.__init__cCs |jdsdSt|jdjS)Nrz+non-dereferenceable iterator for std::deque)r2rrD)rrrrr<&s z!StdDequeIteratorPrinter.to_stringN)r r r r r3r<rrrrr src@s(eZdZdZddZddZddZdS) StdStringPrinterz&Print a std::basic_string of some kindcCs||_|jddk|_dS)Nz::__cxx11::basic_stringr*)r2find new_string)rr$r2rrrr3.szStdStringPrinter.__init__cCs|jj}|jtjkr|j}|jdd}|jrL|jd}|j|jj}n<|j j}tj t |dj }|j|d}|j d}t|dr|j|dS|j|dS) NZ _M_dataplusr`Z_M_string_lengthz::_Repr*Z _M_length lazy_string)rr)r2rrlr TYPE_CODE_REFrrrArrrrr8rDr~rstring)rrptrrrZrealtypeZreptypeheaderrrrr<2s      zStdStringPrinter.to_stringcCsdS)Nrr)rrrrrtIszStdStringPrinter.display_hintN)r r r r r3r<rtrrrrr+src@s$eZdZddZddZddZdS)Tr1HashtableIteratorcCsj|d|_d|_|d|_t|jdj|_d|_x2|j|jkrd|j|j|_|jrVP|jd|_q4WdS)NZ _M_bucketsrZ_M_bucket_countrSr*)bucketsbucket bucket_countrrr8 node_typerH)rhashrrrr3Ms  zTr1HashtableIterator.__init__cCs|S)Nr)rrrrr4YszTr1HashtableIterator.__iter__cCs|jdkrt|jj|j}|jd}|jd|_|jdkr|jd|_x2|j|jkr~|j|j|_|jrpP|jd|_qNW|S)NrZ_M_vrLr*)rHr5rArrDrrr)rrHrrrrr\s    zTr1HashtableIterator.__next__N)r r r r3r4rrrrrrLs rc@s$eZdZddZddZddZdS)StdHashtableIteratorcCs$|dd|_t|jdj|_dS)NZ_M_before_begin_M_nxtZ __node_type)rHrrr8r)rrrrrr3lszStdHashtableIterator.__init__cCs|S)Nr)rrrrr4pszStdHashtableIterator.__iter__cCsR|jdkrt|jj|jj}|d|_|dj}|j|jjdj}|jS)NrrrB) rHr5rArrDrCrr,r8)rrQvalptrrrrrss   zStdHashtableIterator.__next__N)r r r r3r4rrrrrrksrc@s<eZdZdZddZddZddZedd Zd d Z d S) Tr1UnorderedSetPrinterzPrint a tr1::unordered_setcCst||_||_dS)N)r%r$r2)rr$r2rrrr3s zTr1UnorderedSetPrinter.__init__cCs|jjdr|jS|jdS)Nzstd::tr1_M_h)r$rr2)rrrr hashtables z Tr1UnorderedSetPrinter.hashtablecCs|jd}d|jt|fS)N_M_element_countz %s with %s)rr$r)rrPrrrr<s z Tr1UnorderedSetPrinter.to_stringcCsd|S)Nz[%d]r)irrr format_countsz#Tr1UnorderedSetPrinter.format_countcCs@t|jtj}|jjdr.t|t|jSt|t |jS)Nzstd::tr1) r r itertoolsrPr$rrrrr)rcounterrrrr9s zTr1UnorderedSetPrinter.childrenN) r r r r r3rr< staticmethodrr9rrrrr|s  rc@s\eZdZdZddZddZddZedd Zed d Z ed d Z ddZ ddZ dS)Tr1UnorderedMapPrinterzPrint a tr1::unordered_mapcCst||_||_dS)N)r%r$r2)rr$r2rrrr3s zTr1UnorderedMapPrinter.__init__cCs|jjdr|jS|jdS)Nzstd::tr1r)r$rr2)rrrrrs z Tr1UnorderedMapPrinter.hashtablecCs|jd}d|jt|fS)Nrz %s with %s)rr$r)rrPrrrr<s z Tr1UnorderedMapPrinter.to_stringccs&x |D]}x|D] }|VqWqWdS)Nr)rYrQrrrrflattens  zTr1UnorderedMapPrinter.flattencCs|d|dfS)Nrrr)rQrrr format_onesz!Tr1UnorderedMapPrinter.format_onecCsd|S)Nz[%d]r)rrrrrsz#Tr1UnorderedMapPrinter.format_countcCsdt|jtj}|jjdr@|jt|jt|j }t ||S|jt|jt |j }t ||S)Nzstd::tr1) r rrrPr$rrrrrrr)rrdatarrrr9s   zTr1UnorderedMapPrinter.childrencCsdS)Nrr)rrrrrtsz#Tr1UnorderedMapPrinter.display_hintN) r r r r r3rr<rrrrr9rtrrrrrs    rc@s8eZdZdZGdddeZddZddZdd Zd S) StdForwardListPrinterzPrint a std::forward_listc@s$eZdZddZddZddZdS)zStdForwardListPrinter._iteratorcCs||_|d|_d|_dS)NrLr)rMrNrP)rrMrOrrrr3s z(StdForwardListPrinter._iterator.__init__cCs|S)Nr)rrrrr4sz(StdForwardListPrinter._iterator.__iter__cCsl|jdkrt|jj|jj}|d|_|j}|jd|_|dj}|j|jjdj }d||jfS)NrrLr*rBz[%d]) rNr5rArMrDrPrCrr,r8)rrQrPrrrrrs    z(StdForwardListPrinter._iterator.__next__N)r r r r3r4rrrrrrRsrRcCs||_t||_dS)N)r2r%r$)rr$r2rrrr3szStdForwardListPrinter.__init__cCs0t|jjd}|jj}|j||jddS)NrSrTr])rr2rrr8rR)rrMrrrr9s zStdForwardListPrinter.childrencCs*|jddddkr d|jSd|jS)NrTr]rLrzempty %sz%s)r2r$)rrrrr<s zStdForwardListPrinter.to_stringN) r r r r rrRr3r9r<rrrrrs rc@sBeZdZdZd ddZddZGdddeZd d Zd d Z dS)SingleObjContainerPrinterz7Base class for printers of containers of single objectsNcCs||_||_||_dS)N)contained_valuer}hint)rr2Zvizrrrrr3sz"SingleObjContainerPrinter.__init__cCs(ts t|Stjjtjj|p&t|S)z4Return TYPE as a string after applying type printers)_use_type_printingrrtypesapply_type_recognizersget_type_recognizers)rrrrr _recognizesz$SingleObjContainerPrinter._recognizec@s$eZdZddZddZddZdS)z$SingleObjContainerPrinter._containedcCs ||_dS)N)r2)rr2rrrr3sz-SingleObjContainerPrinter._contained.__init__cCs|S)Nr)rrrrr4sz-SingleObjContainerPrinter._contained.__iter__cCs"|jdkrt|j}d|_d|fS)Nz[contained value])r2r5)rZretvalrrrrs  z-SingleObjContainerPrinter._contained.__next__N)r r r r3r4rrrrr _containedsrcCs6|jdkr|jdSt|jdr*|jjS|j|jS)Nr9)rrr~r}r9)rrrrr9s     z"SingleObjContainerPrinter.childrencCs(t|jdr"t|jdr"|jjS|jS)Nr9rt)r~r}rtr)rrrrrt s z&SingleObjContainerPrinter.display_hint)N) r r r r r3rrrr9rtrrrrrs  rc CsH|jj}tjddkr"t|}nt|}ytj|jj SdSdS)z>Find the name of the function referred to by the gdb.Value f, rrN) rDrCsys version_inforrprZ block_for_pcfunctionr)frrrfunction_pointer_to_names  rcs(eZdZdZfddZddZZS)StdExpAnyPrinterz*Print a std::any or std::experimental::anyc sLt||_tjdd|jd|_||_d|_d}d}|jd}|dkr6t|}|s`td|jdj|}tj ||}|std|j|j d} d | krtjd t t j d j|j d} t j | } | jd|_d} d | kr|jd d j} n(d| kr |jd d} ntd|j| j|jjj}t j|}tt|j||dS)Nz&^std::experimental::fundamentals_v\d::zstd::experimental::r*Z _M_managerrzInvalid function pointer in %sz"({0}::_Manager_\w+<.*>)::_S_managezUnknown manager function in %sz std::stringzstd::string(?!\w)z::_Manager_internalrBZ _M_bufferz::_Manager_externalr7)r%r$rsubr2contained_typerrformatrgrouprrrrr,rCrAr8rDr|superrr3) rr$r2rr}ZmgrfuncZrxmZmgrnameZmgrtyper) __class__rrr3,s:      "    zStdExpAnyPrinter.__init__cCsT|jdkrd|jSd|j}t|jdr8||jjS|j|j}|tt|S)Nz%s [no contained value]z%s containing r9)rr$r~r}r<rr%r)rdescrErrrr<Os     zStdExpAnyPrinter.to_string)r r r r r3r< __classcell__rr)rrr)s #rcs(eZdZdZfddZddZZS)StdExpOptionalPrinterz4Print a std::optional or std::experimental::optionalcs|j|jjd}t||_tjdd||jd|_|jjdsH|d}||_|jdr`|dnd}t j |d}t t |j ||dS)Nrz0^std::(experimental::|)(fundamentals_v\d::|)(.*)z std::\1\3<%s>r*zstd::experimental _M_payload _M_engaged)rrr,r%r$rrrr2rr|rrr3)rr$r2rErr})rrrr3[s  zStdExpOptionalPrinter.__init__cCs:|jdkrd|jSt|jdr4d|j|jjfS|jS)Nz%s [no contained value]r9z%s containing %s)rr$r~r}r<)rrrrr<fs    zStdExpOptionalPrinter.to_string)r r r r r3r<rrr)rrrXs rcs(eZdZdZfddZddZZS)StdVariantPrinterzPrint a std::variantcst|j}t|_djdjfdd|Df_|d_jt|kr`d_d}d}n@|tj_|dddj }|j jj j }t j|}ttj||d dS) Nz%s<%s>z, csg|]}j|qSr)r).0Zalt)rrr tsz.StdVariantPrinter.__init__..Z_M_indexZ_M_urrBrs)r0rr%r$joinindexrwrrprCrAr8rDrr|rrr3)rr$r2Z alternativesrr}Zaddr)r)rrr3qs  $  zStdVariantPrinter.__init__cCsH|jdkrd|jSt|jdr8d|j|j|jjfSd|j|jfS)Nz%s [no contained value]r9z%s [index %d] containing %sz %s [index %d])rr$r~r}rr<)rrrrr<s     zStdVariantPrinter.to_string)r r r r r3r<rrr)rrrns rcs(eZdZdZfddZddZZS)StdNodeHandlePrinterzPrint a container node handlecs|jjd|_|jjdjd}t|jd|_|jjd|jk|_|d}|r~|jrbt|j}nt |d|j}t j |}nd}d}|d}|dr|d nd|_ t t|j||d dS) Nr*rrZ _Rb_tree_noder7rBZ_M_allocrrrs)rr,Z value_typer!ris_rb_tree_node is_map_noderrDrFrr|Zallocrrr3)rr$r2rMZnodeptrrr}Zoptalloc)rrrr3s" zStdNodeHandlePrinter.__init__cCsfd}|js|d7}|jr"|d7}n|d7}|jrZ|d7}t|jdrVd||jjfS|Sd|SdS) Nznode handle for z unordered rsetz with elementr9z%s = %szempty %s)rrrr~r}r<)rrrrrr<s  zStdNodeHandlePrinter.to_string)r r r r r3r<rrr)rrrs rc@s(eZdZdZddZddZddZdS) StdExpStringViewPrinterzFPrint a std::basic_string_view or std::experimental::basic_string_viewcCs ||_dS)N)r2)rr$r2rrrr3sz StdExpStringViewPrinter.__init__cCs6|jd}|jd}t|dr*|j|dS|j|dS)NZ_M_strZ_M_lenr)rr)r2r~rr)rrrwrrrr<s     z!StdExpStringViewPrinter.to_stringcCsdS)Nrr)rrrrrtsz$StdExpStringViewPrinter.display_hintN)r r r r r3r<rtrrrrrsrc@s@eZdZdZddZddZddZGdd d eZd d Z d S) StdExpPathPrinterzDPrint a std::experimental::filesystem::path or std::filesystem::pathcCsB||_||_|jddd}|jddd}t|||_dS)N_M_cmptsrTrnro)r2r$rp num_cmpts)rr$r2rjrfrrrr3s zStdExpPathPrinter.__init__cCs:t|jd}|dddkr"dS|d ddkr6dSdS) NZ_M_type Z _Root_dirzroot-directory Z _Root_namez root-nameii)rr2)rtrrr _path_types zStdExpPathPrinter._path_typecCs8d|jd}|jdkr0|j}|r0d||f}d|S)Nz%s _M_pathnamerz%s [%s]zfilesystem::path %s)r2rr)rpathrrrrr<s   zStdExpPathPrinter.to_stringc@s$eZdZddZddZddZdS)zStdExpPathPrinter._iteratorcCs,||_|dd|_|dd|_d|_dS)NrTrnror)pathtyperdrfrP)rZcmptsrrrrr3sz$StdExpPathPrinter._iterator.__init__cCs|S)Nr)rrrrr4sz$StdExpPathPrinter._iterator.__iter__cCsd|j|jkrt|jj}|j}|jd|_|jd|_|d}t|j|j}|sX|}d||fS)Nr*rz[%s])rdrfr5rDrPrrr)rrdrPrrrrrrs    z$StdExpPathPrinter._iterator.__next__N)r r r r3r4rrrrrrRsrRcCs|j|jd|jS)Nr)rRr2r$)rrrrr9szStdExpPathPrinter.childrenN) r r r r r3rr<rrRr9rrrrrs rc@s8eZdZdZddZGdddeZddZdd Zd S) StdPairPrinterz?Print a std::pair object, with 'first' and 'second' as childrencCs ||_dS)N)r2)rr$r2rrrr3szStdPairPrinter.__init__c@s(eZdZdZddZddZddZdS) zStdPairPrinter._iterz?An iterator for std::pair types. Returns 'first' then 'second'.cCs||_d|_dS)Nr)r2which)rr2rrrr3szStdPairPrinter._iter.__init__cCs|S)Nr)rrrrr4szStdPairPrinter._iter.__iter__cCs8|jdkrt|j}|dkr$d|_nd|_||j|fS)Nrr)rr5r2)rrrrrrs zStdPairPrinter._iter.__next__N)r r r r r3r4rrrrrrsrcCs |j|jS)N)rr2)rrrrr9szStdPairPrinter.childrencCsdS)Nr)rrrrr<szStdPairPrinter.to_stringN) r r r r r3rrr9r<rrrrrs rcs$eZdZfddZddZZS) RxPrintercs$tt|j||_||_d|_dS)NT)rrr3rrenabled)rrr)rrrr3szRxPrinter.__init__cCs:|js dS|jjtjkr,ttjdr,|j}|j|j |S)Nreferenced_value) rrrlrrr~Valuerrr)rvaluerrrinvoke!s  zRxPrinter.invoke)r r r r3rrrr)rrrs rcsHeZdZfddZddZddZddZed d Zd d Z Z S) Printercs6tt|j||_g|_i|_d|_tjd|_ dS)NTz^([a-zA-Z0-9_:]+)(<.*>)?$) rrr3r subprinterslookuprrcompile compiled_rx)rr)rrrr3.s zPrinter.__init__cCs<|jj|std|t||}|jj|||j|<dS)Nz0libstdc++ programming error: "%s" does not match)rrrrrr+r)rrrprinterrrradd6s     z Printer.addcCs:|j|||tr6tjddt|}|j|||dS)Nz^(std|__gnu_cxx)::z\g<0>%s)rrrr)rrNrrZvbaserrr add_version@szPrinter.add_versioncCs$|j||||j|d||dS)Nz __cxx1998::)r)rrNrrrrr add_containerGszPrinter.add_containercCs&|jtjkr|j}|jj}|jS)N)rlrrrrrtag)rrrrget_basic_typeKs  zPrinter.get_basic_typecCsr|j|j}|sdS|jj|}|s(dS|jd}|jjtjkrTttj drT|j }||j krn|j |j |SdS)Nr*r) rrrrrrlrrr~rrrr)rr2r$rbasenamerrr__call__Vs     zPrinter.__call__) r r r r3rrrrrr rrr)rrr-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|_dS)NT)rdefargsr)rrr rrrr3zszTemplateTypePrinter.__init__c@s(eZdZdZddZddZddZdS) zTemplateTypePrinter._recognizerz-The recognizer class for TemplateTypePrinter.cCs||_||_dS)N)rr )rrr rrrr3sz(TemplateTypePrinter._recognizer.__init__c Cs|jdkrdS|jj|js dSt|}g}d}xtt|D]}||}|jj|}|dk r|j|}y|t j |kr|dSWn$t j k r|j|krdSYnXd}q>|rdS|j |j |q>W|jd|jjd}t|}|ddj|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', 3: 'std::equal_to<{0}>', 4: 'std::allocator >' } zstd::c3s"|]\}}||jdfVqdS)zstd::N)r#)rr.d)nsrr sz0add_one_template_type_printer..N)r rrregister_type_printerrdictitems)objrr rr)rradd_one_template_type_printersr c@s0eZdZdZddZGdddeZddZdS) FilteringTypePrintera A type printer that uses typedef names for common template specializations. Args: match (str): The class template to recognize. name (str): The typedef-name that will be used instead. Checks if a specialization of the class template 'match' 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. cCs||_||_d|_dS)NT)rrr)rrrrrrr3szFilteringTypePrinter.__init__c@s eZdZdZddZddZdS)z FilteringTypePrinter._recognizerz-The recognizer class for TemplateTypePrinter.cCs||_||_d|_dS)N)rrr-)rrrrrrr3sz)FilteringTypePrinter._recognizer.__init__c Csf|jdkrdS|jdkrN|jj|js*dSytj|jj|_Wn YnX|j|krbt|jSdS)z If type_obj starts with self.match and is the same type as self.name then return self.name, otherwise None. N) rr-rrrrrrr))rr-rrrr s    z*FilteringTypePrinter._recognizer.recognizeN)r r r r r3rrrrrrsrcCs|j|j|jS)z1Return a recognizer object for this type printer.)rrr)rrrrrsz FilteringTypePrinter.instantiateN)r r r r r3rrrrrrrr!s r!cCsPtd|d|}tjj||trLdt}t||||}tjj||dS)Nzstd::)r!rrrr)rrrrrrrradd_one_type_printer"s r"c CstsdSx@dVD]8}t|d|dt|dd|dt|d |d qWxddWD]\}x dXD]}t|d|||qZWx4dYD],}t|d|||t|d|||q|WqPWxdZD]z}x$d[D]}t||d||dqWxNd\D]F}t||d ||d!x&d]D]}t||||||qWqWqWt|d%d&xd^D]}t|d-|qFWt|d.d/t|d.d0t|d1d2t|d1d3t|d4d5t|d4d6t|d7d8t|d7d9t|d:d;d<}x&d_D]}t||d ||d qWt|d=d>d?it|d@d>dAit|dBd>dAit|dCd>dAit|dDd>dAit|dEd>dAit|dFdGdHdIt|dJdGdHdIt|dKdGdAdLt|dMdGdAdLt|dNdOdPdHdQt|dRdOdPdHdQt|dSdOdPdAdTt|dUdOdPdAdTdS)`Nr"ru16u32 basic_stringrz__cxx11::basic_string __cxx11::basic_string_viewZ string_viewios streambufistreamostreamiostreamfilebufifstreamofstreamfstreamZbasic_ stringbuf istringstream ostringstream stringstreamz__cxx11::basic_Z basic_regexZregexr{swcwsZ match_resultsr sub_matchregex_iteratorregex_token_iteratorZfposZ streampos nanoseconds microseconds millisecondssecondsminuteshoursZdurationZlinear_congruential_engineZ minstd_rand0Z minstd_randZmersenne_twister_engineZmt19937Z mt19937_64Zsubtract_with_carry_engineZ ranlux24_baseZ ranlux48_baseZdiscard_block_engineZranlux24Zranlux48Zshuffle_order_engineZknuth_bzexperimental::fundamentals_v1:: unique_ptrr*zstd::default_delete<{0}>dequezstd::allocator<{0}>r[rYz __cxx11::listvectorrzstd::less<{0}>z)std::allocator>)rmultimapr)r*rmultiset unordered_mapzstd::hash<{0}>zstd::equal_to<{0}>)rrDunordered_multimap unordered_set)r*rrDunordered_multiset)r"rr#r$)r"r) r(r)r*r+r,r-r.r/r0)r1r2r3r4)r"r&)r"r)r{r5r6r7)r8r9r:)r;r<r=r>r?r@)r"rr#r$)rr"r )rZchxabiZdurrrrrregister_type_printers*s      (                    rNcCs8trtjj|tn|dkr t}|jjtt|dS)z4Register libstdc++ pretty-printers with objfile Obj.N) _use_gdb_pprZprintingZregister_pretty_printerlibstdcxx_printerZpretty_printersr+rN)rrrrregister_libstdcxx_printerss  rQcCstdatjddttjddttjddttjddttjddttjddttjddttjdd ttjdd t tjdd t tjdd t tjdd t tjddt tjddt tjddt tjddt tjddttjdttjdttjdttjdttjdttjdt tjdt tjdt tjdt tjdt tjdt tjdttjddttjdd ttjdd!ttjdd"ttjdd#ttjdd$ttjdd%ttjd&dttjd&d ttjd&d!ttjd&d"ttjd&d#ttjd&d$ttjd'ttjd(ttjd)ttjd*ttjd+ttjd,d-ttjd,d.ttjd,d/ttjd0d1ttjd2d1ttjd3d1ttjd4d1ttjdd-ttjdd.ttjdd/ttjdd5ttjdd6ttjd7d8ttjdd9ttjdd:ttjdd;ttjddttjd7d?ttjd7d@ttjddAt tjddBt tjdCt!dS)DNz libstdc++-v6zstd::r%zstd::__cxx11::ZbitsetrBrYrrErFrZpriority_queueZqueuer?rstackrArCzstd::__debug::bitsetzstd::__debug::dequezstd::__debug::listzstd::__debug::mapzstd::__debug::multimapzstd::__debug::multisetzstd::__debug::priority_queuezstd::__debug::queuezstd::__debug::setzstd::__debug::stackzstd::__debug::unique_ptrzstd::__debug::vectorZ shared_ptrZweak_ptrrGrJrIrKr[z std::tr1::zstd::__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_handlez __gnu_cxx::ZslistZ_List_iteratorZ_List_const_iteratorZ_Rb_tree_iteratorZ_Rb_tree_const_iteratorZ_Deque_iteratorZ_Deque_const_iteratorZ__normal_iteratorZ_Slist_iteratorZ_Fwd_list_iteratorZ_Fwd_list_const_iteratorz__gnu_debug::_Safe_iterator)"rrPrrrrrrKrrrrzrvr=r_rr6rrrrrrrrrr\rXrrrur^rZrrrrrbuild_libstdcxx_dictionarys           rT)Lrrrrrrrrr ziprrprrOZ gdb.printing ImportErrorrZ gdb.typesr~rrrr!r%r)r0r1r6r=rFrJrKrVrXrZr\r^r_rurvrzrrrrrrrrrrrrrrrrrrrrrrrrrrrrPr r r!r"rNrQrTrrrrs     %" L I'+%.@ !,%+/)5#@d4^