uawdijnntqw1x1x1
IP : 216.73.216.110
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
www
/
node_modules
/
form-data
/
..
/
make-iterator
/
..
/
..
/
test
/
..
/
4d695
/
python.zip
/
/
PK���\�@JY��3libstdcxx/__pycache__/__init__.cpython-36.opt-1.pycnu�[���3 ���h�@sdS)N�rrr�-/usr/share/gcc-8/python/libstdcxx/__init__.py�<module>sPK���\�@JY��-libstdcxx/__pycache__/__init__.cpython-36.pycnu�[���3 ���h�@sdS)N�rrr�-/usr/share/gcc-8/python/libstdcxx/__init__.py�<module>sPK���\ �B�666libstdcxx/v6/__pycache__/__init__.cpython-36.opt-1.pycnu�[���3 ���h}�@sdd�Zdd�ZdS)cCs&yddl}dStk r dSXdS)N�TF)Zgdb.xmethod�ImportError)Zgdb�r�0/usr/share/gcc-8/python/libstdcxx/v6/__init__.py�gdb_has_xmethodss rcCs2ddlm}||�t�r.ddlm}||�dS)N�)�register_libstdcxx_printers)�register_libstdcxx_xmethods)ZprintersrrZxmethodsr)�objrrrrrrs rN)rrrrrr�<module>sPK���\ �B�660libstdcxx/v6/__pycache__/__init__.cpython-36.pycnu�[���3 ���h}�@sdd�Zdd�ZdS)cCs&yddl}dStk r dSXdS)N�TF)Zgdb.xmethod�ImportError)Zgdb�r�0/usr/share/gcc-8/python/libstdcxx/v6/__init__.py�gdb_has_xmethodss rcCs2ddlm}||�t�r.ddlm}||�dS)N�)�register_libstdcxx_printers)�register_libstdcxx_xmethods)ZprintersrrZxmethodsr)�objrrrrrrs rN)rrrrrr�<module>sPK���\�3,�xexe6libstdcxx/v6/__pycache__/printers.cpython-36.opt-1.pycnu�[���3 ���h���@s�ddlZddlZddlZddlZddlZddlZejddkrXeZe Z eZe ZejjZn6Gdd�d�Zddlm Z mZGdd�dej�Ze�ZdayddlZWnek r�d aYnXd ayddlZeejd �r�daWnek r�YnXeed��rejZneZdd �Zdadd�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&Gdd �d e�Z'Gd!d"�d"e�Z(d#d$�Z)d%d&�Z*d'd(�Z+Gd)d*�d*e�Z,d+d,�Z-d-d.�Z.Gd/d0�d0e�Z/Gd1d2�d2e�Z0Gd3d4�d4e0�Z1Gd5d6�d6e0�Z2Gd7d8�d8e�Z3Gd9d:�d:e�Z4Gd;d<�d<e�Z5Gd=d>�d>e�Z6Gd?d@�d@e�Z7GdAdB�dBe�Z8GdCdD�dDe�Z9GdEdF�dFe�Z:GdGdH�dHe�Z;dIdJ�Z<GdKdL�dLe�Z=GdMdN�dNe�Z>dOdP�Z?GdQdR�dRe�Z@GdSdT�dTe�ZAGdUdV�dVe�ZBGdWdX�dXe�ZCGdYdZ�dZe�ZDGd[d\�d\e�ZEd]d^�ZFGd_d`�d`e�ZGGdadb�dbe�ZHGdcdd�dde�ZIGdedf�dfe�ZJGdgdh�dhe�ZKGdidj�dje�ZLGdkdl�dle�ZMGdmdn�dne�ZNdodp�ZOGdqdr�dreN�ZPGdsdt�dteN�ZQGdudv�dveN�ZRGdwdx�dxeN�ZSGdydz�dze�ZTGd{d|�d|e�ZUGd}d~�d~e�ZVGdd��d�e�ZWGd�d��d�e�ZXGd�d��d�e�ZYGd�d��d�e�ZZGd�d��d�e�Z[Gd�d��d�e�Z\Gd�d��d�e�Z]Gd�d��d�e�Z^Gd�d��d�e�Z_Gd�d��d�e�Z`Gd�d��d�e�Zadd�d�d�d�d�d�d�d�d�d�d�d�g Zbd�d�d�d�d�d�d�d�gZcGd�d��d�e�ZdGd�d��d�e�ZeGd�d��d�e�ZfGd�d��d�e�ZgGd�d��d�e�ZhGd�d��d�e�ZiGd�d��d�e�ZjGd�d��d�e�ZkGd�d��d�e�ZlGd�d��d�e�ZmdanGd�d��d�e�Zod�d��ZpGd�d��d�e�Zqd�d�dÄZrd�dńZsd�dDŽZtd�dɄZueu�dS)��N�c@seZdZdZdd�ZdS)�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: <http://pythonhosted.org/six/#six.Iterator> cCs|j�S)N)�__next__)�self�r�0/usr/share/gcc-8/python/libstdcxx/v6/printers.py�next?sz Iterator.nextN)�__name__� __module__�__qualname__�__doc__rrrrrr4s r)�imap�izipc@s(eZdZdZdd�Zdd�Zdd�ZdS) �UTCz5Concrete tzinfo class representing the UTC time zone.cCs tjd�S)Nr)�datetime� timedelta)r�dtrrr� utcoffsetIsz UTC.utcoffsetcCsdS)Nrr)rrrrr�tznameLsz UTC.tznamecCs tjd�S)Nr)rr)rrrrr�dstOszUTC.dstN)r r rrrrrrrrrrFsrTFZTypePrinter�ValuePrintercCsz|j�}xld|j|f}y tj|�Stk r6YnX|j�}t|�r^|djr^|dj}q t dt |�|f��q WdS)Nz%s::%srzCannot find type %s::%s)�strip_typedefs�tag�gdb�lookup_type�RuntimeError�fields�len� is_base_class�type� ValueError�str)Zorig�name�typ�searchrrrr� find_typens r%z__8::cGs�dj|djdd�|D���}y tj|�Stjk r�}zFt|krv|jddtd�}y tj|�Stjk rtYnX|�WYdd}~XnXdS)z8 Lookup template specialization templ<args...>. z{}<{}>z, cSsg|]}t|��qSr)r!)�.0�arrr� <listcomp>�sz%lookup_templ_spec.<locals>.<listcomp>z::�N)�format�joinrr�error�_versioned_namespace�replace)Ztempl�args�t�errr�lookup_templ_spec�s r2cCs�d|krd|}yt|d�}Wn|jd�}YnX|j�}y t||�Stjk r�t|d�r�t|ddd�r�|jdd d �}y t||�Stjk r�YnXdSXdS)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<int>')) will return a gdb.Type for the type std::_List_node<int>. z::zstd::� value_typerZstdzstd::__cxx1998zstd::__debugZ__gnu_debugz ::__cxx1998::r)N)r%�template_argumentrr2rr,�is_member_of_namespacer.)�nodenameZ containertype�valtyperrr�lookup_node_type�s& r8cGs@t|tj�rt|�}t|�}x|D]}|j|d�r"dSq"WdS)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. z::TF)� isinstancer�Typer!�strip_versioned_namespace� startswith)r#Z namespaces� namespacerrrr5�s r5cCs2t|tj�r|j}dt|f}tjd||�dk S)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)r9rr:rr-�re�match)�x� template_namerrr�is_specialization_of�srBcCs|jtd�S)N�)r.r-)�typenamerrrr;�sr;cCs<d}d}tjddkr&tj|||d�Stj|||dd�SdS)zCRemove "fundamentals_vN" inline namespace from qualified type name.z&^std::experimental::fundamentals_v\d::zstd::experimental::rrr))�countN)�sys�version_infor>�sub)r#�pattern�replrrr�strip_fundts_namespace�s rKcCsVt|�}|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_v1�fundamentals_v2z::zfilesystem::zv1::)rLrM)r;r.)�type_strZexpt_nsZlfts_nsZfs_nsrrr�strip_inline_namespaces�s rOc Cs:d}g}x,y|j|j|��Wn |S|d7}q WdS)z-Return a type's template arguments as a list.rr)N)�appendr4)�type_obj�n� template_argsrrr�get_template_arg_list�srTc@s(eZdZdZdd�Zdd�Zdd�ZdS) �SmartPtrIteratorz@An iterator for smart pointer types with a single 'child' value.cCs ||_dS)N)�_val)r�valrrr�__init__szSmartPtrIterator.__init__cCs|S)Nr)rrrr�__iter__szSmartPtrIterator.__iter__cCs$|jdkrt�d|j|_}d|fS)Nzget())rV� StopIteration)rrWrrrr s zSmartPtrIterator.__next__N)r r rrrXrYrrrrrrUsrUc@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�SharedPointerPrinterzP Print a shared_ptr, weak_ptr, atomic<shared_ptr>, or atomic<weak_ptr>. cCst|�|_||_|d|_dS)N�_M_ptr)r;� _typenamerV�_pointer)rrDrWrrrrXs zSharedPointerPrinter.__init__cCs t|j�S)N)rUr^)rrrr�childrenszSharedPointerPrinter.childrencCsR|jdkrD|jddd}||d}t|jdjd�}|j|�S|jddS)Nzstd::atomicZ_M_refcountZ_M_val�_M_ir�pointerZ_M_pi)r]rVr%r�cast)rZptr_valZptr_typerrr�_get_refcountss z#SharedPointerPrinter._get_refcountscCspd}|j�}|jjjd�}tt|��}|dkr`|d}|d}|dkrPd|}nd||df}d|j||fS) N�emptyrZ_M_use_countZ _M_weak_countzexpired, weak count %dzuse count %d, weak count %dr)z%s<%s> (%s))rcrVrr4r;r!r])r�stateZ refcounts�targZusecountZ weakcountrrr� to_string(s zSharedPointerPrinter.to_stringN)r r rrrXr_rcrgrrrrr[s r[cCs�|jj�}|djs&tdt|j���|j|dj�}|jj�}t|�dkr^tdt|j���|djdkrt|dS|djr�|j|dj�Stdt|j���dS)zBReturn the tuple element stored in a _Tuple_impl<N, T> base class.r)z-Unsupported implementation for std::tuple: %sr�_M_head_implN���ri)rrrr r!rbrr")rW�basesZ head_baserrrr�_tuple_impl_get9s rkcCshtt|j��}||krtd��|j|jj�dj�}x*|dkr^|j|jj�dj�}|d8}q6Wt|�S)z6Return the result of std::get<n>(val) on a std::tuple.z0Out of range index for std::get<N> on std::tuplerr))rrTrr rbrrk)rRrWZ tuple_size�noderrr� tuple_getQs rmcCsd|jj�djj�}t|d�s(t|d�r6|dd}n$t|d�rJ|d}ntdt|���td|�S)z4Return the result of val.get() on a std::unique_ptr.rZ__uniq_ptr_dataZ__uniq_ptr_impl�_M_t�tuplez-Unsupported implementation for unique_ptr: %s)rrrrBr r!rm)rWZ impl_typeZtuple_memberrrr�unique_ptr_get_s rpc@s(eZdZdZdd�Zdd�Zdd�ZdS) �UniquePointerPrinterzPrint a unique_ptr.cCs ||_dS)N)rV)rrDrWrrrrXtszUniquePointerPrinter.__init__cCstt|j��S)N)rUrprV)rrrrr_wszUniquePointerPrinter.childrencCs|jjjd�}djt|��S)Nrzstd::unique_ptr<{}>)rVrr4r*r!)rr0rrrrgzszUniquePointerPrinter.to_stringN)r r rrrXr_rgrrrrrqqsrqcCs|djj|j��j�S)z7Return the value held in a __gnu_cxx::__aligned_membuf.� _M_storage)�addressrbra�dereference)Zbufr7rrr�get_value_from_aligned_membufsruc CsjyF|jj�dj}|dkr"|dS|dkrD|jjd�}t|d|�SWnYnXtdt|j���dS)z-Return the value held in an _List_node<_Val>.r)�_M_datarrrz!Unsupported implementation for %sN)rrr"r4rur r!)rl�memberr7rrr�get_value_from_list_node�srxc@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdListPrinterzPrint a std::list.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdListPrinter._iteratorcCs"||_|d|_|j|_d|_dS)N�_M_nextr)� _nodetype�_basers�_head�_count)r�nodetype�headrrrrX�s z!StdListPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz!StdListPrinter._iterator.__iter__cCsR|j|jkrt�|jj|j�j�}|d|_|j}|jd|_t|�}d||fS)Nrzr)z[%d])r|r}rZrbr{rtr~rx)r�eltrErWrrrr�s z!StdListPrinter._iterator.__next__N)r r rrXrYrrrrr� _iterator�sr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdListPrinter.__init__cCs(td|jj�j�}|j||jdd�S)N� _List_node�_M_impl�_M_node)r8rVrrar�)rrrrrr_�szStdListPrinter.childrencCs0|jdd}|d|jkr&d|jSd|jS)Nr�r�rzzempty %sz%s)rVrsr])rZheadnoderrrrg�s zStdListPrinter.to_stringN) r r rrrr�rXr_rgrrrrry�s ryc@seZdZdd�Zdd�ZdS)�NodeIteratorPrintercCs$||_||_||_t||j�|_dS)N)rVr]� _contnamer8rr{)rrDrWZcontnamer6rrrrX�szNodeIteratorPrinter.__init__cCs:|jdsd|jS|jdj|jj��j�}tt|��S)Nr�z(non-dereferenceable iterator for std::%s)rVr�rbr{rartr!rx)rrlrrrrg�s zNodeIteratorPrinter.to_stringN)r r rrXrgrrrrr��sr�c@seZdZdZdd�ZdS)�StdListIteratorPrinterzPrint std::list::iterator.cCstj|||dd�dS)N�listr�)r�rX)rrDrWrrrrX�szStdListIteratorPrinter.__init__N)r r rrrXrrrrr��sr�c@seZdZdZdd�ZdS)�StdFwdListIteratorPrinterz"Print std::forward_list::iterator.cCstj|||dd�dS)N�forward_list�_Fwd_list_node)r�rX)rrDrWrrrrX�sz"StdFwdListIteratorPrinter.__init__N)r r rrrXrrrrr��sr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdSlistPrinterzPrint a __gnu_cxx::slist.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSlistPrinter._iteratorcCs||_|dd|_d|_dS)N�_M_headrzr)r{r|r~)rrr�rrrrX�sz"StdSlistPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz"StdSlistPrinter._iterator.__iter__cCsL|jdkrt�|jj|j�j�}|d|_|j}|jd|_d||dfS)Nrrzr)z[%d]rv)r|rZrbr{rtr~)rr�rErrrr�s z"StdSlistPrinter._iterator.__next__N)r r rrXrYrrrrrr��sr�cCs ||_dS)N)rV)rrDrWrrrrX�szStdSlistPrinter.__init__cCs td|jj�}|j|j�|j�S)Nz__gnu_cxx::_Slist_node)r8rVrr�ra)rrrrrr_�szStdSlistPrinter.childrencCs|jdddkrdSdS)Nr�rzrzempty __gnu_cxx::slistz__gnu_cxx::slist)rV)rrrrrg�szStdSlistPrinter.to_stringN) r r rrrr�rXr_rgrrrrr��s r�c@s eZdZdZdd�Zdd�ZdS)�StdSlistIteratorPrinterz!Print __gnu_cxx::slist::iterator.cCs ||_dS)N)rV)rrDrWrrrrX�sz StdSlistIteratorPrinter.__init__cCs<|jdsdStd|jj�j�}t|jdj|�j�d�S)Nr�z1non-dereferenceable iterator for __gnu_cxx::slistz__gnu_cxx::_Slist_noderv)rVr8rrar!rbrt)rrrrrrgs z!StdSlistIteratorPrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) �StdVectorPrinterzPrint a std::vector.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdVectorPrinter._iteratorcCs^||_|rH|d|_d|_|d|_|d|_|jj�j}d|j|_n||_||_d|_ dS)N�_M_pr� _M_offset�) �_bitvec�_item�_so�_finish�_fortr�sizeof�_isizer~)r�start�finishZbitvec�ityperrrrXs z#StdVectorPrinter._iterator.__init__cCs|S)Nr)rrrrrYsz#StdVectorPrinter._iterator.__iter__cCs�|j}|jd|_|jr�|j|jkr4|j|jkr4t�t|jj�d|j>@�}|jd|_|j|j krv|jd|_d|_d||fS|j|jkr�t�|jj�}|jd|_d||fSdS)Nr)rz[%d]) r~r�r�r�r�r�rZ�boolrtr�)rrEr�rrrrs z#StdVectorPrinter._iterator.__next__N)r r rrXrYrrrrrr�sr�cCs*t|�|_||_|jjd�jtjk|_dS)Nr) r;r]rVrr4�coder�TYPE_CODE_BOOL�_is_bool)rrDrWrrrrX0s zStdVectorPrinter.__init__cCs$|j|jdd|jdd|j�S)Nr��_M_start� _M_finish)r�rVr�)rrrrr_6szStdVectorPrinter.childrenc Cs�|jdd}|jdd}|jdd}|jr�|jddd}|jddd}|jddd}|j�j}d|j}||||}|||}d|jt|�t|�fSd |jt||�t||�fSdS) Nr�r�r�Z_M_end_of_storager�r�r�z"%s<bool> of length %d, capacity %dz%s of length %d, capacity %d)rVr�rtrr�r]�int) rr�r��endZfor�Zbl�lengthZcapacityrrrrg;s zStdVectorPrinter.to_stringcCsdS)N�arrayr)rrrr�display_hintMszStdVectorPrinter.display_hintN) r r rrrr�rXr_rgr�rrrrr�s%r�c@s eZdZdZdd�Zdd�ZdS)�StdVectorIteratorPrinterzPrint std::vector::iterator.cCs ||_dS)N)rV)rrDrWrrrrXTsz!StdVectorIteratorPrinter.__init__cCs |jdsdSt|jdj��S)NZ _M_currentz,non-dereferenceable iterator for std::vector)rVr!rt)rrrrrgWs z"StdVectorIteratorPrinter.to_stringN)r r rrrXrgrrrrr�Qsr�c@s eZdZdZdd�Zdd�ZdS)�StdBitIteratorPrinterz@Print std::vector<bool>'s _Bit_iterator and _Bit_const_iterator.cCs ||_dS)N)rV)rrDrWrrrrX`szStdBitIteratorPrinter.__init__cCs.|jdsdSt|jdj�d|jd>@�S)Nr�z2non-dereferenceable iterator for std::vector<bool>r)r�)rVr�rt)rrrrrgcs zStdBitIteratorPrinter.to_stringN)r r rrrXrgrrrrr�]sr�c@s eZdZdZdd�Zdd�ZdS)�StdBitReferencePrinterz#Print std::vector<bool>::reference.cCs ||_dS)N)rV)rrDrWrrrrXmszStdBitReferencePrinter.__init__cCs*|jdsdSt|jdj�|jd@�S)Nr�z$invalid std::vector<bool>::referenceZ_M_mask)rVr�rt)rrrrrgps z StdBitReferencePrinter.to_stringN)r r rrrXrgrrrrr�jsr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdTuplePrinterzPrint a std::tuple.c@s0eZdZedd��Zdd�Zdd�Zdd�Zd S) zStdTuplePrinter._iteratorcCsNt|�dkr"t|djd�rBdSn t|�dkr2dSt|�dkrBdStd��dS)Nrr)Z__tuple_baseTrFz4Top of tuple tree does not consist of a single node.)rrBrr )�nodesrrr�_is_nonempty_tuple}sz,StdTuplePrinter._iterator._is_nonempty_tuplecCs:||_|jjj�}|j|�r0|jj|dj�|_d|_dS)Nr)r}rrr�rbr~)rr�r�rrrrX�s z"StdTuplePrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz"StdTuplePrinter._iterator.__iter__cCs�|js t�|jjj�}t|�dkr&t�t|�dkr:td��t|�dkr`|jj|dj�}d|_n&|jj|dj�}|jj|dj�|_|jd|_|jj�}t|�dks�|djdkr�d|jd|fSd|jd|dfSdS)Nrrz/Cannot parse more than 2 nodes in a tuple tree.r)rhz[%d]) r}rZrrrr rbr~r")rr��implrrrrr�s$ z"StdTuplePrinter._iterator.__next__N)r r r�staticmethodr�rXrYrrrrrr�|sr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdTuplePrinter.__init__cCs|j|j�S)N)r�rV)rrrrr_�szStdTuplePrinter.childrencCs(t|jjj��dkrd|jSd|jS)Nrzempty %sz %s containing)rrVrrr])rrrrrg�s zStdTuplePrinter.to_stringN) r r rrrr�rXr_rgrrrrr�ys Er�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�StdStackOrQueuePrinterz!Print a std::stack or std::queue.cCst|�|_tj|d�|_dS)N�c)r;r]r�default_visualizer�_visualizer)rrDrWrrrrX�s zStdStackOrQueuePrinter.__init__cCs |jj�S)N)r�r_)rrrrr_�szStdStackOrQueuePrinter.childrencCsd|j|jj�fS)Nz%s wrapping: %s)r]r�rg)rrrrrg�sz StdStackOrQueuePrinter.to_stringcCst|jd�r|jj�SdS)Nr�)�hasattrr�r�)rrrrr��s z#StdStackOrQueuePrinter.display_hintN)r r rrrXr_rgr�rrrrr��s r�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�RbtreeIteratorzf Turn an RB-tree-based container (std::map, std::set etc.) into a Python iterable object. cCs2|ddd|_|dddd|_d|_dS)Nrnr�Z _M_node_countZ _M_header�_M_leftr)�_size�_noder~)rZrbtreerrrrX�szRbtreeIterator.__init__cCs|S)Nr)rrrrrY�szRbtreeIterator.__iter__cCs t|j�S)N)r�r�)rrrr�__len__�szRbtreeIterator.__len__cCs�|j|jkrt�|j}|jd|_|j|jkr�|j}|j�drl|j�d}xd|j�drh|j�d}qNWnF|j�d}x$||j�dkr�|}|j�d}qzW|j�d|kr�|}||_|S)Nr)Z_M_rightr�Z _M_parent)r~r�rZr�rt)r�resultrl�parentrrrr�s$zRbtreeIterator.__next__N)r r rrrXrYr�rrrrrr��s r�c CsjyF|jj�dj}|dkr"|dS|dkrD|jjd�}t|d|�SWnYnXtdt|j���dS)z0Return the value held in an _Rb_tree_node<_Val>.r)Z_M_value_fieldrrrz!Unsupported implementation for %sN)rrr"r4rur r!)rlrwr7rrr�get_value_from_Rb_tree_node sr�c@s eZdZdZdd�Zdd�ZdS)�StdRbtreeIteratorPrinterz2Print std::map::iterator, std::set::iterator, etc.cCs"||_td|jj�}|j�|_dS)N� _Rb_tree_node)rVr8rra� _link_type)rrDrWrrrrrX!sz!StdRbtreeIteratorPrinter.__init__cCs0|jdsdS|jdj|j�j�}tt|��S)Nr�z6non-dereferenceable iterator for associative container)rVrbr�rtr!r�)rrlrrrrg&s z"StdRbtreeIteratorPrinter.to_stringN)r r rrrXrgrrrrr�sr�c@s eZdZdZdd�Zdd�ZdS)�StdDebugIteratorPrinterz-Print a debug enabled version of an iterator.cCs ||_dS)N)rV)rrDrWrrrrX0sz StdDebugIteratorPrinter.__init__cCsbtjd�}|jjjd�}|jj|�d}|s<t|jj|��S|jd|dkrRdSt|jj|��S)Nz __gnu_debug::_Safe_iterator_baserZ_M_sequenceZ _M_versionzinvalid iterator)rrrVrr4rbr!)rZ base_typer�Zsafe_seqrrrrg5s z!StdDebugIteratorPrinter.to_stringN)r r rrrXrgrrrrr�-sr�cCs|dkrdSd|S)zDReturn either "1 element" or "N elements" depending on the argument.r)z 1 elementz%d elementsr)�numrrr�num_elements@sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) � StdMapPrinterz"Print a std::map or std::multimap.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdMapPrinter._itercCs||_d|_||_dS)Nr)�_rbiterr~�_type)r�rbiterrrrrrXJszStdMapPrinter._iter.__init__cCs|S)Nr)rrrrrYOszStdMapPrinter._iter.__iter__cCsh|jddkr@t|j�}|j|j�j�}t|�}||_|d}n |jd}d|j|f}|jd|_|S)Nrr�first�secondz[%d]r))r~rr�rbr�rtr�Z_pair)rrR�itemr�rrrrRs zStdMapPrinter._iter.__next__N)r r rrXrYrrrrr�_iterIsr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX_s zStdMapPrinter.__init__cCsd|jttt|j���fS)Nz %s with %s)r]r�rr�rV)rrrrrgcszStdMapPrinter.to_stringcCs$td|jj�j�}|jt|j�|�S)Nr�)r8rVrrar�r�)rrlrrrr_gszStdMapPrinter.childrencCsdS)N�mapr)rrrrr�kszStdMapPrinter.display_hintN) r r rrrr�rXrgr_r�rrrrr�Esr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)� StdSetPrinterz"Print a std::set or std::multiset.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSetPrinter._itercCs||_d|_||_dS)Nr)r�r~r�)rr�rrrrrXtszStdSetPrinter._iter.__init__cCs|S)Nr)rrrrrYyszStdSetPrinter._iter.__iter__cCs@t|j�}|j|j�j�}t|�}d|j|f}|jd|_|S)Nz[%d]r))rr�rbr�rtr�r~)rr�r�rrrr|s zStdSetPrinter._iter.__next__N)r r rrXrYrrrrrr�ssr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdSetPrinter.__init__cCsd|jttt|j���fS)Nz %s with %s)r]r�rr�rV)rrrrrg�szStdSetPrinter.to_stringcCs$td|jj�j�}|jt|j�|�S)Nr�)r8rVrrar�r�)rrlrrrr_�szStdSetPrinter.childrenN) r r rrrr�rXrgr_rrrrr�os r�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdBitsetPrinterzPrint a std::bitset.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdBitsetPrinter.__init__cCs d|jS)Nz%s)r])rrrrrg�szStdBitsetPrinter.to_stringc Cs�y|jd}Wn gS|j}|jtjkr8|j�j}n|g}|j}|j|}g}d}xh||kr�||}d}xF|dkr�|d@dkr�|jd||d|df�|d}|d?}qnW|d}qXW|S)NZ_M_wrr)z[%d]r�)rVrr�r�TYPE_CODE_ARRAY�targetr�rP) rZwordsZwtypeZtsizeZnwordsr�Zbyte�w�bitrrrr_�s, zStdBitsetPrinter.childrenN)r r rrrXrgr_rrrrr��sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) �StdDequePrinterzPrint a std::deque.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdDequePrinter._itercCs(||_||_||_||_||_d|_dS)Nr)r��_p�_end�_last�_buffer_sizer~)rrlr�r��last�buffer_sizerrrrX�szStdDequePrinter._iter.__init__cCs|S)Nr)rrrrrY�szStdDequePrinter._iter.__iter__cCsr|j|jkrt�d|j|jj�f}|jd|_|jd|_|j|jkrn|jd|_|jd|_|j|j|_|S)Nz[%d]r)r)r�r�rZr~rtr�r�r�)rr�rrrr�szStdDequePrinter._iter.__next__N)r r rrXrYrrrrrr��sr�cCsHt|�|_||_|jjd�|_|jj}|dkr>td|�|_nd|_dS)Nrir)) r;r]rVrr4Z_elttyper�r�r�)rrDrW�sizerrrrX�s zStdDequePrinter.__init__cCsx|jdd}|jdd}|d|dd}|d|d}|d|d}|j|||}d |jtt|��fS) Nr�r�r�r�r)�_M_last�_M_cur�_M_firstz %s with %s)rVr�r]r��long)rr�r�Zdelta_nZdelta_sZdelta_er�rrrrg�szStdDequePrinter.to_stringcCs@|jdd}|jdd}|j|d|d|d|d|j�S)Nr�r�r�r�r�r�)rVr�r�)rr�r�rrrr_�szStdDequePrinter.childrencCsdS)Nr�r)rrrrr��szStdDequePrinter.display_hintN) r r rrrr�rXrgr_r�rrrrr��s r�c@s eZdZdZdd�Zdd�ZdS)�StdDequeIteratorPrinterzPrint std::deque::iterator.cCs ||_dS)N)rV)rrDrWrrrrXsz StdDequeIteratorPrinter.__init__cCs |jdsdSt|jdj��S)Nr�z+non-dereferenceable iterator for std::deque)rVr!rt)rrrrrg s z!StdDequeIteratorPrinter.to_stringN)r r rrrXrgrrrrr�sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdStringPrinterz'Print a std::basic_string of some kind.cCs||_|jd�dk|_dS)Nz::__cxx11::basic_stringr)ri)rV�find�_new_string)rrDrWrrrrXszStdStringPrinter.__init__cCs�|jj}|jtjkr|j�}|jdd}|jrL|jd}|j|jj��}n<|j �j�}tj t|�d�j�}|j|�d}|j �d}t|d�r�|j|d�S|j|d�S) NZ_M_dataplusr�Z_M_string_lengthz::_Repr)Z _M_length�lazy_string)r�)rVrr�r� TYPE_CODE_REFr�r�rbr�unqualifiedrr!rartr�r��string)rr�ptrr�ZrealtypeZreptype�headerrrrrgs zStdStringPrinter.to_stringcCsdS)Nr�r)rrrrr�-szStdStringPrinter.display_hintN)r r rrrXrgr�rrrrr�sr�cCs"|d}|d}|d}|||fS)z'Access the streambuf put area pointers.Z _M_out_begZ _M_out_curZ _M_in_endr)� streambuf�pbase�pptr�egptrrrr�access_streambuf_ptrs1sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdStringBufPrinterzPrint a std::basic_stringbuf.cCs ||_dS)N)rV)r�_rWrrrrX<szStdStringBufPrinter.__init__cCsLt|j�\}}}|rB|s"||kr2|j||d�S|j||d�S|jdS)N)r�Z _M_string)r�rVr�)rr�r�r�rrrrg?szStdStringBufPrinter.to_stringcCsdS)Nr�r)rrrrr�Isz StdStringBufPrinter.display_hintN)r r rrrXrgr�rrrrr�9s r�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdStringStreamPrinterz Print a std::basic_stringstream.cCsZ||_||_dd�|jj�D�d}tjd|j|�j�tjd�|_ |j |djk|_ dS)NcSsg|]}|jr|j�qSr)rr)r&�frrrr(Xsz3StdStringStreamPrinter.__init__.<locals>.<listcomp>rZ__streamz$__stream->rdbuf()�_M_stringbuf)rVr]rrrZset_convenience_variablerbrs�parse_and_eval� _streambuf�_was_redirected)rrDrWZbasetyperrrrXPszStdStringStreamPrinter.__init__cCs$|jrd|j|jj�fS|jdS)Nz%s redirected to %sr�)r�r]r�rtrV)rrrrrg]sz StdStringStreamPrinter.to_stringcCs|jr dSdS)Nr�)r�)rrrrr�csz#StdStringStreamPrinter.display_hintN)r r rrrXrgr�rrrrr�Ms r�c@s$eZdZdd�Zdd�Zdd�ZdS)�Tr1HashtableIteratorcCsj|d|_d|_|d|_t|jd�j�|_d|_x2|j|jkrd|j|j|_|jrVP|jd|_q4WdS)NZ _M_bucketsrZ_M_bucket_countZ_Noder))�_buckets�_bucket� _bucket_countr%rra� _node_typer�)r� hashtablerrrrXjs zTr1HashtableIterator.__init__cCs|S)Nr)rrrrrYvszTr1HashtableIterator.__iter__cCs�|jdkrt�|jj|j�}|j�d}|j�d|_|jdkr�|jd|_x2|j|jkr~|j|j|_|jrpP|jd|_qNW|S)NrZ_M_vrzr))r�rZrbr�rtr�r�r�)rrlr�rrrrys zTr1HashtableIterator.__next__N)r r rrXrYrrrrrr�isr�c@s$eZdZdd�Zdd�Zdd�ZdS)�StdHashtableIteratorcCsR|dd|_|jjd�}|jjd�jd�}tdt|�|r>dnd�}|j�|_dS) NZ_M_before_begin�_M_nxtr)� rzstd::__detail::_Hash_node�trueZfalse)r�rr4r2r!rar�)rr�r7�cachedZ node_typerrrrX�s zStdHashtableIterator.__init__cCs|S)Nr)rrrrrY�szStdHashtableIterator.__iter__cCsR|jdkrt�|jj|j�j�}|d|_|dj}|j|jjd�j��}|j�S)Nrr�rr) r�rZrbr�rtrsrr4ra)rr��valptrrrrr�s zStdHashtableIterator.__next__N)r r rrXrYrrrrrr��sr�c@s<eZdZdZdd�Zdd�Zdd�Zedd ��Zd d�Z dS) �Tr1UnorderedSetPrinterz1Print a std::unordered_set or tr1::unordered_set.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zTr1UnorderedSetPrinter.__init__cCs|jjd�r|jS|jdS)Nzstd::tr1�_M_h)r]r<rV)rrrr� _hashtable�sz!Tr1UnorderedSetPrinter._hashtablecCs|j�d}d|jt|�fS)N�_M_element_countz %s with %s)rr]r�)rrErrrrg�sz Tr1UnorderedSetPrinter.to_stringcCsd|S)Nz[%d]r)�irrr� _format_count�sz$Tr1UnorderedSetPrinter._format_countcCs@t|jtj��}|jjd�r.t|t|j���St|t |j���S)Nzstd::tr1) r r� itertoolsrEr]r<rr�rr�)r�counterrrrr_�szTr1UnorderedSetPrinter.childrenN) r r rrrXrrgr�rr_rrrrr�src@s\eZdZdZdd�Zdd�Zdd�Zedd ��Zed d��Z edd ��Z dd�Zdd�ZdS)�Tr1UnorderedMapPrinterz1Print a std::unordered_map or tr1::unordered_map.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zTr1UnorderedMapPrinter.__init__cCs|jjd�r|jS|jdS)Nzstd::tr1r)r]r<rV)rrrrr�sz!Tr1UnorderedMapPrinter._hashtablecCs|j�d}d|jt|�fS)Nrz %s with %s)rr]r�)rrErrrrg�sz Tr1UnorderedMapPrinter.to_stringccs&x |D]}x|D] }|VqWqWdS)Nr)r�r�rrrr�_flatten�s zTr1UnorderedMapPrinter._flattencCs|d|dfS)Nr�r�r)r�rrr�_format_one�sz"Tr1UnorderedMapPrinter._format_onecCsd|S)Nz[%d]r)rrrrr�sz$Tr1UnorderedMapPrinter._format_countcCsdt|jtj��}|jjd�r@|jt|jt|j ����}t ||�S|jt|jt|j ����}t ||�S)Nzstd::tr1)r rrrEr]r<rrr�rrr�)rr �datarrrr_�s zTr1UnorderedMapPrinter.childrencCsdS)Nr�r)rrrrr��sz#Tr1UnorderedMapPrinter.display_hintN) r r rrrXrrgr�rrrr_r�rrrrr �s r c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdForwardListPrinterzPrint a std::forward_list.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdForwardListPrinter._iteratorcCs||_|d|_d|_dS)Nrzr)r{r|r~)rrr�rrrrX�s z(StdForwardListPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz(StdForwardListPrinter._iterator.__iter__cCsl|jdkrt�|jj|j�j�}|d|_|j}|jd|_|dj}|j|jjd�j ��}d||j�fS)Nrrzr)rrz[%d]) r|rZrbr{rtr~rsrr4ra)rr�rErrrrr�s z(StdForwardListPrinter._iterator.__next__N)r r rrXrYrrrrrr��sr�cCs||_t|�|_dS)N)rVr;r])rrDrWrrrrXszStdForwardListPrinter.__init__cCs(td|jj�j�}|j||jdd�S)Nr�r�r�)r8rVrrar�)rrrrrr_szStdForwardListPrinter.childrencCs*|jddddkr d|jSd|jS)Nr�r�rzrzempty %sz%s)rVr])rrrrrgs zStdForwardListPrinter.to_stringN) r r rrrr�rXr_rgrrrrr�s rc@sBeZdZdZd dd�Zdd�ZGdd�de�Zd d �Zdd�Z dS)�SingleObjContainerPrinterz8Base class for printers of containers of single objects.NcCs||_||_||_dS)N)�_contained_valuer��_hint)rrWZvizZhintrrrrXsz"SingleObjContainerPrinter.__init__cCs(tst|�Stjjtjj�|�p&t|�S)z5Return type as a string after applying type printers.)�_use_type_printingr!r�types�apply_type_recognizers�get_type_recognizers)rrrrr� _recognizesz$SingleObjContainerPrinter._recognizec@s$eZdZdd�Zdd�Zdd�ZdS)z$SingleObjContainerPrinter._containedcCs ||_dS)N)rV)rrWrrrrXsz-SingleObjContainerPrinter._contained.__init__cCs|S)Nr)rrrrrY"sz-SingleObjContainerPrinter._contained.__iter__cCs"|jdkrt�|j}d|_d|fS)Nz[contained value])rVrZ)rZretvalrrrr%s z-SingleObjContainerPrinter._contained.__next__N)r r rrXrYrrrrr� _containedsrcCs6|jdkr|jd�St|jd�r*|jj�S|j|j�S)Nr_)rrr�r�r_)rrrrr_,s z"SingleObjContainerPrinter.childrencCs(t|jd�r"t|jd�r"|jj�S|jS)Nr_r�)r�r�r�r)rrrrr�3s z&SingleObjContainerPrinter.display_hint)N) r r rrrXrrrr_r�rrrrrs rc CsH|j�j}tjddkr"t|�}nt|�}ytj|�jj SdSdS)z{Find the name of the function referred to by the gdb.Value f, which should contain a function pointer from the program.rrN) rtrsrFrGr�r�rZblock_for_pc�functionr")r�rrr�function_pointer_to_name;s rcs4eZdZdZ�fdd�Zdd�Zedd��Z�ZS)�StdExpAnyPrinterz+Print a std::any or std::experimental::any.cs�t|�|_t|j�|_||_d|_d}d}|jd}|dk�r�t|�}|sXtd|j��dj|�}tj ||�}|s�td|j��|j d�} d| k�r g} xPtj�D]D}y(tj d||j d��}| jtj|��Wq�tjk r�Yq�Xq�Wt| �dk�rtd ��| d} n tj| �} | jd�|_d}d | k�r@|jddj}n(d | k�rZ|jdd}ntd|j��|j|jj��j�}tj|�}tt|�j||�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 %sr)zstd::stringzstd::string(?!\w)z;Cannot uniquely determine std::string type used in std::anyz::_Manager_internalrrZ _M_bufferz::_Manager_externalr\)r;r]rKrV�_contained_typerr r*r>r?�groupr� _string_typesrHrPrrr,rr4rsrbrartr��superrX)rrDrW�contained_value� visualizerZmgr�funcZrx�mZmgrnameZmgrtypes�sr@Zmgrtyper)� __class__rrrXVsX zStdExpAnyPrinter.__init__cCsT|jdkrd|jSd|j}t|jd�r8||jj�S|j|j�}|tt|��S)Nz%s [no contained value]z%s containing r_)rr]r�r�rgrr;r!)r�descr7rrrrg�s zStdExpAnyPrinter.to_stringcs@ttjd�j��h}d�dddtg}|�fdd�|D�O}|S)Nzstd::stringzAbasic_string<char, std::char_traits<char>, std::allocator<char> >zstd::zstd::__cxx11::csh|]}|��qSrr)r&�q)r#rr� <setcomp>�sz1StdExpAnyPrinter._string_types.<locals>.<setcomp>)r!rrrr-)ZstringsZqualsr)r#rr�s zStdExpAnyPrinter._string_types) r r rrrXrgr�r� __classcell__rr)r$rrSsD rcs(eZdZdZ�fdd�Zdd�Z�ZS)�StdExpOptionalPrinterz5Print a std::optional or std::experimental::optional.c s�t|�|_t|j�|_|d}|jjd�r8|d}|}n*|d}|d}y|d}WnYnXtj|�}|std}tt|�j||�dS)N� _M_payloadzstd::experimental� _M_engaged�_M_value) r;r]rKr<rr�rr)rX)rrDrWZpayloadZengagedrr )r$rrrX�s" zStdExpOptionalPrinter.__init__cCs:|jdkrd|jSt|jd�r4d|j|jj�fS|jS)Nz%s [no contained value]r_z%s containing %s)rr]r�r�rg)rrrrrg�s zStdExpOptionalPrinter.to_string)r r rrrXrgr(rr)r$rr)�sr)cs(eZdZdZ�fdd�Zdd�Z�ZS)�StdVariantPrinterzPrint a std::variant.cs�t|j�}t|�|_|d|_|jt|�kr<d|_d}d}n@|t|j�|_|dddj}|j |jj ��j�}tj |�}tt|�j||d�dS)N�_M_indexZ_M_ur�rrr�)rTrr;r]�_indexrrr�rsrbrartrr�rr-rX)rrDrWZalternativesrr Zaddr)r$rrrX�s zStdVariantPrinter.__init__cCsH|jdkrd|jSt|jd�r8d|j|j|jj�fSd|j|jfS)Nz%s [no contained value]r_z%s [index %d] containing %sz %s [index %d])rr]r�r�r/rg)rrrrrg�s zStdVariantPrinter.to_string)r r rrrXrgr(rr)r$rr-�sr-cs(eZdZdZ�fdd�Zdd�Z�ZS)�StdNodeHandlePrinterzPrint a container node handle.cs�|jjd�|_|jjd�jd�}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)rrr�r\rrZ_M_allocr+r*r�)rr4�_value_typerBr"�_is_rb_tree_node�_is_map_noder�rtrurr�Z_allocrr0rX)rrDrWrZnodeptrrr Zoptalloc)r$rrrX�s&zStdNodeHandlePrinter.__init__cCsfd}|js|d7}|jr"|d7}n|d7}|jrZ|d7}t|jd�rVd||jj�fS|Sd|SdS) Nznode handle for z unordered r��setz with elementr_z%s = %szempty %s)r2r3rr�r�rg)rr%rrrrg s zStdNodeHandlePrinter.to_string)r r rrrXrgr(rr)r$rr0�sr0c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdExpStringViewPrinterzP Print a std::basic_string_view or std::experimental::basic_string_view cCs ||_dS)N)rV)rrDrWrrrrX sz StdExpStringViewPrinter.__init__cCs6|jd}|jd}t|d�r*|j|d�S|j|d�S)NZ_M_str�_M_lenr�)r�)rVr�r�r�)rr�rrrrrg#s z!StdExpStringViewPrinter.to_stringcCsdS)Nr�r)rrrrr�*sz$StdExpStringViewPrinter.display_hintN)r r rrrXrgr�rrrrr5sr5c@s@eZdZdZdd�Zdd�Zdd�ZGdd �d e�Zd d�Z dS) �StdExpPathPrinterz,Print a std::experimental::filesystem::path.cCsB||_||_|jddd}|jddd}t||�|_dS)N�_M_cmptsr�r�r�)rVr]r�� _num_cmpts)rrDrWr�r�rrrrX1s zStdExpPathPrinter.__init__cCs:t|jd�}|dd�dkr"dS|d d�dkr6dSdS) NZ_M_typer�� _Root_dirzroot-directory� � _Root_namez root-namei����i����)r!rV)rr0rrr� _path_type8szStdExpPathPrinter._path_typecCs8d|jd}|jdkr0|j�}|r0d||f}d|S)Nz%s�_M_pathnamerz%s [%s]z!experimental::filesystem::path %s)rVr9r=)r�pathr0rrrrg@s zStdExpPathPrinter.to_stringc@s$eZdZdd�Zdd�Zdd�ZdS)zStdExpPathPrinter._iteratorcCs,||_|dd|_|dd|_d|_dS)Nr�r�r�r)� _pathtyper�r�r~)rZcmpts�pathtyperrrrXIsz$StdExpPathPrinter._iterator.__init__cCs|S)Nr)rrrrrYOsz$StdExpPathPrinter._iterator.__iter__cCsd|j|jkrt�|jj�}|j}|jd|_|jd|_|d}t|j|�j�}|sX|}d||fS)Nr)r>z[%s])r�r�rZrtr~r7r@r=)rr�rEr?r0rrrrRs z$StdExpPathPrinter._iterator.__next__N)r r rrXrYrrrrrr�Hsr�cCs|j|jd|j�S)Nr8)r�rVr])rrrrr__szStdExpPathPrinter.childrenN) r r rrrXr=rgrr�r_rrrrr7.sr7c@s@eZdZdZdd�Zdd�Zdd�ZGdd �d e�Zd d�Z dS) �StdPathPrinterzPrint a std::filesystem::path.cCsP||_||_t|jdd�}|jtjd��d@|_|jdkrF||_nd|_dS)Nr8r�Z uintptr_t�r)rVr]rprbrrr��_impl)rrDrWr�rrrrXfs zStdPathPrinter.__init__cCsHt|jjtj|jd���}|dd�dkr0dS|d d�dkrDdSdS) Nz::_Typer�r:zroot-directoryr;r<z root-namei����i����)r!r�rbrrr])rr0rrrr=pszStdPathPrinter._path_typecCs8d|jd}|jdkr0|j�}|r0d||f}d|S)Nz%sr>rz%s [%s]zfilesystem::path %s)rVr�r=)rr?r0rrrrgxs zStdPathPrinter.to_stringc@s$eZdZdd�Zdd�Zdd�ZdS)zStdPathPrinter._iteratorc Cs�||_|r�tjd�}tj|d�}tjd�}|j|j��}|j�}ttjd�rbtd|j |j �}n d|j }|j|j��|}|j|j��|_|j||_d|_ nd|_d|_dS)Nr�z::_Cmpt�char�alignofrr)r@rrrbrartr�r:�maxr�rFr�r�r~) rr�rAZint_typeZ cmpt_type� char_typer�Zsizeof_Impl�beginrrrrX�s z!StdPathPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz!StdPathPrinter._iterator.__iter__cCsd|j|jkrt�|jj�}|j}|jd|_|jd|_|d}t|j|�j�}|sX|}d||fS)Nr)r>z[%s])r�r�rZrtr~rBr@r=)rr�rEr?r0rrrr�s z!StdPathPrinter._iterator.__next__N)r r rrXrYrrrrrr��sr�cCs|j|j|j�S)N)r�rDr])rrrrr_�szStdPathPrinter.childrenN) r r rrrXr=rgrr�r_rrrrrBcs (rBc@s8eZdZdZdd�ZGdd�de�Zdd�Zdd �Zd S)�StdPairPrinterz@Print a std::pair object, with 'first' and 'second' as children.cCs ||_dS)N)rV)rrDrWrrrrX�szStdPairPrinter.__init__c@s(eZdZdZdd�Zdd�Zdd�ZdS) zStdPairPrinter._iterz?An iterator for std::pair types. Returns 'first' then 'second'.cCs||_d|_dS)Nr�)rV�_which)rrWrrrrX�szStdPairPrinter._iter.__init__cCs|S)Nr)rrrrrY�szStdPairPrinter._iter.__iter__cCs8|jdkrt�|j}|dkr$d|_nd|_||j|fS)Nr�r�)rKrZrV)rZwhichrrrr�s zStdPairPrinter._iter.__next__N)r r rrrXrYrrrrrr��sr�cCs|j|j�S)N)r�rV)rrrrr_�szStdPairPrinter.childrencCsdS)Nr)rrrrrg�szStdPairPrinter.to_stringN) r r rrrXrr�r_rgrrrrrJ�s rJc@s eZdZdZdd�Zdd�ZdS)�StdCmpCatPrinterz#Print a comparison category object.cCs&||jd�dd�|_|d|_dS)N�:r)r,)�rfindr]rV)rrDrWrrrrX�szStdCmpCatPrinter.__init__cCsJ|jdkr|jdkrd}n"dddddddd i}|t|j�}d j|j|�S)N�strong_orderingrZequalrZ unorderedr)ZlessZ equivalentZgreaterzstd::{}::{}ri)r]rVr�r*)rr"�namesrrrrg�s zStdCmpCatPrinter.to_stringN)r r rrrXrgrrrrrL�srLc@s`eZdZdZdZdd�Zedd��Zedd��Z ed d ��Z edd��Zed d��Zdd�Z dS)�StdErrorCodePrinterz0Print a std::error_code or std::error_condition.NcCsL||_t|�|_tjdkrHyddl}dt_Wntk rFdt_YnXdS)NrTF)rVr;r]rQ�_system_is_posix�posix�ImportError)rrDrWrSrrrrX�s zStdErrorCodePrinter.__init__cCs&tj|�}|dk r"|jtjkr"|SdS)N)rrr�ZTYPE_CODE_ENUM)r"r#rrr�_find_errc_enum�s z#StdErrorCodePrinter._find_errc_enumcCsBx<dtgD]0}ydj||�}|j|�Stk r8Yq Xq WdS)NrCz std::{}{})r-r*rUr)�clsr"�nsZqnamerrr�_find_standard_errc_enum�s z,StdErrorCodePrinter._find_standard_errc_enumc Cs�dddg}x~|D]v}|d}xhdtgD]\}dj|�}tjdj||��d}|dk r&||j�jkr&d |}|jd j||��}||fSq&WqWdS)N�streamZsocketzip::resolverz_category()rCzstd::{}experimental::net::v1z{}::{}::__crznet::z{}::{}_errc)NN)r-r*rZ lookup_symbol�valuersrU) rV�catZnet_catsr�r!rWZsymr"�enumrrr�_match_net_ts_category�s z*StdErrorCodePrinter._match_net_ts_categoryc Cs�d}d}d}|j|�\}}|dk r.d|||fS|jj�}|jjd�rLd}d}|jjd�rbd}|j}|jjd�r|d }|jd �}|jjd�r�d}|jd �}|dkr�yWnYnX||j||fS)z(Return details of a std::error_category.NFz::generic_error_category�genericTz::system_error_category�systemz::future_error_categoryZfutureZfuture_errcz::io_error_category�ioZio_errc)r]�dynamic_typer�r�endswithrRrX)rVr[r"r\�is_errnor!r#rrr�_category_infos2 z"StdErrorCodePrinter._category_infocCs|jd�dS)zX Strip any nested-name-specifier from name to give an unqualified name. z::r)ri)�split)r"rrr�_unqualified_name7sz%StdErrorCodePrinter._unqualified_namec Cs�|jd}|jd}|j|�\}}}}|dkrVddd�}|||j|j�krV|jdSt|�}|r�|dkr�ytjt|�}Wq�Yq�Xn|dk r�|jt|j|���}|dk r�d|}n|}d |j||fS) Nr,Z_M_catrr_r^)� error_code�error_conditionz = { }z"%s"z %s = {%s: %s}) rVrdrfr]r!�errno� errorcoder�rb) rrZr[r"Zalt_namer\rcZdefault_catsZstrvalrrrrg>s( zStdErrorCodePrinter.to_string)r r rrrRrXr�rU�classmethodrXr]rdrfrgrrrrrQ�s +rQc@s eZdZdZdd�Zdd�ZdS)�StdRegexStatePrinterz/Print a state node in the NFA for a std::regex.cCs||_||_dS)N)rVr])rrDrWrrrrX[szStdRegexStatePrinter.__init__cCs�t|jd�}|r|dd�}|jd}dddddddddddddd� }||}d j||�}|dk r�|jd |dk r�dj|||jd |�}d|S) NZ _M_opcode�rzZaltZsubexpr�negZ backref_index) �repeat�alternativeZ subexpr_beginZsubexpr_endZline_begin_assertionZline_end_assertionZ word_boundaryZsubexpr_lookaheadZbackrefr?ZacceptZdummy�unknownzopcode={}, next={}Z_M_z {}, {}={}z{%s})r!rVr*)rZopcodeZnext_idZvariants�vr#rrrrg_s zStdRegexStatePrinter.to_stringN)r r rrrXrgrrrrrlXsrlc@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) �StdSpanPrinterzPrint a std::span.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSpanPrinter._iteratorcCsd|_||_||_dS)Nr)r~�_beginr�)rrIr�rrrrXysz!StdSpanPrinter._iterator.__init__cCs|S)Nr)rrrrrY~sz!StdSpanPrinter._iterator.__iter__cCs8|j|jkrt�|j}|jd|_d||j|j�fS)Nr)z[%d])r~r�rZrtrt)rrErrrr�s z!StdSpanPrinter._iterator.__next__N)r r rrXrYrrrrrr�xsr�cCsLt|�|_||_tjd�}|jjd�|kr:|dd|_n|jjd�|_dS)Nzstatic_cast<std::size_t>(-1)r)Z _M_extentZ_M_extent_value)r;r]rVrr�rr4r�)rrDrWZsize_maxrrrrX�s zStdSpanPrinter.__init__cCsd|j|jfS)Nz%s of length %d)r]r�)rrrrrg�szStdSpanPrinter.to_stringcCs|j|jd|j�S)Nr\)r�rVr�)rrrrr_�szStdSpanPrinter.childrencCsdS)Nr�r)rrrrr��szStdSpanPrinter.display_hintN) r r rrrr�rXrgr_r�rrrrrsus rsc@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�StdInitializerListPrinterzPrint a std::initializer_list.cCs||_||_|d|_dS)Nr6)r]rVr�)rrDrWrrrrX�sz"StdInitializerListPrinter.__init__cCsd|j|jfS)Nz%s of length %d)r]r�)rrrrrg�sz#StdInitializerListPrinter.to_stringcCstj|jd|j�S)NZ_M_array)rsr�rVr�)rrrrr_�sz"StdInitializerListPrinter.childrencCsdS)Nr�r)rrrrr��sz&StdInitializerListPrinter.display_hintN)r r rrrXrgr_r�rrrrru�s ruc@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdAtomicPrinterzPrint a std:atomic.cCsrt|�|_||_d|_|jjjd�|_|jjdk rnt|jj�}|jd�sR|jd�rn|d}t ||�|_|j |_dS)Nrzstd::shared_ptr<zstd::weak_ptr<r�)r;r]rV�_shptr_printerrr4r1rr<r[�_shptr_childrenr_)rrDrWr#r�rrrrX�s zStdAtomicPrinter.__init__cCst|jj�S)N)rUrwr^)rrrrrx�sz StdAtomicPrinter._shptr_childrencCs�|jdk r|jj�S|jjtjkr.|jd}n`|jjtjkrH|jd}nF|jjtjkrf|jdd}n(|jjtj kr�|jdd}n |jd}d|j t|j�|fS)Nr`Z_M_fpZ_M_br�Z_M_basez%s<%s> = { %s })rwrgr1r�rZ TYPE_CODE_INTrV� TYPE_CODE_FLT� TYPE_CODE_PTRr�r]r!)rrWrrrrg�s zStdAtomicPrinter.to_stringN)r r rrrXrxrgrrrrrv�s rvc@s eZdZdZdd�Zdd�ZdS)�StdFormatArgsPrinterzPrint a std::basic_format_args.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdFormatArgsPrinter.__init__cCs�t|jj�}t|d�d}|tjd�kr0d}n|tjd�krDd}nd}|jd}|dkrbd |S|dkrt|jd }d||fS)Nrr)rEzstd::format_args�wchar_tzstd::wformat_argszstd::basic_format_argsZ_M_packed_sizez%s with 1 argumentZ_M_unpacked_sizez%s with %d arguments)rTrVrrr)rZtargsrHr#r�rrrrg�s zStdFormatArgsPrinter.to_stringN)r r rrrXrgrrrrr{�sr{c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�StdChronoDurationPrinterzPrint a std::chrono::duration.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z!StdChronoDurationPrinter.__init__cCs*|jjjd�}|jd�}|jd�}||fS)Nr)r)rVrr4)rZperiodr��denrrr�_ratio�s zStdChronoDurationPrinter._ratiocCs�|j�\}}|dkrF|dkr dS|dkr,dS|dkr8dS|dkr|dSn6|dkr||d krZd S|dkrfdS|d krrdSdj|�Sdj||�S)Nr)r#i�Zmsi@B�usiʚ;rW�<�mini�hi�Q�dz[{}]sz[{}/{}]s)rr*)rr�r~rrr�_suffix�s& z StdChronoDurationPrinter._suffixcCs4|jd}|jj�jtjkr$d|}dj||j��S)N�__rz%gz"std::chrono::duration = {{ {}{} }})rVrrr�rryr*r�)r�rrrrrgs z"StdChronoDurationPrinter.to_stringN)r r rrrXrr�rgrrrrr}�s r}c@s*eZdZdZdd�Zdd�Zd dd�Zd S)�StdChronoTimePointPrinterz Print a std::chrono::time_point.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrXs z"StdChronoTimePointPrinter.__init__cCsv|jjjd�}t|j�}|dks(|dkr,dS|dkr8dS|dkrDdS|d krPdS|dkr\dS|dkrhdSdj|�dfS)Nrzstd::chrono::_V2::system_clockzstd::chrono::system_clock�std::chrono::sys_timezstd::chrono::utc_clock�std::chrono::utc_timezstd::chrono::gps_clock�std::chrono::gps_timezstd::chrono::tai_clock�std::chrono::tai_timezstd::filesystem::__file_clock�std::chrono::file_time�umzstd::chrono::local_t�std::chrono::local_timez {} time_point)r�r)r�N)r�N)r�N)r�r�)r�r)rVrr4r;r"r*)r�clockr"rrr�_clocks z StdChronoTimePointPrinter._clockFc Cs�|j�\}}|jd}|d}t|jj|�}|j�}d}|dk r�|j�\} } || | |}ytjj|t �}dj |�}WnYnXd|||f} |r�| Sd|| fS)NZ__dr�rCz [{:%Y-%m-%d %H:%M:%S}]z%d%s%sz%s = { %s })r�rVr}rr"r�rrZ fromtimestamp� _utc_timezoner*)rZabbrevr��offsetr�r��printer�suffix�timer�r~Zsecsrr#rrrrg1s$ z#StdChronoTimePointPrinter.to_stringN)F)r r rrrXr�rgrrrrr�sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoZonedTimePrinterz Print a std::chrono::zoned_time.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrXIs z"StdChronoZonedTimePrinter.__init__cCs@|jdj�d}|jd}t|jj|�}|jd�}dj||�S)NZ_M_zone�_M_nameZ_M_tpTz%std::chrono::zoned_time = {{ {} {} }})rVrtr�rr"rgr*)rZzoner�r�rrrrgMs z#StdChronoZonedTimePrinter.to_stringN)r r rrrXrgrrrrr�Fsr�ZJanuaryZFebruaryZMarchZAprilZMayZJuneZJulyZAugustZ SeptemberZOctoberZNovemberZDecemberZSundayZMondayZTuesdayZ WednesdayZThursdayZFridayZSaturdayc@s eZdZdZdd�Zdd�ZdS)�StdChronoCalendarPrinterzDPrint a std::chrono::day, std::chrono::month, std::chrono::year etc.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX_s z!StdChronoCalendarPrinter.__init__c Csv|j}|j}d|kr$|dkr$|d}|jd�r6|d}|dkrPdjt|d��S|d kr||d ksl|tt�krtd|St|S|dkr�dj|�S|d kr�|d}|dks�|tt�kr�d|Sdjt|�S|dkr�dj|dt|d��S|dkr�dj|d�S|dk�rdj||d�S|dk�r,dj|�S|dk�rFdj||d�S|dk�r`dj||d�S|dk�rvdj||�S|dk�r�d j|||d�S|dk�r�dj||d!�S|d"k�r�d j|||d�S|d#k�r�d j|||d�S|jd$��rrd%}|d&dk�r"d'jt|d(d)�t|d&��}t|d*d+�}t|dd+�}t|d,d+�}|d-�rb|}d.j||||�SdS)/N�monthz std::chrono::year_month_day_lastZ_M_mzstd::chrono::yearZ_M_yzstd::chrono::dayz{}Z_M_dzstd::chrono::monthr)z%d is not a valid monthz{}yzstd::chrono::weekdayZ_M_wdrz%d is not a valid weekdayzstd::chrono::weekday_indexedz{}[{}]r.zstd::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_ssrCZfractional_widthz.{:0{}d}Z_M_ssZ_M_rrr��_M_sZ _M_is_negz{:02}:{:02}:{:02}{})rVr]r<r*r�r�months�weekdays) rrWr#r"�yZwdZfractr�r#rrrrgcsh z"StdChronoCalendarPrinter.to_stringN)r r rrrXrgrrrrr�\sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTimeZonePrinterz4Print a chrono::time_zone or chrono::time_zone_link.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z!StdChronoTimeZonePrinter.__init__cCs6d|j|jdf}|jjd�r2|d|jd7}|S)Nz%s = %sr�Z_linkz -> %sZ _M_target)r]rVrb)rr!rrrrg�sz"StdChronoTimeZonePrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoLeapSecondPrinterzPrint a chrono::leap_second.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z#StdChronoLeapSecondPrinter.__init__cCs.|jdd}d|dk}d|jt|�|fS)Nr�r�z+-rz %s %d (%c))rVr]�abs)rZdaternrrrrg�sz$StdChronoLeapSecondPrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTzdbPrinterzPrint a chrono::tzdb.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdChronoTzdbPrinter.__init__cCsd|j|jdfS)Nz%s %s�version)r]rV)rrrrrg�szStdChronoTzdbPrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTimeZoneRulePrinterzPrint a chrono::time_zone rule.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z%StdChronoTimeZoneRulePrinter.__init__c Cs�|jd}|d}t|d}dddddddd�}|d}d j||j|d ��}|dkrddj||�}nVt|d }|dkr�dj||�}n4|dkr�d} nd} |d}dj| d|| d||�}dj|jd|jd|jd|�S)N�on�kindr��stZndZrd)r)rrC����Zday_of_monthz{}{}Zthrz{} {}Zday_of_weekr)z last {} in {}rr��<=r��>=z{} {} {} {} {}z.time_zone rule {} from {} to {} starting on {}r"�fromZto)r�r�)r�r�)rVr�r*�getr�) rr�r�r��suffixes�dayZordinal_dayr��weekday� directionrrrrg�s* z&StdChronoTimeZoneRulePrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdLocalePrinterzPrint a std::locale.cCs||_||_dS)N)rVr])rrDrWrrrrX�szStdLocalePrinter.__init__csx|jdd}d}|ddkr&d}�nFtj|jd�}tj|jd�}|dj�}|dj�}dj||�}||i}d } xN| |kr�|| dkr�|| j�}|| j�}d j|||�}|||<| d } qxWt|j��} t| �d kr�|}n�t| �dk�rl| \}}t |j��} d�| j |�d k�r$|}|�n| j |�d k�r<|}|��dk �rlt�fdd �|j�D��}dj|��}dj||�S)Nr�Z_M_namesrCr�*z::_S_categoriesz::_S_categories_sizez{}={}r)z{};{}={}rc3s|]\}}|�kr|VqdS)Nr)r&r�rR)�otherrr� <genexpr> sz-StdLocalePrinter.to_string.<locals>.<genexpr>z with "{}={}"zstd::locale = "{}"{}) rVrr�r]r�r*r4�valuesrr�rEr�items)rrP�modr"ZcatsZncatrRr[Z cat_namesrZ uniq_namesZn1Zn2Z name_listr)r�rrg�sD zStdLocalePrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdIntegralConstantPrinterz*Print a std::true_type or std::false_type.cCs||_||_dS)N)rVr])rrDrWrrrrX sz#StdIntegralConstantPrinter.__init__cCsL|jjjd�}|jjjd�}|jtjkr4|r0dSdSt|j�}dj|||�S)Nrr)zstd::true_typezstd::false_typez {}<{}, {}>) rVrr4r�rr�r;r]r*)rr3rZrDrrrrg s z$StdIntegralConstantPrinter.to_stringN)r r rrrXrgrrrrr� sr�c@s eZdZdZdd�Zdd�ZdS)�StdTextEncodingPrinterzPrint a std::text_encoding.cCs||_||_dS)N)rVr])rrDrWrrrrX$ szStdTextEncodingPrinter.__init__cCs<|jdj�}|ddkr$|jdS|ddkr4dS|dS)NZ_M_repZ_M_idr)r�rrq)rVrt)rZreprrrrg( s z StdTextEncodingPrinter.to_stringN)r r rrrXrgrrrrr�! sr�cs$eZdZ�fdd�Zdd�Z�ZS)� RxPrintercs$tt|�j�||_||_d|_dS)NT)rr�rXr"� _function�enabled)rr"r)r$rrrX3 szRxPrinter.__init__cCs:|js dS|jjtjkr,ttjd�r,|j�}|j|j |�S)N�referenced_value) r�rr�rr�r��Valuer�r�r")rrZrrr�invoke9 szRxPrinter.invoke)r r rrXr�r(rr)r$rr�2 sr�csHeZdZ�fdd�Zdd�Zdd�Zdd�Zed d ��Zdd�Z �Z S) �Printercs6tt|�j�||_g|_i|_d|_tjd�|_ dS)NTz^([a-zA-Z0-9_:]+)(<.*>)?$) rr�rXr"�_subprinters�_lookupr�r>�compile�_compiled_rx)rr")r$rrrXH szPrinter.__init__cCs<|jj|�std|��t||�}|jj|�||j|<dS)Nz0libstdc++ programming error: "%s" does not match)r�r?r r�r�rPr�)rr"rr�rrr�addP s zPrinter.addcCs>|j|||�d|kr:tjddt|�}|j|||�dS)N�__cxx11z^(std|__gnu_cxx)::z\g<0>%s)r�r>rHr-)r�baser"rZvbaserrr�add_version[ s zPrinter.add_versioncCs$|j|||�|j|d||�dS)Nz__cxx1998::)r�)rr�r"rrrr� add_containerc szPrinter.add_containercCs&|jtjkr|j�}|j�j�}|jS)N)r�rr�r�r�rr)rrrr�get_basic_typeg szPrinter.get_basic_typecCsr|j|j�}|sdS|jj|�}|s(dS|jd�}|jjtjkrTttj d�rT|j �}||jkrn|j|j|�SdS)Nr)r�) r�rr�r?rr�rr�r�r�r�r�r�)rrWrDr?�basenamerrr�__call__r s zPrinter.__call__)r r rrXr�r�r�r�r�r�r(rr)r$rr�G sr�c@s0eZdZdZdd�ZGdd�de�Zdd�ZdS) �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<T, std::allocator<T> >' with 'std::vector<T>'. cCs||_||_d|_dS)NT)r"�_defargsr�)rr"�defargsrrrrX� szTemplateTypePrinter.__init__c@s(eZdZdZdd�Zdd�Zdd�ZdS) zTemplateTypePrinter._recognizerz-The recognizer class for TemplateTypePrinter.cCs||_||_dS)N)r"r�)rr"r�rrrrX� sz(TemplateTypePrinter._recognizer.__init__c Cs�|jdkrdS|jj|j�s dSt|�}g}d}x�tt|��D]�}||}|jj|�}|dk r�|j|�}y|t j |�kr|dSWn$t jk r�|j|kr�dSYnXd}q>|r�dS|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�<z, �>)rr<r"rT�rangerr�r�r*rrr,rP�_recognize_subtyper�rOr+) rrQrSZdisplayed_argsZrequire_defaultedrRrfZdefargrArrr� recognize� s2 z)TemplateTypePrinter._recognizer.recognizecCs�|jtjkr|j|j��dS|jtjkrj|j|j��}t|j��jd�rR|dSd||j �ddfS|jtj kr�|j|j��dSttd�r�|jtjkr�|j|j��dStj jtj j�|�}|r�|St|�S)zxConvert a gdb.Type to a string by applying recognizers, or if that fails then simply converting to a string.r�z[]z%s[%d]r)�&�TYPE_CODE_RVALUE_REFz&&)r�rrzr�r�r�r!rrbr�r�r�r�rrr)rrQrNrrrr�� s" z2TemplateTypePrinter._recognizer._recognize_subtypeN)r r rrrXr�r�rrrr�_recognizer� s1r�cCs|j|j|j�S)z1Return a recognizer object for this type printer.)r�r"r�)rrrr�instantiate� szTemplateTypePrinter.instantiateN)r r rrrX�objectr�r�rrrrr�� s Pr�cs�td||�}tjj||�td||�}tjj||�d|kr�dt�t�fdd�|j�D��}t�||�}tjj||�td||�}tjj||�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<std::pair<const {0}, {1}> >' } zstd::zstd::__debug::r�c3s"|]\}}||jd��fVqdS)zstd::N)r.)r&rRr�)rWrrr� sz0add_one_template_type_printer.<locals>.<genexpr>N)r�rr�register_type_printerr-�dictr�)�objr"r�r�r)rWr�add_one_template_type_printer� sr�c@s2eZdZdZd dd�ZGdd�de�Zdd�ZdS) �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<C, T> 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<char,...>' and not 'basic_string<wchar_t,...>'. This rejects non-matching specializations more quickly, without needing to do GDB type lookups. NcCs||_||_||_d|_dS)NT)� _templater"�_targ1r�)r�templater"�targ1rrrrX- szFilteringTypePrinter.__init__c@s eZdZdZdd�Zdd�ZdS)z FilteringTypePrinter._recognizerz.The recognizer class for FilteringTypePrinter.cCs||_||_||_d|_dS)N)r�r"r�� _type_obj)rr�r"r�rrrrX6 sz)FilteringTypePrinter._recognizer.__init__c Cs�|jdkrdS|jdkrz|jdk rDdj|j|j�}|jj|�sVdSn|jj|j�sVdSytj|j�j �|_WnYnX|jdkr�dStj j|j�}tj j|�}||kr�t|j�S|jj d�ddkr�|jjjdd�}|jjdd�}||kr�t|j�SdS) z� If type_obj starts with self._template and is the same type as self.name then return self.name, otherwise None. Nz{}<{}z::r)�basic_stringz __cxx11::rCri)rr�r�r*r�r<rrr"rrr�rOrer.)rrQr#Zt1Zt2�s1�s2rrrr�< s4 z*FilteringTypePrinter._recognizer.recognizeN)r r rrrXr�rrrrr�3 sr�cCs|j|j|j|j�S)z1Return a recognizer object for this type printer.)r�r�r"r�)rrrrr�f sz FilteringTypePrinter.instantiate)N)r r rrrXr�r�r�rrrrr� s 3r�cCsXtd|d||�}tjj||�d|krTdt}t|||||�}tjj||�dS)Nzstd::r�)r�rrr�r-)r�r�r"r�r�rWrrr�add_one_type_printerk sr�c CsdtsdSxxdgD]p}t|d|dd |d�t|d|dd |d�t|dd|dd |d�t|d|dd|d�qWx�djD]|}x*dkD]"}t|d||d||d�q�WxJdlD]B}t|d||d||d�t|d!||d||d��q�Wq�Wx�dmD]�}x0dpD](}t||d"||dd#|d��qWxNdqD]F}t||d(||d)�x&drD]}t||||||��qlW�qJW�qWt|d-d.�xdsD]}t|d9d:|��q�Wt|d;d<�t|d;d=�t|d>d?�t|d>d@�t|dAdB�t|dAdC�t|dDdE�t|dDdF�t|dGdH�dI}x0dyD](}t||d||dd|d��q<Wt|dJddKi�t|dLddMi�t|dNddMi�t|dOddMi�t|dPddMi�t|dQddMi�t|dRdSdTdU��t|dVdSdTdU��t|dWdSdMdX��t|dYdSdMdX��t|dZd[d\dTd]��t|d^d[d\dTd]��t|d_d[d\dMd`��t|dad[d\dMd`��dS)zNrCrEr�r|�u8�char8_t�u16�char16_t�u32�char32_tr�rr�r)z__cxx11::basic_string� __cxx11::�basic_string_viewZstring_view�iosr��istream�ostream�iostream�filebuf�ifstream�ofstream�fstream�basic_� stringbuf� istringstream� ostringstream�stringstreamz__cxx11::basic_Zbasic_regexZregexr�r#�wc�wsZ match_resultsr?� sub_match�regex_iterator�regex_token_iteratorZfposZ streampos�nanoseconds�microseconds�milliseconds�seconds�minutes�hours�days�weeks�yearsr�zchrono::durationzchrono::Zlinear_congruential_engineZminstd_rand0Zminstd_randZmersenne_twister_engineZmt19937Z mt19937_64Zsubtract_with_carry_engineZ ranlux24_baseZ ranlux48_baseZdiscard_block_engineZranlux24Zranlux48Zshuffle_order_engineZknuth_bzexperimental::fundamentals_v1::� unique_ptrzstd::default_delete<{0}>�dequezstd::allocator<{0}>r�r�z __cxx11::list�vectorr�zstd::less<{0}>z)std::allocator<std::pair<{0} const, {1}>>)rrC�multimapr4)r)r�multiset� unordered_mapzstd::hash<{0}>zstd::equal_to<{0}>)rrC��unordered_multimap� unordered_set)r)rrC�unordered_multiset�rCrE�r�r|�r�r��r�r��r�r�)rrrrr�rCrE�r�r|)rr) r�r�r�r�r�r�r�r�r�)r�r�r�r�)rCr��rCrE�r�r|)rr )r�r#rr)rrr) rrrrr r rrr r��rCrE�r�r|�r�r��r�r��r�r�)r!r"r#r$r%)rr�r�)r�Zchr@�abiZdurrWrrr�register_type_printerst s� "( * r'cCs8trtjj|t�n|dkr t}|jjt�t|�dS)z4Register libstdc++ pretty-printers with objfile Obj.N)�_use_gdb_pprZprintingZregister_pretty_printer�libstdcxx_printerZpretty_printersrPr')r�rrr�register_libstdcxx_printers� sr*cCsXtd�atjddt�tjddt�tjddt�tjddt�tjddt�tjddt�tjddt�tjdd t�tjdd t �tjddt �tjddt�tjdd t�tjddt�tjddt �tjddt�tjddt �tjddt�tjddt�ttjd��r.tjddt�tjddt�tjdt�tjdt�tjdt�tjdt�tjdt�tjdt �tjdt �tjdt�tjddt�tjdd t�tjdd!t�tjdd"t�tjdd#t�tjdd$t�tjdd%t�tjd&dt�tjd&d t�tjd&d!t�tjd&d"t�tjd&d#t�tjd&d$t�tjdd't�tjdd(t�tjdd)t�tjdd)t�x2doD]*}tjdd-|t�tjdd-|t��q�Wtjd.d/t�tjd.d0t�tjdd1t�tjd2d3t �tjd4t�tjd5t�tjd6t�tjd7t�tjd8t�tjd9d:t!�tjd9d;t"�tjd9d<t#�tjd=d>t$�tjd?d>t$�tjd@d>t%�tjdAd>t%�tjdd:t!�tjdd;t"�tjdd<t#�tjddBt&�tjddCt'�tjddDt(�tjddEt(�tjddFt(�tjddGt)�tjddHt*�xdpD]}tjd.|t+��qWtjd.dYt,�tjd.dZt,�tjd.d[t-�tjd.d\t.�tjd.d]t/�tjdd^t0�tjd_d`t1�tjddat2�tjddbt2�tjddct3�tjdddt3�tjddet4�tjddft4�tjd_dgt5�tjddht6�tjddit6�tjddjt7�tjd_dkt8�tjddlt9�tjddmt9�tjdnt:�dS)qNzlibstdc++-v6zstd::r�zstd::__cxx11::Zbitsetrr�r�rrZpairZpriority_queueZqueueror4�stackrrZlocalerargrhzstd::__debug::bitsetzstd::__debug::dequezstd::__debug::listzstd::__debug::mapzstd::__debug::multimapzstd::__debug::multisetzstd::__debug::setzstd::__debug::vectorZ shared_ptrZweak_ptrrrrrr�z std::tr1::Zinitializer_listZatomicZbasic_stringbufr�r�r�r�z 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::r?z,std::experimental::filesystem::v1::__cxx11::zstd::filesystem::zstd::filesystem::__cxx11::ZvariantZ_Node_handleZpartial_orderingZ weak_orderingrO�spanZbasic_format_argsr�r��yearr��weekday_indexed�weekday_last� month_day�month_day_last� month_weekday�month_weekday_last� year_month�year_month_day�year_month_day_last�year_month_weekday�year_month_weekday_last�hh_mm_ssZ time_zoneZtime_zone_linkZ zoned_timeZleap_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)r�r�r�)r�r�r.r�r/r0r1r2r3r4r5r6r7r8r9r:);r�r)r�r�r�r�r�ryr�r�rJr�r�rqr�r�r�rr�rQr�r[r rrrurvr�r�r}r�r�rlrr)r5r7rBr-r0rLrsr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)Zsstreamr�rrr�build_libstdcxx_dictionary� sL r;)N)vrrr>rFrirrGr�rr�r �ziprr�r�ZtimezoneZutcr�Ztzinforr(Zgdb.printingrTrZ gdb.typesr�rrZprinter_baser%r-r2r8r5rBr;rKrOrTrUr[rkrmrprqrurxryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr rrrrr)r-r0r5r7rBrJrLrQrlrsrurvr{r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r)r�r�r�r�r'r*r;rrrr�<module>s� % (&"I U(*$/A" /%-^!,5I!{'$*/? ",Ce%T oTPK���\�3,�xexe0libstdcxx/v6/__pycache__/printers.cpython-36.pycnu�[���3 ���h���@s�ddlZddlZddlZddlZddlZddlZejddkrXeZe Z eZe ZejjZn6Gdd�d�Zddlm Z mZGdd�dej�Ze�ZdayddlZWnek r�d aYnXd ayddlZeejd �r�daWnek r�YnXeed��rejZneZdd �Zdadd�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&Gdd �d e�Z'Gd!d"�d"e�Z(d#d$�Z)d%d&�Z*d'd(�Z+Gd)d*�d*e�Z,d+d,�Z-d-d.�Z.Gd/d0�d0e�Z/Gd1d2�d2e�Z0Gd3d4�d4e0�Z1Gd5d6�d6e0�Z2Gd7d8�d8e�Z3Gd9d:�d:e�Z4Gd;d<�d<e�Z5Gd=d>�d>e�Z6Gd?d@�d@e�Z7GdAdB�dBe�Z8GdCdD�dDe�Z9GdEdF�dFe�Z:GdGdH�dHe�Z;dIdJ�Z<GdKdL�dLe�Z=GdMdN�dNe�Z>dOdP�Z?GdQdR�dRe�Z@GdSdT�dTe�ZAGdUdV�dVe�ZBGdWdX�dXe�ZCGdYdZ�dZe�ZDGd[d\�d\e�ZEd]d^�ZFGd_d`�d`e�ZGGdadb�dbe�ZHGdcdd�dde�ZIGdedf�dfe�ZJGdgdh�dhe�ZKGdidj�dje�ZLGdkdl�dle�ZMGdmdn�dne�ZNdodp�ZOGdqdr�dreN�ZPGdsdt�dteN�ZQGdudv�dveN�ZRGdwdx�dxeN�ZSGdydz�dze�ZTGd{d|�d|e�ZUGd}d~�d~e�ZVGdd��d�e�ZWGd�d��d�e�ZXGd�d��d�e�ZYGd�d��d�e�ZZGd�d��d�e�Z[Gd�d��d�e�Z\Gd�d��d�e�Z]Gd�d��d�e�Z^Gd�d��d�e�Z_Gd�d��d�e�Z`Gd�d��d�e�Zadd�d�d�d�d�d�d�d�d�d�d�d�g Zbd�d�d�d�d�d�d�d�gZcGd�d��d�e�ZdGd�d��d�e�ZeGd�d��d�e�ZfGd�d��d�e�ZgGd�d��d�e�ZhGd�d��d�e�ZiGd�d��d�e�ZjGd�d��d�e�ZkGd�d��d�e�ZlGd�d��d�e�ZmdanGd�d��d�e�Zod�d��ZpGd�d��d�e�Zqd�d�dÄZrd�dńZsd�dDŽZtd�dɄZueu�dS)��N�c@seZdZdZdd�ZdS)�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: <http://pythonhosted.org/six/#six.Iterator> cCs|j�S)N)�__next__)�self�r�0/usr/share/gcc-8/python/libstdcxx/v6/printers.py�next?sz Iterator.nextN)�__name__� __module__�__qualname__�__doc__rrrrrr4s r)�imap�izipc@s(eZdZdZdd�Zdd�Zdd�ZdS) �UTCz5Concrete tzinfo class representing the UTC time zone.cCs tjd�S)Nr)�datetime� timedelta)r�dtrrr� utcoffsetIsz UTC.utcoffsetcCsdS)Nrr)rrrrr�tznameLsz UTC.tznamecCs tjd�S)Nr)rr)rrrrr�dstOszUTC.dstN)r r rrrrrrrrrrFsrTFZTypePrinter�ValuePrintercCsz|j�}xld|j|f}y tj|�Stk r6YnX|j�}t|�r^|djr^|dj}q t dt |�|f��q WdS)Nz%s::%srzCannot find type %s::%s)�strip_typedefs�tag�gdb�lookup_type�RuntimeError�fields�len� is_base_class�type� ValueError�str)Zorig�name�typ�searchrrrr� find_typens r%z__8::cGs�dj|djdd�|D���}y tj|�Stjk r�}zFt|krv|jddtd�}y tj|�Stjk rtYnX|�WYdd}~XnXdS)z8 Lookup template specialization templ<args...>. z{}<{}>z, cSsg|]}t|��qSr)r!)�.0�arrr� <listcomp>�sz%lookup_templ_spec.<locals>.<listcomp>z::�N)�format�joinrr�error�_versioned_namespace�replace)Ztempl�args�t�errr�lookup_templ_spec�s r2cCs�d|krd|}yt|d�}Wn|jd�}YnX|j�}y t||�Stjk r�t|d�r�t|ddd�r�|jdd d �}y t||�Stjk r�YnXdSXdS)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<int>')) will return a gdb.Type for the type std::_List_node<int>. z::zstd::� value_typerZstdzstd::__cxx1998zstd::__debugZ__gnu_debugz ::__cxx1998::r)N)r%�template_argumentrr2rr,�is_member_of_namespacer.)�nodenameZ containertype�valtyperrr�lookup_node_type�s& r8cGs@t|tj�rt|�}t|�}x|D]}|j|d�r"dSq"WdS)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. z::TF)� isinstancer�Typer!�strip_versioned_namespace� startswith)r#Z namespaces� namespacerrrr5�s r5cCs2t|tj�r|j}dt|f}tjd||�dk S)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)r9rr:rr-�re�match)�x� template_namerrr�is_specialization_of�srBcCs|jtd�S)N�)r.r-)�typenamerrrr;�sr;cCs<d}d}tjddkr&tj|||d�Stj|||dd�SdS)zCRemove "fundamentals_vN" inline namespace from qualified type name.z&^std::experimental::fundamentals_v\d::zstd::experimental::rrr))�countN)�sys�version_infor>�sub)r#�pattern�replrrr�strip_fundts_namespace�s rKcCsVt|�}|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_v1�fundamentals_v2z::zfilesystem::zv1::)rLrM)r;r.)�type_strZexpt_nsZlfts_nsZfs_nsrrr�strip_inline_namespaces�s rOc Cs:d}g}x,y|j|j|��Wn |S|d7}q WdS)z-Return a type's template arguments as a list.rr)N)�appendr4)�type_obj�n� template_argsrrr�get_template_arg_list�srTc@s(eZdZdZdd�Zdd�Zdd�ZdS) �SmartPtrIteratorz@An iterator for smart pointer types with a single 'child' value.cCs ||_dS)N)�_val)r�valrrr�__init__szSmartPtrIterator.__init__cCs|S)Nr)rrrr�__iter__szSmartPtrIterator.__iter__cCs$|jdkrt�d|j|_}d|fS)Nzget())rV� StopIteration)rrWrrrr s zSmartPtrIterator.__next__N)r r rrrXrYrrrrrrUsrUc@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�SharedPointerPrinterzP Print a shared_ptr, weak_ptr, atomic<shared_ptr>, or atomic<weak_ptr>. cCst|�|_||_|d|_dS)N�_M_ptr)r;� _typenamerV�_pointer)rrDrWrrrrXs zSharedPointerPrinter.__init__cCs t|j�S)N)rUr^)rrrr�childrenszSharedPointerPrinter.childrencCsR|jdkrD|jddd}||d}t|jdjd�}|j|�S|jddS)Nzstd::atomicZ_M_refcountZ_M_val�_M_ir�pointerZ_M_pi)r]rVr%r�cast)rZptr_valZptr_typerrr�_get_refcountss z#SharedPointerPrinter._get_refcountscCspd}|j�}|jjjd�}tt|��}|dkr`|d}|d}|dkrPd|}nd||df}d|j||fS) N�emptyrZ_M_use_countZ _M_weak_countzexpired, weak count %dzuse count %d, weak count %dr)z%s<%s> (%s))rcrVrr4r;r!r])r�stateZ refcounts�targZusecountZ weakcountrrr� to_string(s zSharedPointerPrinter.to_stringN)r r rrrXr_rcrgrrrrr[s r[cCs�|jj�}|djs&tdt|j���|j|dj�}|jj�}t|�dkr^tdt|j���|djdkrt|dS|djr�|j|dj�Stdt|j���dS)zBReturn the tuple element stored in a _Tuple_impl<N, T> base class.r)z-Unsupported implementation for std::tuple: %sr�_M_head_implN���ri)rrrr r!rbrr")rW�basesZ head_baserrrr�_tuple_impl_get9s rkcCshtt|j��}||krtd��|j|jj�dj�}x*|dkr^|j|jj�dj�}|d8}q6Wt|�S)z6Return the result of std::get<n>(val) on a std::tuple.z0Out of range index for std::get<N> on std::tuplerr))rrTrr rbrrk)rRrWZ tuple_size�noderrr� tuple_getQs rmcCsd|jj�djj�}t|d�s(t|d�r6|dd}n$t|d�rJ|d}ntdt|���td|�S)z4Return the result of val.get() on a std::unique_ptr.rZ__uniq_ptr_dataZ__uniq_ptr_impl�_M_t�tuplez-Unsupported implementation for unique_ptr: %s)rrrrBr r!rm)rWZ impl_typeZtuple_memberrrr�unique_ptr_get_s rpc@s(eZdZdZdd�Zdd�Zdd�ZdS) �UniquePointerPrinterzPrint a unique_ptr.cCs ||_dS)N)rV)rrDrWrrrrXtszUniquePointerPrinter.__init__cCstt|j��S)N)rUrprV)rrrrr_wszUniquePointerPrinter.childrencCs|jjjd�}djt|��S)Nrzstd::unique_ptr<{}>)rVrr4r*r!)rr0rrrrgzszUniquePointerPrinter.to_stringN)r r rrrXr_rgrrrrrqqsrqcCs|djj|j��j�S)z7Return the value held in a __gnu_cxx::__aligned_membuf.� _M_storage)�addressrbra�dereference)Zbufr7rrr�get_value_from_aligned_membufsruc CsjyF|jj�dj}|dkr"|dS|dkrD|jjd�}t|d|�SWnYnXtdt|j���dS)z-Return the value held in an _List_node<_Val>.r)�_M_datarrrz!Unsupported implementation for %sN)rrr"r4rur r!)rl�memberr7rrr�get_value_from_list_node�srxc@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdListPrinterzPrint a std::list.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdListPrinter._iteratorcCs"||_|d|_|j|_d|_dS)N�_M_nextr)� _nodetype�_basers�_head�_count)r�nodetype�headrrrrX�s z!StdListPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz!StdListPrinter._iterator.__iter__cCsR|j|jkrt�|jj|j�j�}|d|_|j}|jd|_t|�}d||fS)Nrzr)z[%d])r|r}rZrbr{rtr~rx)r�eltrErWrrrr�s z!StdListPrinter._iterator.__next__N)r r rrXrYrrrrr� _iterator�sr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdListPrinter.__init__cCs(td|jj�j�}|j||jdd�S)N� _List_node�_M_impl�_M_node)r8rVrrar�)rrrrrr_�szStdListPrinter.childrencCs0|jdd}|d|jkr&d|jSd|jS)Nr�r�rzzempty %sz%s)rVrsr])rZheadnoderrrrg�s zStdListPrinter.to_stringN) r r rrrr�rXr_rgrrrrry�s ryc@seZdZdd�Zdd�ZdS)�NodeIteratorPrintercCs$||_||_||_t||j�|_dS)N)rVr]� _contnamer8rr{)rrDrWZcontnamer6rrrrX�szNodeIteratorPrinter.__init__cCs:|jdsd|jS|jdj|jj��j�}tt|��S)Nr�z(non-dereferenceable iterator for std::%s)rVr�rbr{rartr!rx)rrlrrrrg�s zNodeIteratorPrinter.to_stringN)r r rrXrgrrrrr��sr�c@seZdZdZdd�ZdS)�StdListIteratorPrinterzPrint std::list::iterator.cCstj|||dd�dS)N�listr�)r�rX)rrDrWrrrrX�szStdListIteratorPrinter.__init__N)r r rrrXrrrrr��sr�c@seZdZdZdd�ZdS)�StdFwdListIteratorPrinterz"Print std::forward_list::iterator.cCstj|||dd�dS)N�forward_list�_Fwd_list_node)r�rX)rrDrWrrrrX�sz"StdFwdListIteratorPrinter.__init__N)r r rrrXrrrrr��sr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdSlistPrinterzPrint a __gnu_cxx::slist.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSlistPrinter._iteratorcCs||_|dd|_d|_dS)N�_M_headrzr)r{r|r~)rrr�rrrrX�sz"StdSlistPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz"StdSlistPrinter._iterator.__iter__cCsL|jdkrt�|jj|j�j�}|d|_|j}|jd|_d||dfS)Nrrzr)z[%d]rv)r|rZrbr{rtr~)rr�rErrrr�s z"StdSlistPrinter._iterator.__next__N)r r rrXrYrrrrrr��sr�cCs ||_dS)N)rV)rrDrWrrrrX�szStdSlistPrinter.__init__cCs td|jj�}|j|j�|j�S)Nz__gnu_cxx::_Slist_node)r8rVrr�ra)rrrrrr_�szStdSlistPrinter.childrencCs|jdddkrdSdS)Nr�rzrzempty __gnu_cxx::slistz__gnu_cxx::slist)rV)rrrrrg�szStdSlistPrinter.to_stringN) r r rrrr�rXr_rgrrrrr��s r�c@s eZdZdZdd�Zdd�ZdS)�StdSlistIteratorPrinterz!Print __gnu_cxx::slist::iterator.cCs ||_dS)N)rV)rrDrWrrrrX�sz StdSlistIteratorPrinter.__init__cCs<|jdsdStd|jj�j�}t|jdj|�j�d�S)Nr�z1non-dereferenceable iterator for __gnu_cxx::slistz__gnu_cxx::_Slist_noderv)rVr8rrar!rbrt)rrrrrrgs z!StdSlistIteratorPrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) �StdVectorPrinterzPrint a std::vector.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdVectorPrinter._iteratorcCs^||_|rH|d|_d|_|d|_|d|_|jj�j}d|j|_n||_||_d|_ dS)N�_M_pr� _M_offset�) �_bitvec�_item�_so�_finish�_fortr�sizeof�_isizer~)r�start�finishZbitvec�ityperrrrXs z#StdVectorPrinter._iterator.__init__cCs|S)Nr)rrrrrYsz#StdVectorPrinter._iterator.__iter__cCs�|j}|jd|_|jr�|j|jkr4|j|jkr4t�t|jj�d|j>@�}|jd|_|j|j krv|jd|_d|_d||fS|j|jkr�t�|jj�}|jd|_d||fSdS)Nr)rz[%d]) r~r�r�r�r�r�rZ�boolrtr�)rrEr�rrrrs z#StdVectorPrinter._iterator.__next__N)r r rrXrYrrrrrr�sr�cCs*t|�|_||_|jjd�jtjk|_dS)Nr) r;r]rVrr4�coder�TYPE_CODE_BOOL�_is_bool)rrDrWrrrrX0s zStdVectorPrinter.__init__cCs$|j|jdd|jdd|j�S)Nr��_M_start� _M_finish)r�rVr�)rrrrr_6szStdVectorPrinter.childrenc Cs�|jdd}|jdd}|jdd}|jr�|jddd}|jddd}|jddd}|j�j}d|j}||||}|||}d|jt|�t|�fSd |jt||�t||�fSdS) Nr�r�r�Z_M_end_of_storager�r�r�z"%s<bool> of length %d, capacity %dz%s of length %d, capacity %d)rVr�rtrr�r]�int) rr�r��endZfor�Zbl�lengthZcapacityrrrrg;s zStdVectorPrinter.to_stringcCsdS)N�arrayr)rrrr�display_hintMszStdVectorPrinter.display_hintN) r r rrrr�rXr_rgr�rrrrr�s%r�c@s eZdZdZdd�Zdd�ZdS)�StdVectorIteratorPrinterzPrint std::vector::iterator.cCs ||_dS)N)rV)rrDrWrrrrXTsz!StdVectorIteratorPrinter.__init__cCs |jdsdSt|jdj��S)NZ _M_currentz,non-dereferenceable iterator for std::vector)rVr!rt)rrrrrgWs z"StdVectorIteratorPrinter.to_stringN)r r rrrXrgrrrrr�Qsr�c@s eZdZdZdd�Zdd�ZdS)�StdBitIteratorPrinterz@Print std::vector<bool>'s _Bit_iterator and _Bit_const_iterator.cCs ||_dS)N)rV)rrDrWrrrrX`szStdBitIteratorPrinter.__init__cCs.|jdsdSt|jdj�d|jd>@�S)Nr�z2non-dereferenceable iterator for std::vector<bool>r)r�)rVr�rt)rrrrrgcs zStdBitIteratorPrinter.to_stringN)r r rrrXrgrrrrr�]sr�c@s eZdZdZdd�Zdd�ZdS)�StdBitReferencePrinterz#Print std::vector<bool>::reference.cCs ||_dS)N)rV)rrDrWrrrrXmszStdBitReferencePrinter.__init__cCs*|jdsdSt|jdj�|jd@�S)Nr�z$invalid std::vector<bool>::referenceZ_M_mask)rVr�rt)rrrrrgps z StdBitReferencePrinter.to_stringN)r r rrrXrgrrrrr�jsr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdTuplePrinterzPrint a std::tuple.c@s0eZdZedd��Zdd�Zdd�Zdd�Zd S) zStdTuplePrinter._iteratorcCsNt|�dkr"t|djd�rBdSn t|�dkr2dSt|�dkrBdStd��dS)Nrr)Z__tuple_baseTrFz4Top of tuple tree does not consist of a single node.)rrBrr )�nodesrrr�_is_nonempty_tuple}sz,StdTuplePrinter._iterator._is_nonempty_tuplecCs:||_|jjj�}|j|�r0|jj|dj�|_d|_dS)Nr)r}rrr�rbr~)rr�r�rrrrX�s z"StdTuplePrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz"StdTuplePrinter._iterator.__iter__cCs�|js t�|jjj�}t|�dkr&t�t|�dkr:td��t|�dkr`|jj|dj�}d|_n&|jj|dj�}|jj|dj�|_|jd|_|jj�}t|�dks�|djdkr�d|jd|fSd|jd|dfSdS)Nrrz/Cannot parse more than 2 nodes in a tuple tree.r)rhz[%d]) r}rZrrrr rbr~r")rr��implrrrrr�s$ z"StdTuplePrinter._iterator.__next__N)r r r�staticmethodr�rXrYrrrrrr�|sr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdTuplePrinter.__init__cCs|j|j�S)N)r�rV)rrrrr_�szStdTuplePrinter.childrencCs(t|jjj��dkrd|jSd|jS)Nrzempty %sz %s containing)rrVrrr])rrrrrg�s zStdTuplePrinter.to_stringN) r r rrrr�rXr_rgrrrrr�ys Er�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�StdStackOrQueuePrinterz!Print a std::stack or std::queue.cCst|�|_tj|d�|_dS)N�c)r;r]r�default_visualizer�_visualizer)rrDrWrrrrX�s zStdStackOrQueuePrinter.__init__cCs |jj�S)N)r�r_)rrrrr_�szStdStackOrQueuePrinter.childrencCsd|j|jj�fS)Nz%s wrapping: %s)r]r�rg)rrrrrg�sz StdStackOrQueuePrinter.to_stringcCst|jd�r|jj�SdS)Nr�)�hasattrr�r�)rrrrr��s z#StdStackOrQueuePrinter.display_hintN)r r rrrXr_rgr�rrrrr��s r�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�RbtreeIteratorzf Turn an RB-tree-based container (std::map, std::set etc.) into a Python iterable object. cCs2|ddd|_|dddd|_d|_dS)Nrnr�Z _M_node_countZ _M_header�_M_leftr)�_size�_noder~)rZrbtreerrrrX�szRbtreeIterator.__init__cCs|S)Nr)rrrrrY�szRbtreeIterator.__iter__cCs t|j�S)N)r�r�)rrrr�__len__�szRbtreeIterator.__len__cCs�|j|jkrt�|j}|jd|_|j|jkr�|j}|j�drl|j�d}xd|j�drh|j�d}qNWnF|j�d}x$||j�dkr�|}|j�d}qzW|j�d|kr�|}||_|S)Nr)Z_M_rightr�Z _M_parent)r~r�rZr�rt)r�resultrl�parentrrrr�s$zRbtreeIterator.__next__N)r r rrrXrYr�rrrrrr��s r�c CsjyF|jj�dj}|dkr"|dS|dkrD|jjd�}t|d|�SWnYnXtdt|j���dS)z0Return the value held in an _Rb_tree_node<_Val>.r)Z_M_value_fieldrrrz!Unsupported implementation for %sN)rrr"r4rur r!)rlrwr7rrr�get_value_from_Rb_tree_node sr�c@s eZdZdZdd�Zdd�ZdS)�StdRbtreeIteratorPrinterz2Print std::map::iterator, std::set::iterator, etc.cCs"||_td|jj�}|j�|_dS)N� _Rb_tree_node)rVr8rra� _link_type)rrDrWrrrrrX!sz!StdRbtreeIteratorPrinter.__init__cCs0|jdsdS|jdj|j�j�}tt|��S)Nr�z6non-dereferenceable iterator for associative container)rVrbr�rtr!r�)rrlrrrrg&s z"StdRbtreeIteratorPrinter.to_stringN)r r rrrXrgrrrrr�sr�c@s eZdZdZdd�Zdd�ZdS)�StdDebugIteratorPrinterz-Print a debug enabled version of an iterator.cCs ||_dS)N)rV)rrDrWrrrrX0sz StdDebugIteratorPrinter.__init__cCsbtjd�}|jjjd�}|jj|�d}|s<t|jj|��S|jd|dkrRdSt|jj|��S)Nz __gnu_debug::_Safe_iterator_baserZ_M_sequenceZ _M_versionzinvalid iterator)rrrVrr4rbr!)rZ base_typer�Zsafe_seqrrrrg5s z!StdDebugIteratorPrinter.to_stringN)r r rrrXrgrrrrr�-sr�cCs|dkrdSd|S)zDReturn either "1 element" or "N elements" depending on the argument.r)z 1 elementz%d elementsr)�numrrr�num_elements@sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) � StdMapPrinterz"Print a std::map or std::multimap.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdMapPrinter._itercCs||_d|_||_dS)Nr)�_rbiterr~�_type)r�rbiterrrrrrXJszStdMapPrinter._iter.__init__cCs|S)Nr)rrrrrYOszStdMapPrinter._iter.__iter__cCsh|jddkr@t|j�}|j|j�j�}t|�}||_|d}n |jd}d|j|f}|jd|_|S)Nrr�first�secondz[%d]r))r~rr�rbr�rtr�Z_pair)rrR�itemr�rrrrRs zStdMapPrinter._iter.__next__N)r r rrXrYrrrrr�_iterIsr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX_s zStdMapPrinter.__init__cCsd|jttt|j���fS)Nz %s with %s)r]r�rr�rV)rrrrrgcszStdMapPrinter.to_stringcCs$td|jj�j�}|jt|j�|�S)Nr�)r8rVrrar�r�)rrlrrrr_gszStdMapPrinter.childrencCsdS)N�mapr)rrrrr�kszStdMapPrinter.display_hintN) r r rrrr�rXrgr_r�rrrrr�Esr�c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)� StdSetPrinterz"Print a std::set or std::multiset.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSetPrinter._itercCs||_d|_||_dS)Nr)r�r~r�)rr�rrrrrXtszStdSetPrinter._iter.__init__cCs|S)Nr)rrrrrYyszStdSetPrinter._iter.__iter__cCs@t|j�}|j|j�j�}t|�}d|j|f}|jd|_|S)Nz[%d]r))rr�rbr�rtr�r~)rr�r�rrrr|s zStdSetPrinter._iter.__next__N)r r rrXrYrrrrrr�ssr�cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdSetPrinter.__init__cCsd|jttt|j���fS)Nz %s with %s)r]r�rr�rV)rrrrrg�szStdSetPrinter.to_stringcCs$td|jj�j�}|jt|j�|�S)Nr�)r8rVrrar�r�)rrlrrrr_�szStdSetPrinter.childrenN) r r rrrr�rXrgr_rrrrr�os r�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdBitsetPrinterzPrint a std::bitset.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdBitsetPrinter.__init__cCs d|jS)Nz%s)r])rrrrrg�szStdBitsetPrinter.to_stringc Cs�y|jd}Wn gS|j}|jtjkr8|j�j}n|g}|j}|j|}g}d}xh||kr�||}d}xF|dkr�|d@dkr�|jd||d|df�|d}|d?}qnW|d}qXW|S)NZ_M_wrr)z[%d]r�)rVrr�r�TYPE_CODE_ARRAY�targetr�rP) rZwordsZwtypeZtsizeZnwordsr�Zbyte�w�bitrrrr_�s, zStdBitsetPrinter.childrenN)r r rrrXrgr_rrrrr��sr�c@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) �StdDequePrinterzPrint a std::deque.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdDequePrinter._itercCs(||_||_||_||_||_d|_dS)Nr)r��_p�_end�_last�_buffer_sizer~)rrlr�r��last�buffer_sizerrrrX�szStdDequePrinter._iter.__init__cCs|S)Nr)rrrrrY�szStdDequePrinter._iter.__iter__cCsr|j|jkrt�d|j|jj�f}|jd|_|jd|_|j|jkrn|jd|_|jd|_|j|j|_|S)Nz[%d]r)r)r�r�rZr~rtr�r�r�)rr�rrrr�szStdDequePrinter._iter.__next__N)r r rrXrYrrrrrr��sr�cCsHt|�|_||_|jjd�|_|jj}|dkr>td|�|_nd|_dS)Nrir)) r;r]rVrr4Z_elttyper�r�r�)rrDrW�sizerrrrX�s zStdDequePrinter.__init__cCsx|jdd}|jdd}|d|dd}|d|d}|d|d}|j|||}d |jtt|��fS) Nr�r�r�r�r)�_M_last�_M_cur�_M_firstz %s with %s)rVr�r]r��long)rr�r�Zdelta_nZdelta_sZdelta_er�rrrrg�szStdDequePrinter.to_stringcCs@|jdd}|jdd}|j|d|d|d|d|j�S)Nr�r�r�r�r�r�)rVr�r�)rr�r�rrrr_�szStdDequePrinter.childrencCsdS)Nr�r)rrrrr��szStdDequePrinter.display_hintN) r r rrrr�rXrgr_r�rrrrr��s r�c@s eZdZdZdd�Zdd�ZdS)�StdDequeIteratorPrinterzPrint std::deque::iterator.cCs ||_dS)N)rV)rrDrWrrrrXsz StdDequeIteratorPrinter.__init__cCs |jdsdSt|jdj��S)Nr�z+non-dereferenceable iterator for std::deque)rVr!rt)rrrrrg s z!StdDequeIteratorPrinter.to_stringN)r r rrrXrgrrrrr�sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdStringPrinterz'Print a std::basic_string of some kind.cCs||_|jd�dk|_dS)Nz::__cxx11::basic_stringr)ri)rV�find�_new_string)rrDrWrrrrXszStdStringPrinter.__init__cCs�|jj}|jtjkr|j�}|jdd}|jrL|jd}|j|jj��}n<|j �j�}tj t|�d�j�}|j|�d}|j �d}t|d�r�|j|d�S|j|d�S) NZ_M_dataplusr�Z_M_string_lengthz::_Repr)Z _M_length�lazy_string)r�)rVrr�r� TYPE_CODE_REFr�r�rbr�unqualifiedrr!rartr�r��string)rr�ptrr�ZrealtypeZreptype�headerrrrrgs zStdStringPrinter.to_stringcCsdS)Nr�r)rrrrr�-szStdStringPrinter.display_hintN)r r rrrXrgr�rrrrr�sr�cCs"|d}|d}|d}|||fS)z'Access the streambuf put area pointers.Z _M_out_begZ _M_out_curZ _M_in_endr)� streambuf�pbase�pptr�egptrrrr�access_streambuf_ptrs1sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdStringBufPrinterzPrint a std::basic_stringbuf.cCs ||_dS)N)rV)r�_rWrrrrX<szStdStringBufPrinter.__init__cCsLt|j�\}}}|rB|s"||kr2|j||d�S|j||d�S|jdS)N)r�Z _M_string)r�rVr�)rr�r�r�rrrrg?szStdStringBufPrinter.to_stringcCsdS)Nr�r)rrrrr�Isz StdStringBufPrinter.display_hintN)r r rrrXrgr�rrrrr�9s r�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdStringStreamPrinterz Print a std::basic_stringstream.cCsZ||_||_dd�|jj�D�d}tjd|j|�j�tjd�|_ |j |djk|_ dS)NcSsg|]}|jr|j�qSr)rr)r&�frrrr(Xsz3StdStringStreamPrinter.__init__.<locals>.<listcomp>rZ__streamz$__stream->rdbuf()�_M_stringbuf)rVr]rrrZset_convenience_variablerbrs�parse_and_eval� _streambuf�_was_redirected)rrDrWZbasetyperrrrXPszStdStringStreamPrinter.__init__cCs$|jrd|j|jj�fS|jdS)Nz%s redirected to %sr�)r�r]r�rtrV)rrrrrg]sz StdStringStreamPrinter.to_stringcCs|jr dSdS)Nr�)r�)rrrrr�csz#StdStringStreamPrinter.display_hintN)r r rrrXrgr�rrrrr�Ms r�c@s$eZdZdd�Zdd�Zdd�ZdS)�Tr1HashtableIteratorcCsj|d|_d|_|d|_t|jd�j�|_d|_x2|j|jkrd|j|j|_|jrVP|jd|_q4WdS)NZ _M_bucketsrZ_M_bucket_countZ_Noder))�_buckets�_bucket� _bucket_countr%rra� _node_typer�)r� hashtablerrrrXjs zTr1HashtableIterator.__init__cCs|S)Nr)rrrrrYvszTr1HashtableIterator.__iter__cCs�|jdkrt�|jj|j�}|j�d}|j�d|_|jdkr�|jd|_x2|j|jkr~|j|j|_|jrpP|jd|_qNW|S)NrZ_M_vrzr))r�rZrbr�rtr�r�r�)rrlr�rrrrys zTr1HashtableIterator.__next__N)r r rrXrYrrrrrr�isr�c@s$eZdZdd�Zdd�Zdd�ZdS)�StdHashtableIteratorcCsR|dd|_|jjd�}|jjd�jd�}tdt|�|r>dnd�}|j�|_dS) NZ_M_before_begin�_M_nxtr)� rzstd::__detail::_Hash_node�trueZfalse)r�rr4r2r!rar�)rr�r7�cachedZ node_typerrrrX�s zStdHashtableIterator.__init__cCs|S)Nr)rrrrrY�szStdHashtableIterator.__iter__cCsR|jdkrt�|jj|j�j�}|d|_|dj}|j|jjd�j��}|j�S)Nrr�rr) r�rZrbr�rtrsrr4ra)rr��valptrrrrr�s zStdHashtableIterator.__next__N)r r rrXrYrrrrrr��sr�c@s<eZdZdZdd�Zdd�Zdd�Zedd ��Zd d�Z dS) �Tr1UnorderedSetPrinterz1Print a std::unordered_set or tr1::unordered_set.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zTr1UnorderedSetPrinter.__init__cCs|jjd�r|jS|jdS)Nzstd::tr1�_M_h)r]r<rV)rrrr� _hashtable�sz!Tr1UnorderedSetPrinter._hashtablecCs|j�d}d|jt|�fS)N�_M_element_countz %s with %s)rr]r�)rrErrrrg�sz Tr1UnorderedSetPrinter.to_stringcCsd|S)Nz[%d]r)�irrr� _format_count�sz$Tr1UnorderedSetPrinter._format_countcCs@t|jtj��}|jjd�r.t|t|j���St|t |j���S)Nzstd::tr1) r r� itertoolsrEr]r<rr�rr�)r�counterrrrr_�szTr1UnorderedSetPrinter.childrenN) r r rrrXrrgr�rr_rrrrr�src@s\eZdZdZdd�Zdd�Zdd�Zedd ��Zed d��Z edd ��Z dd�Zdd�ZdS)�Tr1UnorderedMapPrinterz1Print a std::unordered_map or tr1::unordered_map.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zTr1UnorderedMapPrinter.__init__cCs|jjd�r|jS|jdS)Nzstd::tr1r)r]r<rV)rrrrr�sz!Tr1UnorderedMapPrinter._hashtablecCs|j�d}d|jt|�fS)Nrz %s with %s)rr]r�)rrErrrrg�sz Tr1UnorderedMapPrinter.to_stringccs&x |D]}x|D] }|VqWqWdS)Nr)r�r�rrrr�_flatten�s zTr1UnorderedMapPrinter._flattencCs|d|dfS)Nr�r�r)r�rrr�_format_one�sz"Tr1UnorderedMapPrinter._format_onecCsd|S)Nz[%d]r)rrrrr�sz$Tr1UnorderedMapPrinter._format_countcCsdt|jtj��}|jjd�r@|jt|jt|j ����}t ||�S|jt|jt|j ����}t ||�S)Nzstd::tr1)r rrrEr]r<rrr�rrr�)rr �datarrrr_�s zTr1UnorderedMapPrinter.childrencCsdS)Nr�r)rrrrr��sz#Tr1UnorderedMapPrinter.display_hintN) r r rrrXrrgr�rrrr_r�rrrrr �s r c@s8eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd S)�StdForwardListPrinterzPrint a std::forward_list.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdForwardListPrinter._iteratorcCs||_|d|_d|_dS)Nrzr)r{r|r~)rrr�rrrrX�s z(StdForwardListPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz(StdForwardListPrinter._iterator.__iter__cCsl|jdkrt�|jj|j�j�}|d|_|j}|jd|_|dj}|j|jjd�j ��}d||j�fS)Nrrzr)rrz[%d]) r|rZrbr{rtr~rsrr4ra)rr�rErrrrr�s z(StdForwardListPrinter._iterator.__next__N)r r rrXrYrrrrrr��sr�cCs||_t|�|_dS)N)rVr;r])rrDrWrrrrXszStdForwardListPrinter.__init__cCs(td|jj�j�}|j||jdd�S)Nr�r�r�)r8rVrrar�)rrrrrr_szStdForwardListPrinter.childrencCs*|jddddkr d|jSd|jS)Nr�r�rzrzempty %sz%s)rVr])rrrrrgs zStdForwardListPrinter.to_stringN) r r rrrr�rXr_rgrrrrr�s rc@sBeZdZdZd dd�Zdd�ZGdd�de�Zd d �Zdd�Z dS)�SingleObjContainerPrinterz8Base class for printers of containers of single objects.NcCs||_||_||_dS)N)�_contained_valuer��_hint)rrWZvizZhintrrrrXsz"SingleObjContainerPrinter.__init__cCs(tst|�Stjjtjj�|�p&t|�S)z5Return type as a string after applying type printers.)�_use_type_printingr!r�types�apply_type_recognizers�get_type_recognizers)rrrrr� _recognizesz$SingleObjContainerPrinter._recognizec@s$eZdZdd�Zdd�Zdd�ZdS)z$SingleObjContainerPrinter._containedcCs ||_dS)N)rV)rrWrrrrXsz-SingleObjContainerPrinter._contained.__init__cCs|S)Nr)rrrrrY"sz-SingleObjContainerPrinter._contained.__iter__cCs"|jdkrt�|j}d|_d|fS)Nz[contained value])rVrZ)rZretvalrrrr%s z-SingleObjContainerPrinter._contained.__next__N)r r rrXrYrrrrr� _containedsrcCs6|jdkr|jd�St|jd�r*|jj�S|j|j�S)Nr_)rrr�r�r_)rrrrr_,s z"SingleObjContainerPrinter.childrencCs(t|jd�r"t|jd�r"|jj�S|jS)Nr_r�)r�r�r�r)rrrrr�3s z&SingleObjContainerPrinter.display_hint)N) r r rrrXrrrr_r�rrrrrs rc CsH|j�j}tjddkr"t|�}nt|�}ytj|�jj SdSdS)z{Find the name of the function referred to by the gdb.Value f, which should contain a function pointer from the program.rrN) rtrsrFrGr�r�rZblock_for_pc�functionr")r�rrr�function_pointer_to_name;s rcs4eZdZdZ�fdd�Zdd�Zedd��Z�ZS)�StdExpAnyPrinterz+Print a std::any or std::experimental::any.cs�t|�|_t|j�|_||_d|_d}d}|jd}|dk�r�t|�}|sXtd|j��dj|�}tj ||�}|s�td|j��|j d�} d| k�r g} xPtj�D]D}y(tj d||j d��}| jtj|��Wq�tjk r�Yq�Xq�Wt| �dk�rtd ��| d} n tj| �} | jd�|_d}d | k�r@|jddj}n(d | k�rZ|jdd}ntd|j��|j|jj��j�}tj|�}tt|�j||�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 %sr)zstd::stringzstd::string(?!\w)z;Cannot uniquely determine std::string type used in std::anyz::_Manager_internalrrZ _M_bufferz::_Manager_externalr\)r;r]rKrV�_contained_typerr r*r>r?�groupr� _string_typesrHrPrrr,rr4rsrbrartr��superrX)rrDrW�contained_value� visualizerZmgr�funcZrx�mZmgrnameZmgrtypes�sr@Zmgrtyper)� __class__rrrXVsX zStdExpAnyPrinter.__init__cCsT|jdkrd|jSd|j}t|jd�r8||jj�S|j|j�}|tt|��S)Nz%s [no contained value]z%s containing r_)rr]r�r�rgrr;r!)r�descr7rrrrg�s zStdExpAnyPrinter.to_stringcs@ttjd�j��h}d�dddtg}|�fdd�|D�O}|S)Nzstd::stringzAbasic_string<char, std::char_traits<char>, std::allocator<char> >zstd::zstd::__cxx11::csh|]}|��qSrr)r&�q)r#rr� <setcomp>�sz1StdExpAnyPrinter._string_types.<locals>.<setcomp>)r!rrrr-)ZstringsZqualsr)r#rr�s zStdExpAnyPrinter._string_types) r r rrrXrgr�r� __classcell__rr)r$rrSsD rcs(eZdZdZ�fdd�Zdd�Z�ZS)�StdExpOptionalPrinterz5Print a std::optional or std::experimental::optional.c s�t|�|_t|j�|_|d}|jjd�r8|d}|}n*|d}|d}y|d}WnYnXtj|�}|std}tt|�j||�dS)N� _M_payloadzstd::experimental� _M_engaged�_M_value) r;r]rKr<rr�rr)rX)rrDrWZpayloadZengagedrr )r$rrrX�s" zStdExpOptionalPrinter.__init__cCs:|jdkrd|jSt|jd�r4d|j|jj�fS|jS)Nz%s [no contained value]r_z%s containing %s)rr]r�r�rg)rrrrrg�s zStdExpOptionalPrinter.to_string)r r rrrXrgr(rr)r$rr)�sr)cs(eZdZdZ�fdd�Zdd�Z�ZS)�StdVariantPrinterzPrint a std::variant.cs�t|j�}t|�|_|d|_|jt|�kr<d|_d}d}n@|t|j�|_|dddj}|j |jj ��j�}tj |�}tt|�j||d�dS)N�_M_indexZ_M_ur�rrr�)rTrr;r]�_indexrrr�rsrbrartrr�rr-rX)rrDrWZalternativesrr Zaddr)r$rrrX�s zStdVariantPrinter.__init__cCsH|jdkrd|jSt|jd�r8d|j|j|jj�fSd|j|jfS)Nz%s [no contained value]r_z%s [index %d] containing %sz %s [index %d])rr]r�r�r/rg)rrrrrg�s zStdVariantPrinter.to_string)r r rrrXrgr(rr)r$rr-�sr-cs(eZdZdZ�fdd�Zdd�Z�ZS)�StdNodeHandlePrinterzPrint a container node handle.cs�|jjd�|_|jjd�jd�}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)rrr�r\rrZ_M_allocr+r*r�)rr4�_value_typerBr"�_is_rb_tree_node�_is_map_noder�rtrurr�Z_allocrr0rX)rrDrWrZnodeptrrr Zoptalloc)r$rrrX�s&zStdNodeHandlePrinter.__init__cCsfd}|js|d7}|jr"|d7}n|d7}|jrZ|d7}t|jd�rVd||jj�fS|Sd|SdS) Nznode handle for z unordered r��setz with elementr_z%s = %szempty %s)r2r3rr�r�rg)rr%rrrrg s zStdNodeHandlePrinter.to_string)r r rrrXrgr(rr)r$rr0�sr0c@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdExpStringViewPrinterzP Print a std::basic_string_view or std::experimental::basic_string_view cCs ||_dS)N)rV)rrDrWrrrrX sz StdExpStringViewPrinter.__init__cCs6|jd}|jd}t|d�r*|j|d�S|j|d�S)NZ_M_str�_M_lenr�)r�)rVr�r�r�)rr�rrrrrg#s z!StdExpStringViewPrinter.to_stringcCsdS)Nr�r)rrrrr�*sz$StdExpStringViewPrinter.display_hintN)r r rrrXrgr�rrrrr5sr5c@s@eZdZdZdd�Zdd�Zdd�ZGdd �d e�Zd d�Z dS) �StdExpPathPrinterz,Print a std::experimental::filesystem::path.cCsB||_||_|jddd}|jddd}t||�|_dS)N�_M_cmptsr�r�r�)rVr]r�� _num_cmpts)rrDrWr�r�rrrrX1s zStdExpPathPrinter.__init__cCs:t|jd�}|dd�dkr"dS|d d�dkr6dSdS) NZ_M_typer�� _Root_dirzroot-directory� � _Root_namez root-namei����i����)r!rV)rr0rrr� _path_type8szStdExpPathPrinter._path_typecCs8d|jd}|jdkr0|j�}|r0d||f}d|S)Nz%s�_M_pathnamerz%s [%s]z!experimental::filesystem::path %s)rVr9r=)r�pathr0rrrrg@s zStdExpPathPrinter.to_stringc@s$eZdZdd�Zdd�Zdd�ZdS)zStdExpPathPrinter._iteratorcCs,||_|dd|_|dd|_d|_dS)Nr�r�r�r)� _pathtyper�r�r~)rZcmpts�pathtyperrrrXIsz$StdExpPathPrinter._iterator.__init__cCs|S)Nr)rrrrrYOsz$StdExpPathPrinter._iterator.__iter__cCsd|j|jkrt�|jj�}|j}|jd|_|jd|_|d}t|j|�j�}|sX|}d||fS)Nr)r>z[%s])r�r�rZrtr~r7r@r=)rr�rEr?r0rrrrRs z$StdExpPathPrinter._iterator.__next__N)r r rrXrYrrrrrr�Hsr�cCs|j|jd|j�S)Nr8)r�rVr])rrrrr__szStdExpPathPrinter.childrenN) r r rrrXr=rgrr�r_rrrrr7.sr7c@s@eZdZdZdd�Zdd�Zdd�ZGdd �d e�Zd d�Z dS) �StdPathPrinterzPrint a std::filesystem::path.cCsP||_||_t|jdd�}|jtjd��d@|_|jdkrF||_nd|_dS)Nr8r�Z uintptr_t�r)rVr]rprbrrr��_impl)rrDrWr�rrrrXfs zStdPathPrinter.__init__cCsHt|jjtj|jd���}|dd�dkr0dS|d d�dkrDdSdS) Nz::_Typer�r:zroot-directoryr;r<z root-namei����i����)r!r�rbrrr])rr0rrrr=pszStdPathPrinter._path_typecCs8d|jd}|jdkr0|j�}|r0d||f}d|S)Nz%sr>rz%s [%s]zfilesystem::path %s)rVr�r=)rr?r0rrrrgxs zStdPathPrinter.to_stringc@s$eZdZdd�Zdd�Zdd�ZdS)zStdPathPrinter._iteratorc Cs�||_|r�tjd�}tj|d�}tjd�}|j|j��}|j�}ttjd�rbtd|j |j �}n d|j }|j|j��|}|j|j��|_|j||_d|_ nd|_d|_dS)Nr�z::_Cmpt�char�alignofrr)r@rrrbrartr�r:�maxr�rFr�r�r~) rr�rAZint_typeZ cmpt_type� char_typer�Zsizeof_Impl�beginrrrrX�s z!StdPathPrinter._iterator.__init__cCs|S)Nr)rrrrrY�sz!StdPathPrinter._iterator.__iter__cCsd|j|jkrt�|jj�}|j}|jd|_|jd|_|d}t|j|�j�}|sX|}d||fS)Nr)r>z[%s])r�r�rZrtr~rBr@r=)rr�rEr?r0rrrr�s z!StdPathPrinter._iterator.__next__N)r r rrXrYrrrrrr��sr�cCs|j|j|j�S)N)r�rDr])rrrrr_�szStdPathPrinter.childrenN) r r rrrXr=rgrr�r_rrrrrBcs (rBc@s8eZdZdZdd�ZGdd�de�Zdd�Zdd �Zd S)�StdPairPrinterz@Print a std::pair object, with 'first' and 'second' as children.cCs ||_dS)N)rV)rrDrWrrrrX�szStdPairPrinter.__init__c@s(eZdZdZdd�Zdd�Zdd�ZdS) zStdPairPrinter._iterz?An iterator for std::pair types. Returns 'first' then 'second'.cCs||_d|_dS)Nr�)rV�_which)rrWrrrrX�szStdPairPrinter._iter.__init__cCs|S)Nr)rrrrrY�szStdPairPrinter._iter.__iter__cCs8|jdkrt�|j}|dkr$d|_nd|_||j|fS)Nr�r�)rKrZrV)rZwhichrrrr�s zStdPairPrinter._iter.__next__N)r r rrrXrYrrrrrr��sr�cCs|j|j�S)N)r�rV)rrrrr_�szStdPairPrinter.childrencCsdS)Nr)rrrrrg�szStdPairPrinter.to_stringN) r r rrrXrr�r_rgrrrrrJ�s rJc@s eZdZdZdd�Zdd�ZdS)�StdCmpCatPrinterz#Print a comparison category object.cCs&||jd�dd�|_|d|_dS)N�:r)r,)�rfindr]rV)rrDrWrrrrX�szStdCmpCatPrinter.__init__cCsJ|jdkr|jdkrd}n"dddddddd i}|t|j�}d j|j|�S)N�strong_orderingrZequalrZ unorderedr)ZlessZ equivalentZgreaterzstd::{}::{}ri)r]rVr�r*)rr"�namesrrrrg�s zStdCmpCatPrinter.to_stringN)r r rrrXrgrrrrrL�srLc@s`eZdZdZdZdd�Zedd��Zedd��Z ed d ��Z edd��Zed d��Zdd�Z dS)�StdErrorCodePrinterz0Print a std::error_code or std::error_condition.NcCsL||_t|�|_tjdkrHyddl}dt_Wntk rFdt_YnXdS)NrTF)rVr;r]rQ�_system_is_posix�posix�ImportError)rrDrWrSrrrrX�s zStdErrorCodePrinter.__init__cCs&tj|�}|dk r"|jtjkr"|SdS)N)rrr�ZTYPE_CODE_ENUM)r"r#rrr�_find_errc_enum�s z#StdErrorCodePrinter._find_errc_enumcCsBx<dtgD]0}ydj||�}|j|�Stk r8Yq Xq WdS)NrCz std::{}{})r-r*rUr)�clsr"�nsZqnamerrr�_find_standard_errc_enum�s z,StdErrorCodePrinter._find_standard_errc_enumc Cs�dddg}x~|D]v}|d}xhdtgD]\}dj|�}tjdj||��d}|dk r&||j�jkr&d |}|jd j||��}||fSq&WqWdS)N�streamZsocketzip::resolverz_category()rCzstd::{}experimental::net::v1z{}::{}::__crznet::z{}::{}_errc)NN)r-r*rZ lookup_symbol�valuersrU) rV�catZnet_catsr�r!rWZsymr"�enumrrr�_match_net_ts_category�s z*StdErrorCodePrinter._match_net_ts_categoryc Cs�d}d}d}|j|�\}}|dk r.d|||fS|jj�}|jjd�rLd}d}|jjd�rbd}|j}|jjd�r|d }|jd �}|jjd�r�d}|jd �}|dkr�yWnYnX||j||fS)z(Return details of a std::error_category.NFz::generic_error_category�genericTz::system_error_category�systemz::future_error_categoryZfutureZfuture_errcz::io_error_category�ioZio_errc)r]�dynamic_typer�r�endswithrRrX)rVr[r"r\�is_errnor!r#rrr�_category_infos2 z"StdErrorCodePrinter._category_infocCs|jd�dS)zX Strip any nested-name-specifier from name to give an unqualified name. z::r)ri)�split)r"rrr�_unqualified_name7sz%StdErrorCodePrinter._unqualified_namec Cs�|jd}|jd}|j|�\}}}}|dkrVddd�}|||j|j�krV|jdSt|�}|r�|dkr�ytjt|�}Wq�Yq�Xn|dk r�|jt|j|���}|dk r�d|}n|}d |j||fS) Nr,Z_M_catrr_r^)� error_code�error_conditionz = { }z"%s"z %s = {%s: %s}) rVrdrfr]r!�errno� errorcoder�rb) rrZr[r"Zalt_namer\rcZdefault_catsZstrvalrrrrg>s( zStdErrorCodePrinter.to_string)r r rrrRrXr�rU�classmethodrXr]rdrfrgrrrrrQ�s +rQc@s eZdZdZdd�Zdd�ZdS)�StdRegexStatePrinterz/Print a state node in the NFA for a std::regex.cCs||_||_dS)N)rVr])rrDrWrrrrX[szStdRegexStatePrinter.__init__cCs�t|jd�}|r|dd�}|jd}dddddddddddddd� }||}d j||�}|dk r�|jd |dk r�dj|||jd |�}d|S) NZ _M_opcode�rzZaltZsubexpr�negZ backref_index) �repeat�alternativeZ subexpr_beginZsubexpr_endZline_begin_assertionZline_end_assertionZ word_boundaryZsubexpr_lookaheadZbackrefr?ZacceptZdummy�unknownzopcode={}, next={}Z_M_z {}, {}={}z{%s})r!rVr*)rZopcodeZnext_idZvariants�vr#rrrrg_s zStdRegexStatePrinter.to_stringN)r r rrrXrgrrrrrlXsrlc@s@eZdZdZGdd�de�Zdd�Zdd�Zdd �Zd d�Z dS) �StdSpanPrinterzPrint a std::span.c@s$eZdZdd�Zdd�Zdd�ZdS)zStdSpanPrinter._iteratorcCsd|_||_||_dS)Nr)r~�_beginr�)rrIr�rrrrXysz!StdSpanPrinter._iterator.__init__cCs|S)Nr)rrrrrY~sz!StdSpanPrinter._iterator.__iter__cCs8|j|jkrt�|j}|jd|_d||j|j�fS)Nr)z[%d])r~r�rZrtrt)rrErrrr�s z!StdSpanPrinter._iterator.__next__N)r r rrXrYrrrrrr�xsr�cCsLt|�|_||_tjd�}|jjd�|kr:|dd|_n|jjd�|_dS)Nzstatic_cast<std::size_t>(-1)r)Z _M_extentZ_M_extent_value)r;r]rVrr�rr4r�)rrDrWZsize_maxrrrrX�s zStdSpanPrinter.__init__cCsd|j|jfS)Nz%s of length %d)r]r�)rrrrrg�szStdSpanPrinter.to_stringcCs|j|jd|j�S)Nr\)r�rVr�)rrrrr_�szStdSpanPrinter.childrencCsdS)Nr�r)rrrrr��szStdSpanPrinter.display_hintN) r r rrrr�rXrgr_r�rrrrrsus rsc@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�StdInitializerListPrinterzPrint a std::initializer_list.cCs||_||_|d|_dS)Nr6)r]rVr�)rrDrWrrrrX�sz"StdInitializerListPrinter.__init__cCsd|j|jfS)Nz%s of length %d)r]r�)rrrrrg�sz#StdInitializerListPrinter.to_stringcCstj|jd|j�S)NZ_M_array)rsr�rVr�)rrrrr_�sz"StdInitializerListPrinter.childrencCsdS)Nr�r)rrrrr��sz&StdInitializerListPrinter.display_hintN)r r rrrXrgr_r�rrrrru�s ruc@s(eZdZdZdd�Zdd�Zdd�ZdS) �StdAtomicPrinterzPrint a std:atomic.cCsrt|�|_||_d|_|jjjd�|_|jjdk rnt|jj�}|jd�sR|jd�rn|d}t ||�|_|j |_dS)Nrzstd::shared_ptr<zstd::weak_ptr<r�)r;r]rV�_shptr_printerrr4r1rr<r[�_shptr_childrenr_)rrDrWr#r�rrrrX�s zStdAtomicPrinter.__init__cCst|jj�S)N)rUrwr^)rrrrrx�sz StdAtomicPrinter._shptr_childrencCs�|jdk r|jj�S|jjtjkr.|jd}n`|jjtjkrH|jd}nF|jjtjkrf|jdd}n(|jjtj kr�|jdd}n |jd}d|j t|j�|fS)Nr`Z_M_fpZ_M_br�Z_M_basez%s<%s> = { %s })rwrgr1r�rZ TYPE_CODE_INTrV� TYPE_CODE_FLT� TYPE_CODE_PTRr�r]r!)rrWrrrrg�s zStdAtomicPrinter.to_stringN)r r rrrXrxrgrrrrrv�s rvc@s eZdZdZdd�Zdd�ZdS)�StdFormatArgsPrinterzPrint a std::basic_format_args.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdFormatArgsPrinter.__init__cCs�t|jj�}t|d�d}|tjd�kr0d}n|tjd�krDd}nd}|jd}|dkrbd |S|dkrt|jd }d||fS)Nrr)rEzstd::format_args�wchar_tzstd::wformat_argszstd::basic_format_argsZ_M_packed_sizez%s with 1 argumentZ_M_unpacked_sizez%s with %d arguments)rTrVrrr)rZtargsrHr#r�rrrrg�s zStdFormatArgsPrinter.to_stringN)r r rrrXrgrrrrr{�sr{c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�StdChronoDurationPrinterzPrint a std::chrono::duration.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z!StdChronoDurationPrinter.__init__cCs*|jjjd�}|jd�}|jd�}||fS)Nr)r)rVrr4)rZperiodr��denrrr�_ratio�s zStdChronoDurationPrinter._ratiocCs�|j�\}}|dkrF|dkr dS|dkr,dS|dkr8dS|dkr|dSn6|dkr||d krZd S|dkrfdS|d krrdSdj|�Sdj||�S)Nr)r#i�Zmsi@B�usiʚ;rW�<�mini�hi�Q�dz[{}]sz[{}/{}]s)rr*)rr�r~rrr�_suffix�s& z StdChronoDurationPrinter._suffixcCs4|jd}|jj�jtjkr$d|}dj||j��S)N�__rz%gz"std::chrono::duration = {{ {}{} }})rVrrr�rryr*r�)r�rrrrrgs z"StdChronoDurationPrinter.to_stringN)r r rrrXrr�rgrrrrr}�s r}c@s*eZdZdZdd�Zdd�Zd dd�Zd S)�StdChronoTimePointPrinterz Print a std::chrono::time_point.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrXs z"StdChronoTimePointPrinter.__init__cCsv|jjjd�}t|j�}|dks(|dkr,dS|dkr8dS|dkrDdS|d krPdS|dkr\dS|dkrhdSdj|�dfS)Nrzstd::chrono::_V2::system_clockzstd::chrono::system_clock�std::chrono::sys_timezstd::chrono::utc_clock�std::chrono::utc_timezstd::chrono::gps_clock�std::chrono::gps_timezstd::chrono::tai_clock�std::chrono::tai_timezstd::filesystem::__file_clock�std::chrono::file_time�umzstd::chrono::local_t�std::chrono::local_timez {} time_point)r�r)r�N)r�N)r�N)r�r�)r�r)rVrr4r;r"r*)r�clockr"rrr�_clocks z StdChronoTimePointPrinter._clockFc Cs�|j�\}}|jd}|d}t|jj|�}|j�}d}|dk r�|j�\} } || | |}ytjj|t �}dj |�}WnYnXd|||f} |r�| Sd|| fS)NZ__dr�rCz [{:%Y-%m-%d %H:%M:%S}]z%d%s%sz%s = { %s })r�rVr}rr"r�rrZ fromtimestamp� _utc_timezoner*)rZabbrevr��offsetr�r��printer�suffix�timer�r~Zsecsrr#rrrrg1s$ z#StdChronoTimePointPrinter.to_stringN)F)r r rrrXr�rgrrrrr�sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoZonedTimePrinterz Print a std::chrono::zoned_time.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrXIs z"StdChronoZonedTimePrinter.__init__cCs@|jdj�d}|jd}t|jj|�}|jd�}dj||�S)NZ_M_zone�_M_nameZ_M_tpTz%std::chrono::zoned_time = {{ {} {} }})rVrtr�rr"rgr*)rZzoner�r�rrrrgMs z#StdChronoZonedTimePrinter.to_stringN)r r rrrXrgrrrrr�Fsr�ZJanuaryZFebruaryZMarchZAprilZMayZJuneZJulyZAugustZ SeptemberZOctoberZNovemberZDecemberZSundayZMondayZTuesdayZ WednesdayZThursdayZFridayZSaturdayc@s eZdZdZdd�Zdd�ZdS)�StdChronoCalendarPrinterzDPrint a std::chrono::day, std::chrono::month, std::chrono::year etc.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX_s z!StdChronoCalendarPrinter.__init__c Csv|j}|j}d|kr$|dkr$|d}|jd�r6|d}|dkrPdjt|d��S|d kr||d ksl|tt�krtd|St|S|dkr�dj|�S|d kr�|d}|dks�|tt�kr�d|Sdjt|�S|dkr�dj|dt|d��S|dkr�dj|d�S|dk�rdj||d�S|dk�r,dj|�S|dk�rFdj||d�S|dk�r`dj||d�S|dk�rvdj||�S|dk�r�d j|||d�S|dk�r�dj||d!�S|d"k�r�d j|||d�S|d#k�r�d j|||d�S|jd$��rrd%}|d&dk�r"d'jt|d(d)�t|d&��}t|d*d+�}t|dd+�}t|d,d+�}|d-�rb|}d.j||||�SdS)/N�monthz std::chrono::year_month_day_lastZ_M_mzstd::chrono::yearZ_M_yzstd::chrono::dayz{}Z_M_dzstd::chrono::monthr)z%d is not a valid monthz{}yzstd::chrono::weekdayZ_M_wdrz%d is not a valid weekdayzstd::chrono::weekday_indexedz{}[{}]r.zstd::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_ssrCZfractional_widthz.{:0{}d}Z_M_ssZ_M_rrr��_M_sZ _M_is_negz{:02}:{:02}:{:02}{})rVr]r<r*r�r�months�weekdays) rrWr#r"�yZwdZfractr�r#rrrrgcsh z"StdChronoCalendarPrinter.to_stringN)r r rrrXrgrrrrr�\sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTimeZonePrinterz4Print a chrono::time_zone or chrono::time_zone_link.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z!StdChronoTimeZonePrinter.__init__cCs6d|j|jdf}|jjd�r2|d|jd7}|S)Nz%s = %sr�Z_linkz -> %sZ _M_target)r]rVrb)rr!rrrrg�sz"StdChronoTimeZonePrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoLeapSecondPrinterzPrint a chrono::leap_second.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z#StdChronoLeapSecondPrinter.__init__cCs.|jdd}d|dk}d|jt|�|fS)Nr�r�z+-rz %s %d (%c))rVr]�abs)rZdaternrrrrg�sz$StdChronoLeapSecondPrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTzdbPrinterzPrint a chrono::tzdb.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s zStdChronoTzdbPrinter.__init__cCsd|j|jdfS)Nz%s %s�version)r]rV)rrrrrg�szStdChronoTzdbPrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdChronoTimeZoneRulePrinterzPrint a chrono::time_zone rule.cCst|�|_||_dS)N)r;r]rV)rrDrWrrrrX�s z%StdChronoTimeZoneRulePrinter.__init__c Cs�|jd}|d}t|d}dddddddd�}|d}d j||j|d ��}|dkrddj||�}nVt|d }|dkr�dj||�}n4|dkr�d} nd} |d}dj| d|| d||�}dj|jd|jd|jd|�S)N�on�kindr��stZndZrd)r)rrC����Zday_of_monthz{}{}Zthrz{} {}Zday_of_weekr)z last {} in {}rr��<=r��>=z{} {} {} {} {}z.time_zone rule {} from {} to {} starting on {}r"�fromZto)r�r�)r�r�)rVr�r*�getr�) rr�r�r��suffixes�dayZordinal_dayr��weekday� directionrrrrg�s* z&StdChronoTimeZoneRulePrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdLocalePrinterzPrint a std::locale.cCs||_||_dS)N)rVr])rrDrWrrrrX�szStdLocalePrinter.__init__csx|jdd}d}|ddkr&d}�nFtj|jd�}tj|jd�}|dj�}|dj�}dj||�}||i}d } xN| |kr�|| dkr�|| j�}|| j�}d j|||�}|||<| d } qxWt|j��} t| �d kr�|}n�t| �dk�rl| \}}t |j��} d�| j |�d k�r$|}|�n| j |�d k�r<|}|��dk �rlt�fdd �|j�D��}dj|��}dj||�S)Nr�Z_M_namesrCr�*z::_S_categoriesz::_S_categories_sizez{}={}r)z{};{}={}rc3s|]\}}|�kr|VqdS)Nr)r&r�rR)�otherrr� <genexpr> sz-StdLocalePrinter.to_string.<locals>.<genexpr>z with "{}={}"zstd::locale = "{}"{}) rVrr�r]r�r*r4�valuesrr�rEr�items)rrP�modr"ZcatsZncatrRr[Z cat_namesrZ uniq_namesZn1Zn2Z name_listr)r�rrg�sD zStdLocalePrinter.to_stringN)r r rrrXrgrrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�StdIntegralConstantPrinterz*Print a std::true_type or std::false_type.cCs||_||_dS)N)rVr])rrDrWrrrrX sz#StdIntegralConstantPrinter.__init__cCsL|jjjd�}|jjjd�}|jtjkr4|r0dSdSt|j�}dj|||�S)Nrr)zstd::true_typezstd::false_typez {}<{}, {}>) rVrr4r�rr�r;r]r*)rr3rZrDrrrrg s z$StdIntegralConstantPrinter.to_stringN)r r rrrXrgrrrrr� sr�c@s eZdZdZdd�Zdd�ZdS)�StdTextEncodingPrinterzPrint a std::text_encoding.cCs||_||_dS)N)rVr])rrDrWrrrrX$ szStdTextEncodingPrinter.__init__cCs<|jdj�}|ddkr$|jdS|ddkr4dS|dS)NZ_M_repZ_M_idr)r�rrq)rVrt)rZreprrrrg( s z StdTextEncodingPrinter.to_stringN)r r rrrXrgrrrrr�! sr�cs$eZdZ�fdd�Zdd�Z�ZS)� RxPrintercs$tt|�j�||_||_d|_dS)NT)rr�rXr"� _function�enabled)rr"r)r$rrrX3 szRxPrinter.__init__cCs:|js dS|jjtjkr,ttjd�r,|j�}|j|j |�S)N�referenced_value) r�rr�rr�r��Valuer�r�r")rrZrrr�invoke9 szRxPrinter.invoke)r r rrXr�r(rr)r$rr�2 sr�csHeZdZ�fdd�Zdd�Zdd�Zdd�Zed d ��Zdd�Z �Z S) �Printercs6tt|�j�||_g|_i|_d|_tjd�|_ dS)NTz^([a-zA-Z0-9_:]+)(<.*>)?$) rr�rXr"�_subprinters�_lookupr�r>�compile�_compiled_rx)rr")r$rrrXH szPrinter.__init__cCs<|jj|�std|��t||�}|jj|�||j|<dS)Nz0libstdc++ programming error: "%s" does not match)r�r?r r�r�rPr�)rr"rr�rrr�addP s zPrinter.addcCs>|j|||�d|kr:tjddt|�}|j|||�dS)N�__cxx11z^(std|__gnu_cxx)::z\g<0>%s)r�r>rHr-)r�baser"rZvbaserrr�add_version[ s zPrinter.add_versioncCs$|j|||�|j|d||�dS)Nz__cxx1998::)r�)rr�r"rrrr� add_containerc szPrinter.add_containercCs&|jtjkr|j�}|j�j�}|jS)N)r�rr�r�r�rr)rrrr�get_basic_typeg szPrinter.get_basic_typecCsr|j|j�}|sdS|jj|�}|s(dS|jd�}|jjtjkrTttj d�rT|j �}||jkrn|j|j|�SdS)Nr)r�) r�rr�r?rr�rr�r�r�r�r�r�)rrWrDr?�basenamerrr�__call__r s zPrinter.__call__)r r rrXr�r�r�r�r�r�r(rr)r$rr�G sr�c@s0eZdZdZdd�ZGdd�de�Zdd�ZdS) �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<T, std::allocator<T> >' with 'std::vector<T>'. cCs||_||_d|_dS)NT)r"�_defargsr�)rr"�defargsrrrrX� szTemplateTypePrinter.__init__c@s(eZdZdZdd�Zdd�Zdd�ZdS) zTemplateTypePrinter._recognizerz-The recognizer class for TemplateTypePrinter.cCs||_||_dS)N)r"r�)rr"r�rrrrX� sz(TemplateTypePrinter._recognizer.__init__c Cs�|jdkrdS|jj|j�s dSt|�}g}d}x�tt|��D]�}||}|jj|�}|dk r�|j|�}y|t j |�kr|dSWn$t jk r�|j|kr�dSYnXd}q>|r�dS|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�<z, �>)rr<r"rT�rangerr�r�r*rrr,rP�_recognize_subtyper�rOr+) rrQrSZdisplayed_argsZrequire_defaultedrRrfZdefargrArrr� recognize� s2 z)TemplateTypePrinter._recognizer.recognizecCs�|jtjkr|j|j��dS|jtjkrj|j|j��}t|j��jd�rR|dSd||j �ddfS|jtj kr�|j|j��dSttd�r�|jtjkr�|j|j��dStj jtj j�|�}|r�|St|�S)zxConvert a gdb.Type to a string by applying recognizers, or if that fails then simply converting to a string.r�z[]z%s[%d]r)�&�TYPE_CODE_RVALUE_REFz&&)r�rrzr�r�r�r!rrbr�r�r�r�rrr)rrQrNrrrr�� s" z2TemplateTypePrinter._recognizer._recognize_subtypeN)r r rrrXr�r�rrrr�_recognizer� s1r�cCs|j|j|j�S)z1Return a recognizer object for this type printer.)r�r"r�)rrrr�instantiate� szTemplateTypePrinter.instantiateN)r r rrrX�objectr�r�rrrrr�� s Pr�cs�td||�}tjj||�td||�}tjj||�d|kr�dt�t�fdd�|j�D��}t�||�}tjj||�td||�}tjj||�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<std::pair<const {0}, {1}> >' } zstd::zstd::__debug::r�c3s"|]\}}||jd��fVqdS)zstd::N)r.)r&rRr�)rWrrr� sz0add_one_template_type_printer.<locals>.<genexpr>N)r�rr�register_type_printerr-�dictr�)�objr"r�r�r)rWr�add_one_template_type_printer� sr�c@s2eZdZdZd dd�ZGdd�de�Zdd�ZdS) �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<C, T> 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<char,...>' and not 'basic_string<wchar_t,...>'. This rejects non-matching specializations more quickly, without needing to do GDB type lookups. NcCs||_||_||_d|_dS)NT)� _templater"�_targ1r�)r�templater"�targ1rrrrX- szFilteringTypePrinter.__init__c@s eZdZdZdd�Zdd�ZdS)z FilteringTypePrinter._recognizerz.The recognizer class for FilteringTypePrinter.cCs||_||_||_d|_dS)N)r�r"r�� _type_obj)rr�r"r�rrrrX6 sz)FilteringTypePrinter._recognizer.__init__c Cs�|jdkrdS|jdkrz|jdk rDdj|j|j�}|jj|�sVdSn|jj|j�sVdSytj|j�j �|_WnYnX|jdkr�dStj j|j�}tj j|�}||kr�t|j�S|jj d�ddkr�|jjjdd�}|jjdd�}||kr�t|j�SdS) z� If type_obj starts with self._template and is the same type as self.name then return self.name, otherwise None. Nz{}<{}z::r)�basic_stringz __cxx11::rCri)rr�r�r*r�r<rrr"rrr�rOrer.)rrQr#Zt1Zt2�s1�s2rrrr�< s4 z*FilteringTypePrinter._recognizer.recognizeN)r r rrrXr�rrrrr�3 sr�cCs|j|j|j|j�S)z1Return a recognizer object for this type printer.)r�r�r"r�)rrrrr�f sz FilteringTypePrinter.instantiate)N)r r rrrXr�r�r�rrrrr� s 3r�cCsXtd|d||�}tjj||�d|krTdt}t|||||�}tjj||�dS)Nzstd::r�)r�rrr�r-)r�r�r"r�r�rWrrr�add_one_type_printerk sr�c CsdtsdSxxdgD]p}t|d|dd |d�t|d|dd |d�t|dd|dd |d�t|d|dd|d�qWx�djD]|}x*dkD]"}t|d||d||d�q�WxJdlD]B}t|d||d||d�t|d!||d||d��q�Wq�Wx�dmD]�}x0dpD](}t||d"||dd#|d��qWxNdqD]F}t||d(||d)�x&drD]}t||||||��qlW�qJW�qWt|d-d.�xdsD]}t|d9d:|��q�Wt|d;d<�t|d;d=�t|d>d?�t|d>d@�t|dAdB�t|dAdC�t|dDdE�t|dDdF�t|dGdH�dI}x0dyD](}t||d||dd|d��q<Wt|dJddKi�t|dLddMi�t|dNddMi�t|dOddMi�t|dPddMi�t|dQddMi�t|dRdSdTdU��t|dVdSdTdU��t|dWdSdMdX��t|dYdSdMdX��t|dZd[d\dTd]��t|d^d[d\dTd]��t|d_d[d\dMd`��t|dad[d\dMd`��dS)zNrCrEr�r|�u8�char8_t�u16�char16_t�u32�char32_tr�rr�r)z__cxx11::basic_string� __cxx11::�basic_string_viewZstring_view�iosr��istream�ostream�iostream�filebuf�ifstream�ofstream�fstream�basic_� stringbuf� istringstream� ostringstream�stringstreamz__cxx11::basic_Zbasic_regexZregexr�r#�wc�wsZ match_resultsr?� sub_match�regex_iterator�regex_token_iteratorZfposZ streampos�nanoseconds�microseconds�milliseconds�seconds�minutes�hours�days�weeks�yearsr�zchrono::durationzchrono::Zlinear_congruential_engineZminstd_rand0Zminstd_randZmersenne_twister_engineZmt19937Z mt19937_64Zsubtract_with_carry_engineZ ranlux24_baseZ ranlux48_baseZdiscard_block_engineZranlux24Zranlux48Zshuffle_order_engineZknuth_bzexperimental::fundamentals_v1::� unique_ptrzstd::default_delete<{0}>�dequezstd::allocator<{0}>r�r�z __cxx11::list�vectorr�zstd::less<{0}>z)std::allocator<std::pair<{0} const, {1}>>)rrC�multimapr4)r)r�multiset� unordered_mapzstd::hash<{0}>zstd::equal_to<{0}>)rrC��unordered_multimap� unordered_set)r)rrC�unordered_multiset�rCrE�r�r|�r�r��r�r��r�r�)rrrrr�rCrE�r�r|)rr) r�r�r�r�r�r�r�r�r�)r�r�r�r�)rCr��rCrE�r�r|)rr )r�r#rr)rrr) rrrrr r rrr r��rCrE�r�r|�r�r��r�r��r�r�)r!r"r#r$r%)rr�r�)r�Zchr@�abiZdurrWrrr�register_type_printerst s� "( * r'cCs8trtjj|t�n|dkr t}|jjt�t|�dS)z4Register libstdc++ pretty-printers with objfile Obj.N)�_use_gdb_pprZprintingZregister_pretty_printer�libstdcxx_printerZpretty_printersrPr')r�rrr�register_libstdcxx_printers� sr*cCsXtd�atjddt�tjddt�tjddt�tjddt�tjddt�tjddt�tjddt�tjdd t�tjdd t �tjddt �tjddt�tjdd t�tjddt�tjddt �tjddt�tjddt �tjddt�tjddt�ttjd��r.tjddt�tjddt�tjdt�tjdt�tjdt�tjdt�tjdt�tjdt �tjdt �tjdt�tjddt�tjdd t�tjdd!t�tjdd"t�tjdd#t�tjdd$t�tjdd%t�tjd&dt�tjd&d t�tjd&d!t�tjd&d"t�tjd&d#t�tjd&d$t�tjdd't�tjdd(t�tjdd)t�tjdd)t�x2doD]*}tjdd-|t�tjdd-|t��q�Wtjd.d/t�tjd.d0t�tjdd1t�tjd2d3t �tjd4t�tjd5t�tjd6t�tjd7t�tjd8t�tjd9d:t!�tjd9d;t"�tjd9d<t#�tjd=d>t$�tjd?d>t$�tjd@d>t%�tjdAd>t%�tjdd:t!�tjdd;t"�tjdd<t#�tjddBt&�tjddCt'�tjddDt(�tjddEt(�tjddFt(�tjddGt)�tjddHt*�xdpD]}tjd.|t+��qWtjd.dYt,�tjd.dZt,�tjd.d[t-�tjd.d\t.�tjd.d]t/�tjdd^t0�tjd_d`t1�tjddat2�tjddbt2�tjddct3�tjdddt3�tjddet4�tjddft4�tjd_dgt5�tjddht6�tjddit6�tjddjt7�tjd_dkt8�tjddlt9�tjddmt9�tjdnt:�dS)qNzlibstdc++-v6zstd::r�zstd::__cxx11::Zbitsetrr�r�rrZpairZpriority_queueZqueueror4�stackrrZlocalerargrhzstd::__debug::bitsetzstd::__debug::dequezstd::__debug::listzstd::__debug::mapzstd::__debug::multimapzstd::__debug::multisetzstd::__debug::setzstd::__debug::vectorZ shared_ptrZweak_ptrrrrrr�z std::tr1::Zinitializer_listZatomicZbasic_stringbufr�r�r�r�z 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::r?z,std::experimental::filesystem::v1::__cxx11::zstd::filesystem::zstd::filesystem::__cxx11::ZvariantZ_Node_handleZpartial_orderingZ weak_orderingrO�spanZbasic_format_argsr�r��yearr��weekday_indexed�weekday_last� month_day�month_day_last� month_weekday�month_weekday_last� year_month�year_month_day�year_month_day_last�year_month_weekday�year_month_weekday_last�hh_mm_ssZ time_zoneZtime_zone_linkZ zoned_timeZleap_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)r�r�r�)r�r�r.r�r/r0r1r2r3r4r5r6r7r8r9r:);r�r)r�r�r�r�r�ryr�r�rJr�r�rqr�r�r�rr�rQr�r[r rrrurvr�r�r}r�r�rlrr)r5r7rBr-r0rLrsr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)Zsstreamr�rrr�build_libstdcxx_dictionary� sL r;)N)vrrr>rFrirrGr�rr�r �ziprr�r�ZtimezoneZutcr�Ztzinforr(Zgdb.printingrTrZ gdb.typesr�rrZprinter_baser%r-r2r8r5rBr;rKrOrTrUr[rkrmrprqrurxryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr rrrrr)r-r0r5r7rBrJrLrQrlrsrurvr{r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r)r�r�r�r�r'r*r;rrrr�<module>s� % (&"I U(*$/A" /%-^!,5I!{'$*/? ",Ce%T oTPK���\��e��6libstdcxx/v6/__pycache__/xmethods.cpython-36.opt-1.pycnu�[���3 ���hq�@s�ddlZddlZddlZdZdd�Zdd�ZdZdd �ZGd d�dejj �Z Gdd �d ejj�ZGdd�de�Z Gdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dejj�ZGdd�dejj�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�ZGd*d+�d+ejj�ZGd,d-�d-ejj�ZGd.d/�d/e�ZGd0d1�d1e�ZGd2d3�d3ejj�Z Gd4d5�d5ejj�Z!Gd6d7�d7e!�Z"Gd8d9�d9e!�Z#Gd:d;�d;e!�Z$Gd<d=�d=e!�Z%Gd>d?�d?ejj�Z&Gd@dA�dAejj�Z'GdBdC�dCe'�Z(GdDdE�dEe'�Z)GdFdG�dGe'�Z*GdHdI�dIe'�Z+GdJdK�dKe'�Z,GdLdM�dMe'�Z-GdNdO�dOejj�Z.GdPdQ�dQejj�Z/GdRdS�dSe/�Z0GdTdU�dUe/�Z1GdVdW�dWejj�Z2GdXdY�dYejj�Z3GdZd[�d[e3�Z4Gd\d]�d]e3�Z5Gd^d_�d_ejj�Z6Gd`da�daejj�Z7Gdbdc�dce7�Z8Gddde�dee7�Z9Gdfdg�dgejj�Z:Gdhdi�die:�Z;Gdjdk�dkejj�Z<dldm�Z=dS)n�Nzlibstdc++::cCs tjd�S)N�bool)�gdb�lookup_type�rr�0/usr/share/gcc-8/python/libstdcxx/v6/xmethods.py� get_bool_typesrcCs tjd�S)Nzstd::size_t)rrrrrr�get_std_size_typesrz__8::cCs2t|tj�r|j}dt|f}tjd||�dk S)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::(__\d::)?%s<.*>$N)� isinstancerZType�tag�_versioned_namespace�re�match)�xZ template_namerrr�is_specialization_of!src@seZdZdd�ZdS)�LibStdCxxXMethodcCstjjj||�||_dS)N)r�xmethod�XMethod�__init__�worker_class)�self�namerrrrr.szLibStdCxxXMethod.__init__N)�__name__� __module__�__qualname__rrrrrr-src@seZdZdd�Zdd�ZdS)�ArrayWorkerBasecCs||_||_dS)N)� _val_type�_size)r�val_type�sizerrrr6szArrayWorkerBase.__init__cCstjd�}|j|jj��j�S)Nz (void *) 0)rZparse_and_eval�castr�pointer�dereference)rZnullptrrrr� null_value:s zArrayWorkerBase.null_valueN)rrrrr"rrrrr5src@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArraySizeWorkercCstj|||�dS)N)rr)rrrrrrr@szArraySizeWorker.__init__cCsdS)Nr)rrrr� get_arg_typesCszArraySizeWorker.get_arg_typescCst�S)N)r)r�objrrr�get_result_typeFszArraySizeWorker.get_result_typecCs|jS)N)r)rr%rrr�__call__IszArraySizeWorker.__call__N)rrrrr$r&r'rrrrr#?sr#c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArrayEmptyWorkercCstj|||�dS)N)rr)rrrrrrrNszArrayEmptyWorker.__init__cCsdS)Nr)rrrrr$QszArrayEmptyWorker.get_arg_typescCst�S)N)r)rr%rrrr&Tsz ArrayEmptyWorker.get_result_typecCst|j�dkS)Nr)�intr)rr%rrrr'WszArrayEmptyWorker.__call__N)rrrrr$r&r'rrrrr(Msr(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArrayFrontWorkercCstj|||�dS)N)rr)rrrrrrr\szArrayFrontWorker.__init__cCsdS)Nr)rrrrr$_szArrayFrontWorker.get_arg_typescCs|jS)N)r)rr%rrrr&bsz ArrayFrontWorker.get_result_typecCs&t|j�dkr|ddS|j�SdS)Nr�_M_elems)r)rr")rr%rrrr'eszArrayFrontWorker.__call__N)rrrrr$r&r'rrrrr*[sr*c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArrayBackWorkercCstj|||�dS)N)rr)rrrrrrrmszArrayBackWorker.__init__cCsdS)Nr)rrrrr$pszArrayBackWorker.get_arg_typescCs|jS)N)r)rr%rrrr&sszArrayBackWorker.get_result_typecCs,t|j�dkr |d|jdS|j�SdS)Nrr+�)r)rr")rr%rrrr'vszArrayBackWorker.__call__N)rrrrr$r&r'rrrrr,lsr,c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) � ArrayAtWorkercCstj|||�dS)N)rr)rrrrrrr~szArrayAtWorker.__init__cCst�S)N)r)rrrrr$�szArrayAtWorker.get_arg_typescCs|jS)N)r)rr%�indexrrrr&�szArrayAtWorker.get_result_typecCs4t|�t|j�kr(tdt|�|jf��|d|S)Nz%Array index "%d" should not be >= %d.r+)r)r� IndexError)rr%r/rrrr'�szArrayAtWorker.__call__N)rrrrr$r&r'rrrrr.}sr.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArraySubscriptWorkercCstj|||�dS)N)rr)rrrrrrr�szArraySubscriptWorker.__init__cCst�S)N)r)rrrrr$�sz"ArraySubscriptWorker.get_arg_typescCs|jS)N)r)rr%r/rrrr&�sz$ArraySubscriptWorker.get_result_typecCs&t|j�dkr|d|S|j�SdS)Nrr+)r)rr")rr%r/rrrr'�szArraySubscriptWorker.__call__N)rrrrr$r&r'rrrrr1�sr1c@seZdZdd�Zdd�ZdS)�ArrayMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt �tdt �tdt�d��_�fd d ��jD��_ dS)N�arrayr�empty�front�back�atz operator[])rr4r5r6r7z operator[]csg|]}�j|�qSr)�_method_dict)�.0�m)rrr� <listcomp>�sz0ArrayMethodsMatcher.__init__.<locals>.<listcomp>)rr�XMethodMatcherr�matcher_name_prefixrr#r(r*r,r.r1r8�methods)rr)rrr�s zArrayMethodsMatcher.__init__c Cs^t|d�sdS|jj|�}|dks*|jr.dSy|jd�}|jd�}Wn dS|j||�S)Nr3rr-)rr8�get�enabled�template_argumentr)r� class_type�method_name�methodZ value_typerrrrr �s zArrayMethodsMatcher.matchN)rrrrr rrrrr2�s r2c@s$eZdZdd�Zdd�Zdd�ZdS)�DequeWorkerBasecCs||_d|jpd|_dS)Nir-)r�sizeof�_bufsize)rrrrrr�szDequeWorkerBase.__init__cCsf|dd}|dd}|d|dkr,dS|j|d|dd|d|d|d |dS) N�_M_impl�_M_start� _M_finish�_M_curr�_M_noder-�_M_first�_M_last)rG)rr%�start�finishrrrr�s zDequeWorkerBase.sizecCs`|dd}|d|d}||kr0|d|S||}|ddt|�|j}|||jS)NrHrIrNrKrLr-)r)rG)rr%�idxrOZfirst_node_sizeZ index_noderrrr/�szDequeWorkerBase.indexN)rrrrrr/rrrrrE�s rEc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeEmptyWorkercCsdS)Nr)rrrrr$�szDequeEmptyWorker.get_arg_typescCst�S)N)r)rr%rrrr&�sz DequeEmptyWorker.get_result_typecCs |ddd|dddkS)NrHrIrKrJr)rr%rrrr'�szDequeEmptyWorker.__call__N)rrrr$r&r'rrrrrR�srRc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeSizeWorkercCsdS)Nr)rrrrr$�szDequeSizeWorker.get_arg_typescCst�S)N)r)rr%rrrr&�szDequeSizeWorker.get_result_typecCs |j|�S)N)r)rr%rrrr'�szDequeSizeWorker.__call__N)rrrr$r&r'rrrrrS�srSc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeFrontWorkercCsdS)Nr)rrrrr$�szDequeFrontWorker.get_arg_typescCs|jS)N)r)rr%rrrr&�sz DequeFrontWorker.get_result_typecCs|ddddS)NrHrIrKrr)rr%rrrr'�szDequeFrontWorker.__call__N)rrrr$r&r'rrrrrT�srTc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeBackWorkercCsdS)Nr)rrrrr$�szDequeBackWorker.get_arg_typescCs|jS)N)r)rr%rrrr&�szDequeBackWorker.get_result_typecCs^|ddd|dddkrF|dddd}|d|jdS|ddddSdS) NrHrJrKrMrLr-r���)rG)rr%� prev_noderrrr's zDequeBackWorker.__call__N)rrrr$r&r'rrrrrU�srUc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeSubscriptWorkercCst�S)N)r)rrrrr$ sz"DequeSubscriptWorker.get_arg_typescCs|jS)N)r)rr%� subscriptrrrr& sz$DequeSubscriptWorker.get_result_typecCs|j||�S)N)r/)rr%rYrrrr'szDequeSubscriptWorker.__call__N)rrrr$r&r'rrrrrX srXc@s$eZdZdd�Zdd�Zdd�ZdS)� DequeAtWorkercCst�S)N)r)rrrrr$szDequeAtWorker.get_arg_typescCs|jS)N)r)rr%r/rrrr&szDequeAtWorker.get_result_typecCs@t|j|��}t|�|kr0tdt|�|f��n|j||�SdS)Nz%Deque index "%d" should not be >= %d.)r)rr0r/)rr%r/Z deque_sizerrrr's zDequeAtWorker.__call__N)rrrr$r&r'rrrrrZsrZc@seZdZdd�Zdd�ZdS)�DequeMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt �tdt �tdt�d��_�fd d ��jD��_ dS)N�dequer4rr5r6z operator[]r7)r4rr5r6z operator[]r7csg|]}�j|�qSr)r8)r9r:)rrrr;0sz0DequeMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rrRrSrTrUrXrZr8r>)rr)rrr%s zDequeMethodsMatcher.__init__cCs>t|d�sdS|jj|�}|dks*|jr.dS|j|jd��S)Nr\r)rr8r?r@rrA)rrBrCrDrrrr 2s zDequeMethodsMatcher.matchN)rrrrr rrrrr[$s r[c@seZdZdd�Zdd�ZdS)�ForwardListWorkerBasecCs||_||_dS)N)r� _node_type)rr� node_typerrrr>szForwardListWorkerBase.__init__cCsdS)Nr)rrrrr$Bsz#ForwardListWorkerBase.get_arg_typesN)rrrrr$rrrrr]=sr]c@seZdZdd�Zdd�ZdS)�ForwardListEmptyWorkercCst�S)N)r)rr%rrrr&Gsz&ForwardListEmptyWorker.get_result_typecCs|ddddkS)NrH�_M_head�_M_nextrr)rr%rrrr'JszForwardListEmptyWorker.__call__N)rrrr&r'rrrrr`Fsr`c@seZdZdd�Zdd�ZdS)�ForwardListFrontWorkercCs|jS)N)r)rr%rrrr&Osz&ForwardListFrontWorker.get_result_typecCs:|dddj|j�}|ddj}|j|jj��j�S)NrHrarb� _M_storage)rr^�addressrr r!)rr%�nodeZval_addressrrrr'RszForwardListFrontWorker.__call__N)rrrr&r'rrrrrcNsrcc@seZdZdd�Zdd�ZdS)�ForwardListMethodsMatchercsJtd}tjjj�|�tdt�tdt�d��_�fdd��jD��_ dS)N�forward_listr4r5)r4r5csg|]}�j|�qSr)r8)r9r:)rrrr;`sz6ForwardListMethodsMatcher.__init__.<locals>.<listcomp>) r=rrr<rrr`rcr8r>)rZmatcher_namer)rrrYs z"ForwardListMethodsMatcher.__init__cCsZt|d�sdS|jj|�}|dks*|jr.dS|jd�}tjt|�d�j�}|j ||�S)Nrhrz::_Node) rr8r?r@rArr�strr r)rrBrCrDrr_rrrr bs zForwardListMethodsMatcher.matchN)rrrrr rrrrrgXs rgc@s$eZdZdd�Zdd�Zdd�ZdS)�ListWorkerBasecCs||_||_dS)N)rr^)rrr_rrrrpszListWorkerBase.__init__cCsdS)Nr)rrrrr$tszListWorkerBase.get_arg_typescCsB|j�}|jj�djdkr$|dS|dj}|j|jj��j�S)Nr-Z_M_datard)r!�type�fieldsrrerrr )rrfZaddrrrr�get_value_from_nodews z"ListWorkerBase.get_value_from_nodeN)rrrrr$rmrrrrrjosrjc@seZdZdd�Zdd�ZdS)�ListEmptyWorkercCst�S)N)r)rr%rrrr&�szListEmptyWorker.get_result_typecCs&|dd}|d|jkrdSdSdS)NrHrLrbTF)re)rr%Z base_noderrrr'�szListEmptyWorker.__call__N)rrrr&r'rrrrrn�srnc@seZdZdd�Zdd�ZdS)�ListSizeWorkercCst�S)N)r)rr%rrrr&�szListSizeWorker.get_result_typecCsD|ddd}|ddj}d}x||kr>|d}|d7}q$W|S)NrHrLrbrr-)re)rr%Z begin_nodeZend_noderrrrr'�s zListSizeWorker.__call__N)rrrr&r'rrrrro�sroc@seZdZdd�Zdd�ZdS)�ListFrontWorkercCs|jS)N)r)rr%rrrr&�szListFrontWorker.get_result_typecCs"|dddj|j�}|j|�S)NrHrLrb)rr^rm)rr%rfrrrr'�szListFrontWorker.__call__N)rrrr&r'rrrrrp�srpc@seZdZdd�Zdd�ZdS)�ListBackWorkercCs|jS)N)r)rr%rrrr&�szListBackWorker.get_result_typecCs"|dddj|j�}|j|�S)NrHrLZ_M_prev)rr^rm)rr%rWrrrr'�szListBackWorker.__call__N)rrrr&r'rrrrrq�srqc@seZdZdd�Zdd�ZdS)�ListMethodsMatchercsVtjjj�td�tdt�tdt�tdt�tdt �d��_ �fdd��j D��_dS) N�listr4rr5r6)r4rr5r6csg|]}�j|�qSr)r8)r9r:)rrrr;�sz/ListMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rrnrorprqr8r>)rr)rrr�s zListMethodsMatcher.__init__cCsZt|d�sdS|jj|�}|dks*|jr.dS|jd�}tjt|�d�j�}|j ||�S)Nz(__cxx11::)?listrz::_Node) rr8r?r@rArrrir r)rrBrCrDrr_rrrr �s zListMethodsMatcher.matchN)rrrrr rrrrrr�srrc@s$eZdZdd�Zdd�Zdd�ZdS)�VectorWorkerBasecCs ||_dS)N)r)rrrrrr�szVectorWorkerBase.__init__cCsz|jjtjkr^|ddd}|ddd}|ddd}|j�jjd}||||S|dd|ddSdS)NrHrI�_M_prJZ _M_offset�)r�coder�TYPE_CODE_BOOLr!rkrF)rr%rOrPZ finish_offset�bit_sizerrrr�szVectorWorkerBase.sizecCsj|jjtjkrV|ddd}|j�jjd}|||}||}|j�d|>@dkS|dd|SdS)NrHrIrurvr-r)rrwrrxr!rkrF)rr%r/rOryZvalp�offsetrrrr?�szVectorWorkerBase.getN)rrrrrr?rrrrrt�s rtc@s$eZdZdd�Zdd�Zdd�ZdS)�VectorEmptyWorkercCsdS)Nr)rrrrr$�szVectorEmptyWorker.get_arg_typescCst�S)N)r)rr%rrrr&�sz!VectorEmptyWorker.get_result_typecCst|j|��dkS)Nr)r)r)rr%rrrr'�szVectorEmptyWorker.__call__N)rrrr$r&r'rrrrr{�sr{c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorSizeWorkercCsdS)Nr)rrrrr$�szVectorSizeWorker.get_arg_typescCst�S)N)r)rr%rrrr&�sz VectorSizeWorker.get_result_typecCs |j|�S)N)r)rr%rrrr'�szVectorSizeWorker.__call__N)rrrr$r&r'rrrrr|�sr|c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorFrontWorkercCsdS)Nr)rrrrr$�szVectorFrontWorker.get_arg_typescCs|jS)N)r)rr%rrrr&�sz!VectorFrontWorker.get_result_typecCs|j|d�S)Nr)r?)rr%rrrr'�szVectorFrontWorker.__call__N)rrrr$r&r'rrrrr}�sr}c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorBackWorkercCsdS)Nr)rrrrr$szVectorBackWorker.get_arg_typescCs|jS)N)r)rr%rrrr&sz VectorBackWorker.get_result_typecCs|j|t|j|��d�S)Nr-)r?r)r)rr%rrrr'szVectorBackWorker.__call__N)rrrr$r&r'rrrrr~sr~c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorAtWorkercCst�S)N)r)rrrrr$szVectorAtWorker.get_arg_typescCs|jS)N)r)rr%r/rrrr&szVectorAtWorker.get_result_typecCs>t|j|��}t|�|kr.tdt|�|f��|j|t|��S)Nz&Vector index "%d" should not be >= %d.)r)rr0r?)rr%r/rrrrr's zVectorAtWorker.__call__N)rrrr$r&r'rrrrrsrc@s$eZdZdd�Zdd�Zdd�ZdS)�VectorSubscriptWorkercCst�S)N)r)rrrrr$sz#VectorSubscriptWorker.get_arg_typescCs|jS)N)r)rr%rYrrrr&sz%VectorSubscriptWorker.get_result_typecCs|j|t|��S)N)r?r))rr%rYrrrr'!szVectorSubscriptWorker.__call__N)rrrr$r&r'rrrrr�sr�c@seZdZdd�Zdd�ZdS)�VectorMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt �tdt �tdt�d��_�fd d ��jD��_ dS)N�vectorrr4r5r6r7z operator[])rr4r5r6r7z operator[]csg|]}�j|�qSr)r8)r9r:)rrrr;2sz1VectorMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rr|r{r}r~rr�r8r>)rr)rrr&s zVectorMethodsMatcher.__init__cCs>t|d�sdS|jj|�}|dks*|jr.dS|j|jd��S)Nr�r)rr8r?r@rrA)rrBrCrDrrrr 4s zVectorMethodsMatcher.matchN)rrrrr rrrrr�%sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�AssociativeContainerWorkerBasecCs ||_dS)N)� _unordered)r� unorderedrrrr@sz'AssociativeContainerWorkerBase.__init__cCs&|jr|ddS|dddSdS)NZ_M_hZ_M_element_count�_M_trHZ _M_node_count)r�)rr%rrr� node_countCsz)AssociativeContainerWorkerBase.node_countcCsdS)Nr)rrrrr$Isz,AssociativeContainerWorkerBase.get_arg_typesN)rrrrr�r$rrrrr�?sr�c@seZdZdd�Zdd�ZdS)�AssociativeContainerEmptyWorkercCst�S)N)r)rr%rrrr&Nsz/AssociativeContainerEmptyWorker.get_result_typecCst|j|��dkS)Nr)r)r�)rr%rrrr'Qsz(AssociativeContainerEmptyWorker.__call__N)rrrr&r'rrrrr�Msr�c@seZdZdd�Zdd�ZdS)�AssociativeContainerSizeWorkercCst�S)N)r)rr%rrrr&Vsz.AssociativeContainerSizeWorker.get_result_typecCs |j|�S)N)r�)rr%rrrr'Ysz'AssociativeContainerSizeWorker.__call__N)rrrr&r'rrrrr�Usr�c@seZdZdd�Zdd�ZdS)�"AssociativeContainerMethodsMatchercsLtjjj�t|�|�_tdt�tdt�d��_ �fdd��j D��_ dS)Nrr4)rr4csg|]}�j|�qSr)r8)r9r:)rrrr;gsz?AssociativeContainerMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=�_namerr�r�r8r>)rrr)rrr^s z+AssociativeContainerMethodsMatcher.__init__cCsDt||j�sdS|jj|�}|dks,|jr0dSd|jk}|j|�S)Nr�)rr�r8r?r@r)rrBrCrDr�rrrr is z(AssociativeContainerMethodsMatcher.matchN)rrrrr rrrrr�]sr�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �UniquePtrGetWorkerzS Implement std::unique_ptr<T>::get() and std::unique_ptr<T>::operator->(). cCs*|jtjk|_|jr |j�|_n||_dS)N)rwr�TYPE_CODE_ARRAY� _is_array�target� _elem_type)r� elem_typerrrrzszUniquePtrGetWorker.__init__cCsdS)Nr)rrrrr$�sz UniquePtrGetWorker.get_arg_typescCs |jj�S)N)r�r )rr%rrrr&�sz"UniquePtrGetWorker.get_result_typecCs|dkp|jS)Nr?)r�)rrCrrr� _supports�szUniquePtrGetWorker._supportscCs�|j�jj�djj}t|d�r.|dd}nt|d�rB|d}ndS|jj�dj}|j�dj}|j�d}|jdkr�|j|�dS|jr�|j|j�SdSdS)Nrz__uniq_ptr_(data|impl)r��tupler-Z_M_head_impl)r!rkrlr rrrZ is_base_class)rr%Z impl_typeZtuple_memberZtuple_impl_typeZtuple_head_typeZ head_fieldrrrr'�s zUniquePtrGetWorker.__call__N) rrr�__doc__rr$r&r�r'rrrrr�usr�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�UniquePtrDerefWorkerz*Implement std::unique_ptr<T>::operator*().cCstj||�dS)N)r�r)rr�rrrr�szUniquePtrDerefWorker.__init__cCs|jS)N)r�)rr%rrrr&�sz$UniquePtrDerefWorker.get_result_typecCs|jS)N)r�)rrCrrrr��szUniquePtrDerefWorker._supportscCstj||�j�S)N)r�r'r!)rr%rrrr'�szUniquePtrDerefWorker.__call__N)rrrr�rr&r�r'rrrrr��s r�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �UniquePtrSubscriptWorkerz1Implement std::unique_ptr<T>::operator[](size_t).cCstj||�dS)N)r�r)rr�rrrr�sz!UniquePtrSubscriptWorker.__init__cCst�S)N)r)rrrrr$�sz&UniquePtrSubscriptWorker.get_arg_typescCs|jS)N)r�)rr%r/rrrr&�sz(UniquePtrSubscriptWorker.get_result_typecCs|jS)N)r�)rrCrrrr��sz"UniquePtrSubscriptWorker._supportscCstj||�|S)N)r�r')rr%r/rrrr'�sz!UniquePtrSubscriptWorker.__call__N) rrrr�rr$r&r�r'rrrrr��sr�c@seZdZdd�Zdd�ZdS)�UniquePtrMethodsMatchercsVtjjj�td�tdt�tdt�tdt�tdt�d��_ �fdd��j D��_ dS) N� unique_ptrr?z operator->z operator*z operator[])r?z operator->z operator*z operator[]csg|]}�j|�qSr)r8)r9r:)rrrr;�sz4UniquePtrMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rr�r�r�r8r>)rr)rrr�s z UniquePtrMethodsMatcher.__init__cCsPt|d�sdS|jj|�}|dks*|jr.dS|j|jd��}|j|�rL|SdS)Nr�r)rr8r?r@rrAr�)rrBrCrD�workerrrrr �s zUniquePtrMethodsMatcher.matchN)rrrrr rrrrr��sr�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �SharedPtrGetWorkerzT Implements std::shared_ptr<T>::get() and std::shared_ptr<T>::operator->(). cCs*|jtjk|_|jr |j�|_n||_dS)N)rwrr�r�r�r�)rr�rrrr�szSharedPtrGetWorker.__init__cCsdS)Nr)rrrrr$�sz SharedPtrGetWorker.get_arg_typescCs |jj�S)N)r�r )rr%rrrr&�sz"SharedPtrGetWorker.get_result_typecCs|dkp|jS)Nr?)r�)rrCrrrr��szSharedPtrGetWorker._supportscCs|dS)NZ_M_ptrr)rr%rrrr'�szSharedPtrGetWorker.__call__N) rrrr�rr$r&r�r'rrrrr��sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�SharedPtrDerefWorkerz*Implement std::shared_ptr<T>::operator*().cCstj||�dS)N)r�r)rr�rrrr�szSharedPtrDerefWorker.__init__cCs|jS)N)r�)rr%rrrr&�sz$SharedPtrDerefWorker.get_result_typecCs|jS)N)r�)rrCrrrr�szSharedPtrDerefWorker._supportscCstj||�j�S)N)r�r'r!)rr%rrrr'szSharedPtrDerefWorker.__call__N)rrrr�rr&r�r'rrrrr��s r�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �SharedPtrSubscriptWorkerz1Implement std::shared_ptr<T>::operator[](size_t).cCstj||�dS)N)r�r)rr�rrrrsz!SharedPtrSubscriptWorker.__init__cCst�S)N)r)rrrrr$sz&SharedPtrSubscriptWorker.get_arg_typescCs|jS)N)r�)rr%r/rrrr&sz(SharedPtrSubscriptWorker.get_result_typecCs|jS)N)r�)rrCrrrr�sz"SharedPtrSubscriptWorker._supportscCsZtjdt|j��}|rJ|t|jd��krJtd|jt|�t|jd��f��tj||�|S)Nz.*\[(\d+)]$r-z.shared_ptr<%s> index "%d" should not be >= %d.) rr rir�r)�groupr0r�r')rr%r/r:rrrr's z!SharedPtrSubscriptWorker.__call__N) rrrr�rr$r&r�r'rrrrr� sr�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �SharedPtrUseCountWorkerz*Implement std::shared_ptr<T>::use_count().cCsdS)Nr)rr�rrrr%sz SharedPtrUseCountWorker.__init__cCsdS)Nr)rrrrr$(sz%SharedPtrUseCountWorker.get_arg_typescCs tjd�S)NZlong)rr)rr%rrrr&+sz'SharedPtrUseCountWorker.get_result_typecCsdS)NTr)rrCrrrr�.sz!SharedPtrUseCountWorker._supportscCs|dd}|r|dSdS)NZ_M_refcountZ_M_piZ_M_use_countrr)rr%Z refcountsrrrr'1sz SharedPtrUseCountWorker.__call__N) rrrr�rr$r&r�r'rrrrr�"sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �SharedPtrUniqueWorkerz'Implement std::shared_ptr<T>::unique().cCstj||�dS)N)r�r)rr�rrrr9szSharedPtrUniqueWorker.__init__cCs tjd�S)Nr)rr)rr%rrrr&<sz%SharedPtrUniqueWorker.get_result_typecCstj||�dkS)Nr-)r�r')rr%rrrr'?szSharedPtrUniqueWorker.__call__N)rrrr�rr&r'rrrrr�6sr�c@seZdZdd�Zdd�ZdS)�SharedPtrMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt�tdt �tdt �d��_�fd d ��jD��_dS)N� shared_ptrr?z operator->z operator*z operator[]� use_count�unique)r?z operator->z operator*z operator[]r�r�csg|]}�j|�qSr)r8)r9r:)rrrr;Osz4SharedPtrMethodsMatcher.__init__.<locals>.<listcomp>) rrr<rr=rr�r�r�r�r�r8r>)rr)rrrDs z SharedPtrMethodsMatcher.__init__cCsPt|d�sdS|jj|�}|dks*|jr.dS|j|jd��}|j|�rL|SdS)Nr�r)rr8r?r@rrAr�)rrBrCrDr�rrrr Qs zSharedPtrMethodsMatcher.matchN)rrrrr rrrrr�Cs r�cCstjj|t��tjj|t��tjj|t��tjj|t��tjj|t��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|t ��tjj|t ��dS) N�set�mapZmultisetZmultimapZ unordered_setZ unordered_mapZunordered_multisetZunordered_multimap)rrZregister_xmethod_matcherr2rgr[rrr�r�r�r�)Zlocusrrr�register_libstdcxx_xmethods]s.r�)>rZgdb.xmethodrr=rrrrrrrZ XMethodWorkerrr#r(r*r,r.r1r<r2rErRrSrTrUrXrZr[r]r`rcrgrjrnrorprqrrrtr{r|r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>sr * PK���\��e��0libstdcxx/v6/__pycache__/xmethods.cpython-36.pycnu�[���3 ���hq�@s�ddlZddlZddlZdZdd�Zdd�ZdZdd �ZGd d�dejj �Z Gdd �d ejj�ZGdd�de�Z Gdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dejj�ZGdd�dejj�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�ZGd*d+�d+ejj�ZGd,d-�d-ejj�ZGd.d/�d/e�ZGd0d1�d1e�ZGd2d3�d3ejj�Z Gd4d5�d5ejj�Z!Gd6d7�d7e!�Z"Gd8d9�d9e!�Z#Gd:d;�d;e!�Z$Gd<d=�d=e!�Z%Gd>d?�d?ejj�Z&Gd@dA�dAejj�Z'GdBdC�dCe'�Z(GdDdE�dEe'�Z)GdFdG�dGe'�Z*GdHdI�dIe'�Z+GdJdK�dKe'�Z,GdLdM�dMe'�Z-GdNdO�dOejj�Z.GdPdQ�dQejj�Z/GdRdS�dSe/�Z0GdTdU�dUe/�Z1GdVdW�dWejj�Z2GdXdY�dYejj�Z3GdZd[�d[e3�Z4Gd\d]�d]e3�Z5Gd^d_�d_ejj�Z6Gd`da�daejj�Z7Gdbdc�dce7�Z8Gddde�dee7�Z9Gdfdg�dgejj�Z:Gdhdi�die:�Z;Gdjdk�dkejj�Z<dldm�Z=dS)n�Nzlibstdc++::cCs tjd�S)N�bool)�gdb�lookup_type�rr�0/usr/share/gcc-8/python/libstdcxx/v6/xmethods.py� get_bool_typesrcCs tjd�S)Nzstd::size_t)rrrrrr�get_std_size_typesrz__8::cCs2t|tj�r|j}dt|f}tjd||�dk S)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::(__\d::)?%s<.*>$N)� isinstancerZType�tag�_versioned_namespace�re�match)�xZ template_namerrr�is_specialization_of!src@seZdZdd�ZdS)�LibStdCxxXMethodcCstjjj||�||_dS)N)r�xmethod�XMethod�__init__�worker_class)�self�namerrrrr.szLibStdCxxXMethod.__init__N)�__name__� __module__�__qualname__rrrrrr-src@seZdZdd�Zdd�ZdS)�ArrayWorkerBasecCs||_||_dS)N)� _val_type�_size)r�val_type�sizerrrr6szArrayWorkerBase.__init__cCstjd�}|j|jj��j�S)Nz (void *) 0)rZparse_and_eval�castr�pointer�dereference)rZnullptrrrr� null_value:s zArrayWorkerBase.null_valueN)rrrrr"rrrrr5src@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArraySizeWorkercCstj|||�dS)N)rr)rrrrrrr@szArraySizeWorker.__init__cCsdS)Nr)rrrr� get_arg_typesCszArraySizeWorker.get_arg_typescCst�S)N)r)r�objrrr�get_result_typeFszArraySizeWorker.get_result_typecCs|jS)N)r)rr%rrr�__call__IszArraySizeWorker.__call__N)rrrrr$r&r'rrrrr#?sr#c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArrayEmptyWorkercCstj|||�dS)N)rr)rrrrrrrNszArrayEmptyWorker.__init__cCsdS)Nr)rrrrr$QszArrayEmptyWorker.get_arg_typescCst�S)N)r)rr%rrrr&Tsz ArrayEmptyWorker.get_result_typecCst|j�dkS)Nr)�intr)rr%rrrr'WszArrayEmptyWorker.__call__N)rrrrr$r&r'rrrrr(Msr(c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArrayFrontWorkercCstj|||�dS)N)rr)rrrrrrr\szArrayFrontWorker.__init__cCsdS)Nr)rrrrr$_szArrayFrontWorker.get_arg_typescCs|jS)N)r)rr%rrrr&bsz ArrayFrontWorker.get_result_typecCs&t|j�dkr|ddS|j�SdS)Nr�_M_elems)r)rr")rr%rrrr'eszArrayFrontWorker.__call__N)rrrrr$r&r'rrrrr*[sr*c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArrayBackWorkercCstj|||�dS)N)rr)rrrrrrrmszArrayBackWorker.__init__cCsdS)Nr)rrrrr$pszArrayBackWorker.get_arg_typescCs|jS)N)r)rr%rrrr&sszArrayBackWorker.get_result_typecCs,t|j�dkr |d|jdS|j�SdS)Nrr+�)r)rr")rr%rrrr'vszArrayBackWorker.__call__N)rrrrr$r&r'rrrrr,lsr,c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) � ArrayAtWorkercCstj|||�dS)N)rr)rrrrrrr~szArrayAtWorker.__init__cCst�S)N)r)rrrrr$�szArrayAtWorker.get_arg_typescCs|jS)N)r)rr%�indexrrrr&�szArrayAtWorker.get_result_typecCs4t|�t|j�kr(tdt|�|jf��|d|S)Nz%Array index "%d" should not be >= %d.r+)r)r� IndexError)rr%r/rrrr'�szArrayAtWorker.__call__N)rrrrr$r&r'rrrrr.}sr.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd S) �ArraySubscriptWorkercCstj|||�dS)N)rr)rrrrrrr�szArraySubscriptWorker.__init__cCst�S)N)r)rrrrr$�sz"ArraySubscriptWorker.get_arg_typescCs|jS)N)r)rr%r/rrrr&�sz$ArraySubscriptWorker.get_result_typecCs&t|j�dkr|d|S|j�SdS)Nrr+)r)rr")rr%r/rrrr'�szArraySubscriptWorker.__call__N)rrrrr$r&r'rrrrr1�sr1c@seZdZdd�Zdd�ZdS)�ArrayMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt �tdt �tdt�d��_�fd d ��jD��_ dS)N�arrayr�empty�front�back�atz operator[])rr4r5r6r7z operator[]csg|]}�j|�qSr)�_method_dict)�.0�m)rrr� <listcomp>�sz0ArrayMethodsMatcher.__init__.<locals>.<listcomp>)rr�XMethodMatcherr�matcher_name_prefixrr#r(r*r,r.r1r8�methods)rr)rrr�s zArrayMethodsMatcher.__init__c Cs^t|d�sdS|jj|�}|dks*|jr.dSy|jd�}|jd�}Wn dS|j||�S)Nr3rr-)rr8�get�enabled�template_argumentr)r� class_type�method_name�methodZ value_typerrrrr �s zArrayMethodsMatcher.matchN)rrrrr rrrrr2�s r2c@s$eZdZdd�Zdd�Zdd�ZdS)�DequeWorkerBasecCs||_d|jpd|_dS)Nir-)r�sizeof�_bufsize)rrrrrr�szDequeWorkerBase.__init__cCsf|dd}|dd}|d|dkr,dS|j|d|dd|d|d|d |dS) N�_M_impl�_M_start� _M_finish�_M_curr�_M_noder-�_M_first�_M_last)rG)rr%�start�finishrrrr�s zDequeWorkerBase.sizecCs`|dd}|d|d}||kr0|d|S||}|ddt|�|j}|||jS)NrHrIrNrKrLr-)r)rG)rr%�idxrOZfirst_node_sizeZ index_noderrrr/�szDequeWorkerBase.indexN)rrrrrr/rrrrrE�s rEc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeEmptyWorkercCsdS)Nr)rrrrr$�szDequeEmptyWorker.get_arg_typescCst�S)N)r)rr%rrrr&�sz DequeEmptyWorker.get_result_typecCs |ddd|dddkS)NrHrIrKrJr)rr%rrrr'�szDequeEmptyWorker.__call__N)rrrr$r&r'rrrrrR�srRc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeSizeWorkercCsdS)Nr)rrrrr$�szDequeSizeWorker.get_arg_typescCst�S)N)r)rr%rrrr&�szDequeSizeWorker.get_result_typecCs |j|�S)N)r)rr%rrrr'�szDequeSizeWorker.__call__N)rrrr$r&r'rrrrrS�srSc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeFrontWorkercCsdS)Nr)rrrrr$�szDequeFrontWorker.get_arg_typescCs|jS)N)r)rr%rrrr&�sz DequeFrontWorker.get_result_typecCs|ddddS)NrHrIrKrr)rr%rrrr'�szDequeFrontWorker.__call__N)rrrr$r&r'rrrrrT�srTc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeBackWorkercCsdS)Nr)rrrrr$�szDequeBackWorker.get_arg_typescCs|jS)N)r)rr%rrrr&�szDequeBackWorker.get_result_typecCs^|ddd|dddkrF|dddd}|d|jdS|ddddSdS) NrHrJrKrMrLr-r���)rG)rr%� prev_noderrrr's zDequeBackWorker.__call__N)rrrr$r&r'rrrrrU�srUc@s$eZdZdd�Zdd�Zdd�ZdS)�DequeSubscriptWorkercCst�S)N)r)rrrrr$ sz"DequeSubscriptWorker.get_arg_typescCs|jS)N)r)rr%� subscriptrrrr& sz$DequeSubscriptWorker.get_result_typecCs|j||�S)N)r/)rr%rYrrrr'szDequeSubscriptWorker.__call__N)rrrr$r&r'rrrrrX srXc@s$eZdZdd�Zdd�Zdd�ZdS)� DequeAtWorkercCst�S)N)r)rrrrr$szDequeAtWorker.get_arg_typescCs|jS)N)r)rr%r/rrrr&szDequeAtWorker.get_result_typecCs@t|j|��}t|�|kr0tdt|�|f��n|j||�SdS)Nz%Deque index "%d" should not be >= %d.)r)rr0r/)rr%r/Z deque_sizerrrr's zDequeAtWorker.__call__N)rrrr$r&r'rrrrrZsrZc@seZdZdd�Zdd�ZdS)�DequeMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt �tdt �tdt�d��_�fd d ��jD��_ dS)N�dequer4rr5r6z operator[]r7)r4rr5r6z operator[]r7csg|]}�j|�qSr)r8)r9r:)rrrr;0sz0DequeMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rrRrSrTrUrXrZr8r>)rr)rrr%s zDequeMethodsMatcher.__init__cCs>t|d�sdS|jj|�}|dks*|jr.dS|j|jd��S)Nr\r)rr8r?r@rrA)rrBrCrDrrrr 2s zDequeMethodsMatcher.matchN)rrrrr rrrrr[$s r[c@seZdZdd�Zdd�ZdS)�ForwardListWorkerBasecCs||_||_dS)N)r� _node_type)rr� node_typerrrr>szForwardListWorkerBase.__init__cCsdS)Nr)rrrrr$Bsz#ForwardListWorkerBase.get_arg_typesN)rrrrr$rrrrr]=sr]c@seZdZdd�Zdd�ZdS)�ForwardListEmptyWorkercCst�S)N)r)rr%rrrr&Gsz&ForwardListEmptyWorker.get_result_typecCs|ddddkS)NrH�_M_head�_M_nextrr)rr%rrrr'JszForwardListEmptyWorker.__call__N)rrrr&r'rrrrr`Fsr`c@seZdZdd�Zdd�ZdS)�ForwardListFrontWorkercCs|jS)N)r)rr%rrrr&Osz&ForwardListFrontWorker.get_result_typecCs:|dddj|j�}|ddj}|j|jj��j�S)NrHrarb� _M_storage)rr^�addressrr r!)rr%�nodeZval_addressrrrr'RszForwardListFrontWorker.__call__N)rrrr&r'rrrrrcNsrcc@seZdZdd�Zdd�ZdS)�ForwardListMethodsMatchercsJtd}tjjj�|�tdt�tdt�d��_�fdd��jD��_ dS)N�forward_listr4r5)r4r5csg|]}�j|�qSr)r8)r9r:)rrrr;`sz6ForwardListMethodsMatcher.__init__.<locals>.<listcomp>) r=rrr<rrr`rcr8r>)rZmatcher_namer)rrrYs z"ForwardListMethodsMatcher.__init__cCsZt|d�sdS|jj|�}|dks*|jr.dS|jd�}tjt|�d�j�}|j ||�S)Nrhrz::_Node) rr8r?r@rArr�strr r)rrBrCrDrr_rrrr bs zForwardListMethodsMatcher.matchN)rrrrr rrrrrgXs rgc@s$eZdZdd�Zdd�Zdd�ZdS)�ListWorkerBasecCs||_||_dS)N)rr^)rrr_rrrrpszListWorkerBase.__init__cCsdS)Nr)rrrrr$tszListWorkerBase.get_arg_typescCsB|j�}|jj�djdkr$|dS|dj}|j|jj��j�S)Nr-Z_M_datard)r!�type�fieldsrrerrr )rrfZaddrrrr�get_value_from_nodews z"ListWorkerBase.get_value_from_nodeN)rrrrr$rmrrrrrjosrjc@seZdZdd�Zdd�ZdS)�ListEmptyWorkercCst�S)N)r)rr%rrrr&�szListEmptyWorker.get_result_typecCs&|dd}|d|jkrdSdSdS)NrHrLrbTF)re)rr%Z base_noderrrr'�szListEmptyWorker.__call__N)rrrr&r'rrrrrn�srnc@seZdZdd�Zdd�ZdS)�ListSizeWorkercCst�S)N)r)rr%rrrr&�szListSizeWorker.get_result_typecCsD|ddd}|ddj}d}x||kr>|d}|d7}q$W|S)NrHrLrbrr-)re)rr%Z begin_nodeZend_noderrrrr'�s zListSizeWorker.__call__N)rrrr&r'rrrrro�sroc@seZdZdd�Zdd�ZdS)�ListFrontWorkercCs|jS)N)r)rr%rrrr&�szListFrontWorker.get_result_typecCs"|dddj|j�}|j|�S)NrHrLrb)rr^rm)rr%rfrrrr'�szListFrontWorker.__call__N)rrrr&r'rrrrrp�srpc@seZdZdd�Zdd�ZdS)�ListBackWorkercCs|jS)N)r)rr%rrrr&�szListBackWorker.get_result_typecCs"|dddj|j�}|j|�S)NrHrLZ_M_prev)rr^rm)rr%rWrrrr'�szListBackWorker.__call__N)rrrr&r'rrrrrq�srqc@seZdZdd�Zdd�ZdS)�ListMethodsMatchercsVtjjj�td�tdt�tdt�tdt�tdt �d��_ �fdd��j D��_dS) N�listr4rr5r6)r4rr5r6csg|]}�j|�qSr)r8)r9r:)rrrr;�sz/ListMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rrnrorprqr8r>)rr)rrr�s zListMethodsMatcher.__init__cCsZt|d�sdS|jj|�}|dks*|jr.dS|jd�}tjt|�d�j�}|j ||�S)Nz(__cxx11::)?listrz::_Node) rr8r?r@rArrrir r)rrBrCrDrr_rrrr �s zListMethodsMatcher.matchN)rrrrr rrrrrr�srrc@s$eZdZdd�Zdd�Zdd�ZdS)�VectorWorkerBasecCs ||_dS)N)r)rrrrrr�szVectorWorkerBase.__init__cCsz|jjtjkr^|ddd}|ddd}|ddd}|j�jjd}||||S|dd|ddSdS)NrHrI�_M_prJZ _M_offset�)r�coder�TYPE_CODE_BOOLr!rkrF)rr%rOrPZ finish_offset�bit_sizerrrr�szVectorWorkerBase.sizecCsj|jjtjkrV|ddd}|j�jjd}|||}||}|j�d|>@dkS|dd|SdS)NrHrIrurvr-r)rrwrrxr!rkrF)rr%r/rOryZvalp�offsetrrrr?�szVectorWorkerBase.getN)rrrrrr?rrrrrt�s rtc@s$eZdZdd�Zdd�Zdd�ZdS)�VectorEmptyWorkercCsdS)Nr)rrrrr$�szVectorEmptyWorker.get_arg_typescCst�S)N)r)rr%rrrr&�sz!VectorEmptyWorker.get_result_typecCst|j|��dkS)Nr)r)r)rr%rrrr'�szVectorEmptyWorker.__call__N)rrrr$r&r'rrrrr{�sr{c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorSizeWorkercCsdS)Nr)rrrrr$�szVectorSizeWorker.get_arg_typescCst�S)N)r)rr%rrrr&�sz VectorSizeWorker.get_result_typecCs |j|�S)N)r)rr%rrrr'�szVectorSizeWorker.__call__N)rrrr$r&r'rrrrr|�sr|c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorFrontWorkercCsdS)Nr)rrrrr$�szVectorFrontWorker.get_arg_typescCs|jS)N)r)rr%rrrr&�sz!VectorFrontWorker.get_result_typecCs|j|d�S)Nr)r?)rr%rrrr'�szVectorFrontWorker.__call__N)rrrr$r&r'rrrrr}�sr}c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorBackWorkercCsdS)Nr)rrrrr$szVectorBackWorker.get_arg_typescCs|jS)N)r)rr%rrrr&sz VectorBackWorker.get_result_typecCs|j|t|j|��d�S)Nr-)r?r)r)rr%rrrr'szVectorBackWorker.__call__N)rrrr$r&r'rrrrr~sr~c@s$eZdZdd�Zdd�Zdd�ZdS)�VectorAtWorkercCst�S)N)r)rrrrr$szVectorAtWorker.get_arg_typescCs|jS)N)r)rr%r/rrrr&szVectorAtWorker.get_result_typecCs>t|j|��}t|�|kr.tdt|�|f��|j|t|��S)Nz&Vector index "%d" should not be >= %d.)r)rr0r?)rr%r/rrrrr's zVectorAtWorker.__call__N)rrrr$r&r'rrrrrsrc@s$eZdZdd�Zdd�Zdd�ZdS)�VectorSubscriptWorkercCst�S)N)r)rrrrr$sz#VectorSubscriptWorker.get_arg_typescCs|jS)N)r)rr%rYrrrr&sz%VectorSubscriptWorker.get_result_typecCs|j|t|��S)N)r?r))rr%rYrrrr'!szVectorSubscriptWorker.__call__N)rrrr$r&r'rrrrr�sr�c@seZdZdd�Zdd�ZdS)�VectorMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt �tdt �tdt�d��_�fd d ��jD��_ dS)N�vectorrr4r5r6r7z operator[])rr4r5r6r7z operator[]csg|]}�j|�qSr)r8)r9r:)rrrr;2sz1VectorMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rr|r{r}r~rr�r8r>)rr)rrr&s zVectorMethodsMatcher.__init__cCs>t|d�sdS|jj|�}|dks*|jr.dS|j|jd��S)Nr�r)rr8r?r@rrA)rrBrCrDrrrr 4s zVectorMethodsMatcher.matchN)rrrrr rrrrr�%sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�AssociativeContainerWorkerBasecCs ||_dS)N)� _unordered)r� unorderedrrrr@sz'AssociativeContainerWorkerBase.__init__cCs&|jr|ddS|dddSdS)NZ_M_hZ_M_element_count�_M_trHZ _M_node_count)r�)rr%rrr� node_countCsz)AssociativeContainerWorkerBase.node_countcCsdS)Nr)rrrrr$Isz,AssociativeContainerWorkerBase.get_arg_typesN)rrrrr�r$rrrrr�?sr�c@seZdZdd�Zdd�ZdS)�AssociativeContainerEmptyWorkercCst�S)N)r)rr%rrrr&Nsz/AssociativeContainerEmptyWorker.get_result_typecCst|j|��dkS)Nr)r)r�)rr%rrrr'Qsz(AssociativeContainerEmptyWorker.__call__N)rrrr&r'rrrrr�Msr�c@seZdZdd�Zdd�ZdS)�AssociativeContainerSizeWorkercCst�S)N)r)rr%rrrr&Vsz.AssociativeContainerSizeWorker.get_result_typecCs |j|�S)N)r�)rr%rrrr'Ysz'AssociativeContainerSizeWorker.__call__N)rrrr&r'rrrrr�Usr�c@seZdZdd�Zdd�ZdS)�"AssociativeContainerMethodsMatchercsLtjjj�t|�|�_tdt�tdt�d��_ �fdd��j D��_ dS)Nrr4)rr4csg|]}�j|�qSr)r8)r9r:)rrrr;gsz?AssociativeContainerMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=�_namerr�r�r8r>)rrr)rrr^s z+AssociativeContainerMethodsMatcher.__init__cCsDt||j�sdS|jj|�}|dks,|jr0dSd|jk}|j|�S)Nr�)rr�r8r?r@r)rrBrCrDr�rrrr is z(AssociativeContainerMethodsMatcher.matchN)rrrrr rrrrr�]sr�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �UniquePtrGetWorkerzS Implement std::unique_ptr<T>::get() and std::unique_ptr<T>::operator->(). cCs*|jtjk|_|jr |j�|_n||_dS)N)rwr�TYPE_CODE_ARRAY� _is_array�target� _elem_type)r� elem_typerrrrzszUniquePtrGetWorker.__init__cCsdS)Nr)rrrrr$�sz UniquePtrGetWorker.get_arg_typescCs |jj�S)N)r�r )rr%rrrr&�sz"UniquePtrGetWorker.get_result_typecCs|dkp|jS)Nr?)r�)rrCrrr� _supports�szUniquePtrGetWorker._supportscCs�|j�jj�djj}t|d�r.|dd}nt|d�rB|d}ndS|jj�dj}|j�dj}|j�d}|jdkr�|j|�dS|jr�|j|j�SdSdS)Nrz__uniq_ptr_(data|impl)r��tupler-Z_M_head_impl)r!rkrlr rrrZ is_base_class)rr%Z impl_typeZtuple_memberZtuple_impl_typeZtuple_head_typeZ head_fieldrrrr'�s zUniquePtrGetWorker.__call__N) rrr�__doc__rr$r&r�r'rrrrr�usr�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�UniquePtrDerefWorkerz*Implement std::unique_ptr<T>::operator*().cCstj||�dS)N)r�r)rr�rrrr�szUniquePtrDerefWorker.__init__cCs|jS)N)r�)rr%rrrr&�sz$UniquePtrDerefWorker.get_result_typecCs|jS)N)r�)rrCrrrr��szUniquePtrDerefWorker._supportscCstj||�j�S)N)r�r'r!)rr%rrrr'�szUniquePtrDerefWorker.__call__N)rrrr�rr&r�r'rrrrr��s r�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �UniquePtrSubscriptWorkerz1Implement std::unique_ptr<T>::operator[](size_t).cCstj||�dS)N)r�r)rr�rrrr�sz!UniquePtrSubscriptWorker.__init__cCst�S)N)r)rrrrr$�sz&UniquePtrSubscriptWorker.get_arg_typescCs|jS)N)r�)rr%r/rrrr&�sz(UniquePtrSubscriptWorker.get_result_typecCs|jS)N)r�)rrCrrrr��sz"UniquePtrSubscriptWorker._supportscCstj||�|S)N)r�r')rr%r/rrrr'�sz!UniquePtrSubscriptWorker.__call__N) rrrr�rr$r&r�r'rrrrr��sr�c@seZdZdd�Zdd�ZdS)�UniquePtrMethodsMatchercsVtjjj�td�tdt�tdt�tdt�tdt�d��_ �fdd��j D��_ dS) N� unique_ptrr?z operator->z operator*z operator[])r?z operator->z operator*z operator[]csg|]}�j|�qSr)r8)r9r:)rrrr;�sz4UniquePtrMethodsMatcher.__init__.<locals>.<listcomp>)rrr<rr=rr�r�r�r8r>)rr)rrr�s z UniquePtrMethodsMatcher.__init__cCsPt|d�sdS|jj|�}|dks*|jr.dS|j|jd��}|j|�rL|SdS)Nr�r)rr8r?r@rrAr�)rrBrCrD�workerrrrr �s zUniquePtrMethodsMatcher.matchN)rrrrr rrrrr��sr�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �SharedPtrGetWorkerzT Implements std::shared_ptr<T>::get() and std::shared_ptr<T>::operator->(). cCs*|jtjk|_|jr |j�|_n||_dS)N)rwrr�r�r�r�)rr�rrrr�szSharedPtrGetWorker.__init__cCsdS)Nr)rrrrr$�sz SharedPtrGetWorker.get_arg_typescCs |jj�S)N)r�r )rr%rrrr&�sz"SharedPtrGetWorker.get_result_typecCs|dkp|jS)Nr?)r�)rrCrrrr��szSharedPtrGetWorker._supportscCs|dS)NZ_M_ptrr)rr%rrrr'�szSharedPtrGetWorker.__call__N) rrrr�rr$r&r�r'rrrrr��sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)�SharedPtrDerefWorkerz*Implement std::shared_ptr<T>::operator*().cCstj||�dS)N)r�r)rr�rrrr�szSharedPtrDerefWorker.__init__cCs|jS)N)r�)rr%rrrr&�sz$SharedPtrDerefWorker.get_result_typecCs|jS)N)r�)rrCrrrr�szSharedPtrDerefWorker._supportscCstj||�j�S)N)r�r'r!)rr%rrrr'szSharedPtrDerefWorker.__call__N)rrrr�rr&r�r'rrrrr��s r�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �SharedPtrSubscriptWorkerz1Implement std::shared_ptr<T>::operator[](size_t).cCstj||�dS)N)r�r)rr�rrrrsz!SharedPtrSubscriptWorker.__init__cCst�S)N)r)rrrrr$sz&SharedPtrSubscriptWorker.get_arg_typescCs|jS)N)r�)rr%r/rrrr&sz(SharedPtrSubscriptWorker.get_result_typecCs|jS)N)r�)rrCrrrr�sz"SharedPtrSubscriptWorker._supportscCsZtjdt|j��}|rJ|t|jd��krJtd|jt|�t|jd��f��tj||�|S)Nz.*\[(\d+)]$r-z.shared_ptr<%s> index "%d" should not be >= %d.) rr rir�r)�groupr0r�r')rr%r/r:rrrr's z!SharedPtrSubscriptWorker.__call__N) rrrr�rr$r&r�r'rrrrr� sr�c@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d�ZdS) �SharedPtrUseCountWorkerz*Implement std::shared_ptr<T>::use_count().cCsdS)Nr)rr�rrrr%sz SharedPtrUseCountWorker.__init__cCsdS)Nr)rrrrr$(sz%SharedPtrUseCountWorker.get_arg_typescCs tjd�S)NZlong)rr)rr%rrrr&+sz'SharedPtrUseCountWorker.get_result_typecCsdS)NTr)rrCrrrr�.sz!SharedPtrUseCountWorker._supportscCs|dd}|r|dSdS)NZ_M_refcountZ_M_piZ_M_use_countrr)rr%Z refcountsrrrr'1sz SharedPtrUseCountWorker.__call__N) rrrr�rr$r&r�r'rrrrr�"sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS) �SharedPtrUniqueWorkerz'Implement std::shared_ptr<T>::unique().cCstj||�dS)N)r�r)rr�rrrr9szSharedPtrUniqueWorker.__init__cCs tjd�S)Nr)rr)rr%rrrr&<sz%SharedPtrUniqueWorker.get_result_typecCstj||�dkS)Nr-)r�r')rr%rrrr'?szSharedPtrUniqueWorker.__call__N)rrrr�rr&r'rrrrr�6sr�c@seZdZdd�Zdd�ZdS)�SharedPtrMethodsMatchercsftjjj�td�tdt�tdt�tdt�tdt�tdt �tdt �d��_�fd d ��jD��_dS)N� shared_ptrr?z operator->z operator*z operator[]� use_count�unique)r?z operator->z operator*z operator[]r�r�csg|]}�j|�qSr)r8)r9r:)rrrr;Osz4SharedPtrMethodsMatcher.__init__.<locals>.<listcomp>) rrr<rr=rr�r�r�r�r�r8r>)rr)rrrDs z SharedPtrMethodsMatcher.__init__cCsPt|d�sdS|jj|�}|dks*|jr.dS|j|jd��}|j|�rL|SdS)Nr�r)rr8r?r@rrAr�)rrBrCrDr�rrrr Qs zSharedPtrMethodsMatcher.matchN)rrrrr rrrrr�Cs r�cCstjj|t��tjj|t��tjj|t��tjj|t��tjj|t��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|td��tjj|t ��tjj|t ��dS) N�set�mapZmultisetZmultimapZ unordered_setZ unordered_mapZunordered_multisetZunordered_multimap)rrZregister_xmethod_matcherr2rgr[rrr�r�r�r�)Zlocusrrr�register_libstdcxx_xmethods]s.r�)>rZgdb.xmethodrr=rrrrrrrZ XMethodWorkerrr#r(r*r,r.r1r<r2rErRrSrTrUrXrZr[r]r`rcrgrjrnrorprqrrrtr{r|r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>sr * PK���\ܯ�}}libstdcxx/v6/__init__.pynu�[���# Copyright (C) 2014-2025 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Load the xmethods if GDB supports them. def gdb_has_xmethods(): try: import gdb.xmethod return True except ImportError: return False def register_libstdcxx_printers(obj): # Load the pretty-printers. from .printers import register_libstdcxx_printers register_libstdcxx_printers(obj) if gdb_has_xmethods(): from .xmethods import register_libstdcxx_xmethods register_libstdcxx_xmethods(obj) PK���\C�B�����libstdcxx/v6/printers.pynu�[���# Pretty-printers for libstdc++. # Copyright (C) 2008-2025 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import gdb import itertools import re import sys import errno import datetime # Python 2 + Python 3 compatibility code # Resources about compatibility: # # * <http://pythonhosted.org/six/>: Documentation of the "six" module # FIXME: The handling of e.g. std::basic_string (at least on char) # probably needs updating to work with Python 3's new string rules. # # In particular, Python 3 has a separate type (called byte) for # bytestrings, and a special b"" syntax for the byte literals; the old # str() type has been redefined to always store Unicode text. # # We probably can't do much about this until this GDB PR is addressed: # <https://sourceware.org/bugzilla/show_bug.cgi?id=17138> if sys.version_info[0] > 2: # Python 3 stuff Iterator = object # Python 3 folds these into the normal functions. imap = map izip = zip # Also, int subsumes long long = int _utc_timezone = datetime.timezone.utc else: # Python 2 stuff class Iterator: """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: <http://pythonhosted.org/six/#six.Iterator> """ def next(self): return self.__next__() # In Python 2, we still need these from itertools from itertools import imap, izip # Python 2 does not provide the datetime.UTC singleton. class UTC(datetime.tzinfo): """Concrete tzinfo class representing the UTC time zone.""" def utcoffset(self, dt): return datetime.timedelta(0) def tzname(self, dt): return "UTC" def dst(self, dt): return datetime.timedelta(0) _utc_timezone = UTC() # Try to use the new-style pretty-printing if available. _use_gdb_pp = True try: import gdb.printing except ImportError: _use_gdb_pp = False # Try to install type-printers. _use_type_printing = False try: import gdb.types if hasattr(gdb.types, 'TypePrinter'): _use_type_printing = True except ImportError: pass # Use the base class if available. if hasattr(gdb, 'ValuePrinter'): printer_base = gdb.ValuePrinter else: printer_base = object # Starting with the type ORIG, search for the member type NAME. This # handles searching upward through superclasses. This is needed to # work around http://sourceware.org/bugzilla/show_bug.cgi?id=13615. def find_type(orig, name): typ = orig.strip_typedefs() while True: # Use Type.tag to ignore cv-qualifiers. PR 67440. search = '%s::%s' % (typ.tag, name) try: return gdb.lookup_type(search) except RuntimeError: pass # The type was not found, so try the superclass. We only need # to check the first superclass, so we don't bother with # anything fancier here. fields = typ.fields() if len(fields) and fields[0].is_base_class: typ = fields[0].type else: raise ValueError("Cannot find type %s::%s" % (str(orig), name)) _versioned_namespace = '__8::' def lookup_templ_spec(templ, *args): """ Lookup template specialization templ<args...>. """ t = '{}<{}>'.format(templ, ', '.join([str(a) for a in args])) try: return gdb.lookup_type(t) except gdb.error as e: # Type not found, try again in versioned namespace. global _versioned_namespace if _versioned_namespace not in templ: t = t.replace('::', '::' + _versioned_namespace, 1) try: return gdb.lookup_type(t) except gdb.error: # If that also fails, rethrow the original exception pass raise e # Use this to find container node types instead of find_type, # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91997 for details. def lookup_node_type(nodename, containertype): """ 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<int>')) will return a gdb.Type for the type std::_List_node<int>. """ # If nodename is unqualified, assume it's in namespace std. if '::' not in nodename: nodename = 'std::' + nodename # Use either containertype's value_type or its first template argument. try: valtype = find_type(containertype, 'value_type') except: valtype = containertype.template_argument(0) valtype = valtype.strip_typedefs() try: return lookup_templ_spec(nodename, valtype) except gdb.error: # For debug mode containers the node is in std::__cxx1998. if is_member_of_namespace(nodename, 'std'): if is_member_of_namespace(containertype, 'std::__cxx1998', 'std::__debug', '__gnu_debug'): nodename = nodename.replace('::', '::__cxx1998::', 1) try: return lookup_templ_spec(nodename, valtype) except gdb.error: pass return None def is_member_of_namespace(typ, *namespaces): """ 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. """ if isinstance(typ, gdb.Type): typ = str(typ) typ = strip_versioned_namespace(typ) for namespace in namespaces: if typ.startswith(namespace + '::'): return True return False def is_specialization_of(x, template_name): """ 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. """ global _versioned_namespace if isinstance(x, gdb.Type): x = x.tag template_name = '(%s)?%s' % (_versioned_namespace, template_name) return re.match('^std::%s<.*>$' % template_name, x) is not None def strip_versioned_namespace(typename): global _versioned_namespace return typename.replace(_versioned_namespace, '') def strip_fundts_namespace(typ): """Remove "fundamentals_vN" inline namespace from qualified type name.""" pattern = r'^std::experimental::fundamentals_v\d::' repl = 'std::experimental::' if sys.version_info[0] == 2: return re.sub(pattern, repl, typ, 1) else: # Technically this needs Python 3.1 but nobody should be using 3.0 return re.sub(pattern, repl, typ, count=1) def strip_inline_namespaces(type_str): """Remove known inline namespaces from the canonical name of a type.""" type_str = strip_versioned_namespace(type_str) type_str = type_str.replace('std::__cxx11::', 'std::') expt_ns = 'std::experimental::' for lfts_ns in ('fundamentals_v1', 'fundamentals_v2'): type_str = type_str.replace(expt_ns + lfts_ns + '::', expt_ns) fs_ns = expt_ns + 'filesystem::' type_str = type_str.replace(fs_ns + 'v1::', fs_ns) return type_str def get_template_arg_list(type_obj): """Return a type's template arguments as a list.""" n = 0 template_args = [] while True: try: template_args.append(type_obj.template_argument(n)) except: return template_args n += 1 class SmartPtrIterator(Iterator): """An iterator for smart pointer types with a single 'child' value.""" def __init__(self, val): self._val = val def __iter__(self): return self def __next__(self): if self._val is None: raise StopIteration self._val, val = None, self._val return ('get()', val) class SharedPointerPrinter(printer_base): """ Print a shared_ptr, weak_ptr, atomic<shared_ptr>, or atomic<weak_ptr>. """ def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val self._pointer = val['_M_ptr'] def children(self): return SmartPtrIterator(self._pointer) # Return the _Sp_counted_base<>* that holds the refcounts. def _get_refcounts(self): if self._typename == 'std::atomic': # A tagged pointer is stored as uintptr_t. ptr_val = self._val['_M_refcount']['_M_val']['_M_i'] ptr_val = ptr_val - (ptr_val % 2) # clear lock bit ptr_type = find_type(self._val['_M_refcount'].type, 'pointer') return ptr_val.cast(ptr_type) return self._val['_M_refcount']['_M_pi'] def to_string(self): state = 'empty' refcounts = self._get_refcounts() targ = self._val.type.template_argument(0) targ = strip_versioned_namespace(str(targ)) if refcounts != 0: usecount = refcounts['_M_use_count'] weakcount = refcounts['_M_weak_count'] if usecount == 0: state = 'expired, weak count %d' % weakcount else: state = 'use count %d, weak count %d' % ( usecount, weakcount - 1) return '%s<%s> (%s)' % (self._typename, targ, state) def _tuple_impl_get(val): """Return the tuple element stored in a _Tuple_impl<N, T> base class.""" bases = val.type.fields() if not bases[-1].is_base_class: raise ValueError( "Unsupported implementation for std::tuple: %s" % str(val.type)) # Get the _Head_base<N, T> base class: head_base = val.cast(bases[-1].type) fields = head_base.type.fields() if len(fields) == 0: raise ValueError( "Unsupported implementation for std::tuple: %s" % str(val.type)) if fields[0].name == '_M_head_impl': # The tuple element is the _Head_base::_M_head_impl data member. return head_base['_M_head_impl'] elif fields[0].is_base_class: # The tuple element is an empty base class of _Head_base. # Cast to that empty base class. return head_base.cast(fields[0].type) else: raise ValueError( "Unsupported implementation for std::tuple: %s" % str(val.type)) def tuple_get(n, val): """Return the result of std::get<n>(val) on a std::tuple.""" tuple_size = len(get_template_arg_list(val.type)) if n > tuple_size: raise ValueError("Out of range index for std::get<N> on std::tuple") # Get the first _Tuple_impl<0, T...> base class: node = val.cast(val.type.fields()[0].type) while n > 0: # Descend through the base classes until the Nth one. node = node.cast(node.type.fields()[0].type) n -= 1 return _tuple_impl_get(node) def unique_ptr_get(val): """Return the result of val.get() on a std::unique_ptr.""" # std::unique_ptr<T, D> contains a std::tuple<D::pointer, D>, # either as a direct data member _M_t (the old implementation) # or within a data member of type __uniq_ptr_data. impl_type = val.type.fields()[0].type.strip_typedefs() # Check for new implementations first: if is_specialization_of(impl_type, '__uniq_ptr_data') \ or is_specialization_of(impl_type, '__uniq_ptr_impl'): tuple_member = val['_M_t']['_M_t'] elif is_specialization_of(impl_type, 'tuple'): tuple_member = val['_M_t'] else: raise ValueError( "Unsupported implementation for unique_ptr: %s" % str(impl_type)) return tuple_get(0, tuple_member) class UniquePointerPrinter(printer_base): """Print a unique_ptr.""" def __init__(self, typename, val): self._val = val def children(self): return SmartPtrIterator(unique_ptr_get(self._val)) def to_string(self): t = self._val.type.template_argument(0) return 'std::unique_ptr<{}>'.format(str(t)) def get_value_from_aligned_membuf(buf, valtype): """Return the value held in a __gnu_cxx::__aligned_membuf.""" return buf['_M_storage'].address.cast(valtype.pointer()).dereference() def get_value_from_list_node(node): """Return the value held in an _List_node<_Val>.""" try: member = node.type.fields()[1].name if member == '_M_data': # C++03 implementation, node contains the value as a member return node['_M_data'] elif member == '_M_storage': # C++11 implementation, node stores value in __aligned_membuf valtype = node.type.template_argument(0) return get_value_from_aligned_membuf(node['_M_storage'], valtype) except: pass raise ValueError("Unsupported implementation for %s" % str(node.type)) class StdListPrinter(printer_base): """Print a std::list.""" class _iterator(Iterator): def __init__(self, nodetype, head): self._nodetype = nodetype self._base = head['_M_next'] self._head = head.address self._count = 0 def __iter__(self): return self def __next__(self): if self._base == self._head: raise StopIteration elt = self._base.cast(self._nodetype).dereference() self._base = elt['_M_next'] count = self._count self._count = self._count + 1 val = get_value_from_list_node(elt) return ('[%d]' % count, val) def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def children(self): nodetype = lookup_node_type('_List_node', self._val.type).pointer() return self._iterator(nodetype, self._val['_M_impl']['_M_node']) def to_string(self): headnode = self._val['_M_impl']['_M_node'] if headnode['_M_next'] == headnode.address: return 'empty %s' % (self._typename) return '%s' % (self._typename) class NodeIteratorPrinter(printer_base): def __init__(self, typename, val, contname, nodename): self._val = val self._typename = typename self._contname = contname self._nodetype = lookup_node_type(nodename, val.type) def to_string(self): if not self._val['_M_node']: return 'non-dereferenceable iterator for std::%s' % (self._contname) node = self._val['_M_node'].cast( self._nodetype.pointer()).dereference() return str(get_value_from_list_node(node)) class StdListIteratorPrinter(NodeIteratorPrinter): """Print std::list::iterator.""" def __init__(self, typename, val): NodeIteratorPrinter.__init__(self, typename, val, 'list', '_List_node') class StdFwdListIteratorPrinter(NodeIteratorPrinter): """Print std::forward_list::iterator.""" def __init__(self, typename, val): NodeIteratorPrinter.__init__(self, typename, val, 'forward_list', '_Fwd_list_node') class StdSlistPrinter(printer_base): """Print a __gnu_cxx::slist.""" class _iterator(Iterator): def __init__(self, nodetype, head): self._nodetype = nodetype self._base = head['_M_head']['_M_next'] self._count = 0 def __iter__(self): return self def __next__(self): if self._base == 0: raise StopIteration elt = self._base.cast(self._nodetype).dereference() self._base = elt['_M_next'] count = self._count self._count = self._count + 1 return ('[%d]' % count, elt['_M_data']) def __init__(self, typename, val): self._val = val def children(self): nodetype = lookup_node_type('__gnu_cxx::_Slist_node', self._val.type) return self._iterator(nodetype.pointer(), self._val) def to_string(self): if self._val['_M_head']['_M_next'] == 0: return 'empty __gnu_cxx::slist' return '__gnu_cxx::slist' class StdSlistIteratorPrinter(printer_base): """Print __gnu_cxx::slist::iterator.""" def __init__(self, typename, val): self._val = val def to_string(self): if not self._val['_M_node']: return 'non-dereferenceable iterator for __gnu_cxx::slist' nodetype = lookup_node_type( '__gnu_cxx::_Slist_node', self._val.type).pointer() return str(self._val['_M_node'].cast(nodetype).dereference()['_M_data']) class StdVectorPrinter(printer_base): """Print a std::vector.""" class _iterator(Iterator): def __init__(self, start, finish, bitvec): self._bitvec = bitvec if bitvec: self._item = start['_M_p'] self._so = 0 self._finish = finish['_M_p'] self._fo = finish['_M_offset'] itype = self._item.dereference().type self._isize = 8 * itype.sizeof else: self._item = start self._finish = finish self._count = 0 def __iter__(self): return self def __next__(self): count = self._count self._count = self._count + 1 if self._bitvec: if self._item == self._finish and self._so >= self._fo: raise StopIteration elt = bool(self._item.dereference() & (1 << self._so)) self._so = self._so + 1 if self._so >= self._isize: self._item = self._item + 1 self._so = 0 return ('[%d]' % count, elt) else: if self._item == self._finish: raise StopIteration elt = self._item.dereference() self._item = self._item + 1 return ('[%d]' % count, elt) def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val self._is_bool = val.type.template_argument( 0).code == gdb.TYPE_CODE_BOOL def children(self): return self._iterator(self._val['_M_impl']['_M_start'], self._val['_M_impl']['_M_finish'], self._is_bool) def to_string(self): start = self._val['_M_impl']['_M_start'] finish = self._val['_M_impl']['_M_finish'] end = self._val['_M_impl']['_M_end_of_storage'] if self._is_bool: start = self._val['_M_impl']['_M_start']['_M_p'] finish = self._val['_M_impl']['_M_finish']['_M_p'] fo = self._val['_M_impl']['_M_finish']['_M_offset'] itype = start.dereference().type bl = 8 * itype.sizeof length = bl * (finish - start) + fo capacity = bl * (end - start) return ('%s<bool> of length %d, capacity %d' % (self._typename, int(length), int(capacity))) else: return ('%s of length %d, capacity %d' % (self._typename, int(finish - start), int(end - start))) def display_hint(self): return 'array' class StdVectorIteratorPrinter(printer_base): """Print std::vector::iterator.""" def __init__(self, typename, val): self._val = val def to_string(self): if not self._val['_M_current']: return 'non-dereferenceable iterator for std::vector' return str(self._val['_M_current'].dereference()) class StdBitIteratorPrinter(printer_base): """Print std::vector<bool>'s _Bit_iterator and _Bit_const_iterator.""" def __init__(self, typename, val): self._val = val def to_string(self): if not self._val['_M_p']: return 'non-dereferenceable iterator for std::vector<bool>' return bool(self._val['_M_p'].dereference() & (1 << self._val['_M_offset'])) class StdBitReferencePrinter(printer_base): """Print std::vector<bool>::reference.""" def __init__(self, typename, val): self._val = val def to_string(self): if not self._val['_M_p']: # PR libstdc++/115098 removed the reference default constructor # that this case relates to. New code should never need this, # but we still handle it for compatibility with old binaries. return 'invalid std::vector<bool>::reference' return bool(self._val['_M_p'].dereference() & (self._val['_M_mask'])) class StdTuplePrinter(printer_base): """Print a std::tuple.""" class _iterator(Iterator): @staticmethod def _is_nonempty_tuple(nodes): if len(nodes) == 2: if is_specialization_of(nodes[1].type, '__tuple_base'): return True elif len(nodes) == 1: return True elif len(nodes) == 0: return False raise ValueError( "Top of tuple tree does not consist of a single node.") def __init__(self, head): self._head = head # Set the base class as the initial head of the # tuple. nodes = self._head.type.fields() if self._is_nonempty_tuple(nodes): # Set the actual head to the first pair. self._head = self._head.cast(nodes[0].type) self._count = 0 def __iter__(self): return self def __next__(self): # Check for further recursions in the inheritance tree. # For a GCC 5+ tuple self._head is None after visiting all nodes: if not self._head: raise StopIteration nodes = self._head.type.fields() # For a GCC 4.x tuple there is a final node with no fields: if len(nodes) == 0: raise StopIteration # Check that this iteration has an expected structure. if len(nodes) > 2: raise ValueError( "Cannot parse more than 2 nodes in a tuple tree.") if len(nodes) == 1: # This is the last node of a GCC 5+ std::tuple. impl = self._head.cast(nodes[0].type) self._head = None else: # Either a node before the last node, or the last node of # a GCC 4.x tuple (which has an empty parent). # - Left node is the next recursion parent. # - Right node is the actual class contained in the tuple. # Process right node. impl = self._head.cast(nodes[1].type) # Process left node and set it as head. self._head = self._head.cast(nodes[0].type) self._count = self._count + 1 # Finally, check the implementation. If it is # wrapped in _M_head_impl return that, otherwise return # the value "as is". fields = impl.type.fields() if len(fields) < 1 or fields[0].name != "_M_head_impl": return ('[%d]' % (self._count - 1), impl) else: return ('[%d]' % (self._count - 1), impl['_M_head_impl']) def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def children(self): return self._iterator(self._val) def to_string(self): if len(self._val.type.fields()) == 0: return 'empty %s' % (self._typename) return '%s containing' % (self._typename) class StdStackOrQueuePrinter(printer_base): """Print a std::stack or std::queue.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._visualizer = gdb.default_visualizer(val['c']) def children(self): return self._visualizer.children() def to_string(self): return '%s wrapping: %s' % (self._typename, self._visualizer.to_string()) def display_hint(self): if hasattr(self._visualizer, 'display_hint'): return self._visualizer.display_hint() return None class RbtreeIterator(Iterator): """ Turn an RB-tree-based container (std::map, std::set etc.) into a Python iterable object. """ def __init__(self, rbtree): self._size = rbtree['_M_t']['_M_impl']['_M_node_count'] self._node = rbtree['_M_t']['_M_impl']['_M_header']['_M_left'] self._count = 0 def __iter__(self): return self def __len__(self): return int(self._size) def __next__(self): if self._count == self._size: raise StopIteration result = self._node self._count = self._count + 1 if self._count < self._size: # Compute the next node. node = self._node if node.dereference()['_M_right']: node = node.dereference()['_M_right'] while node.dereference()['_M_left']: node = node.dereference()['_M_left'] else: parent = node.dereference()['_M_parent'] while node == parent.dereference()['_M_right']: node = parent parent = parent.dereference()['_M_parent'] if node.dereference()['_M_right'] != parent: node = parent self._node = node return result def get_value_from_Rb_tree_node(node): """Return the value held in an _Rb_tree_node<_Val>.""" try: member = node.type.fields()[1].name if member == '_M_value_field': # C++03 implementation, node contains the value as a member return node['_M_value_field'] elif member == '_M_storage': # C++11 implementation, node stores value in __aligned_membuf valtype = node.type.template_argument(0) return get_value_from_aligned_membuf(node['_M_storage'], valtype) except: pass raise ValueError("Unsupported implementation for %s" % str(node.type)) # This is a pretty printer for std::_Rb_tree_iterator (which is # std::map::iterator), and has nothing to do with the RbtreeIterator # class above. class StdRbtreeIteratorPrinter(printer_base): """Print std::map::iterator, std::set::iterator, etc.""" def __init__(self, typename, val): self._val = val nodetype = lookup_node_type('_Rb_tree_node', self._val.type) self._link_type = nodetype.pointer() def to_string(self): if not self._val['_M_node']: return 'non-dereferenceable iterator for associative container' node = self._val['_M_node'].cast(self._link_type).dereference() return str(get_value_from_Rb_tree_node(node)) class StdDebugIteratorPrinter(printer_base): """Print a debug enabled version of an iterator.""" def __init__(self, typename, val): self._val = val # Just strip away the encapsulating __gnu_debug::_Safe_iterator # and return the wrapped iterator value. def to_string(self): base_type = gdb.lookup_type('__gnu_debug::_Safe_iterator_base') itype = self._val.type.template_argument(0) safe_seq = self._val.cast(base_type)['_M_sequence'] if not safe_seq: return str(self._val.cast(itype)) if self._val['_M_version'] != safe_seq['_M_version']: return "invalid iterator" return str(self._val.cast(itype)) def num_elements(num): """Return either "1 element" or "N elements" depending on the argument.""" return '1 element' if num == 1 else '%d elements' % num class StdMapPrinter(printer_base): """Print a std::map or std::multimap.""" # Turn an RbtreeIterator into a pretty-print iterator. class _iter(Iterator): def __init__(self, rbiter, type): self._rbiter = rbiter self._count = 0 self._type = type def __iter__(self): return self def __next__(self): if self._count % 2 == 0: n = next(self._rbiter) n = n.cast(self._type).dereference() n = get_value_from_Rb_tree_node(n) self._pair = n item = n['first'] else: item = self._pair['second'] result = ('[%d]' % self._count, item) self._count = self._count + 1 return result def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): return '%s with %s' % (self._typename, num_elements(len(RbtreeIterator(self._val)))) def children(self): node = lookup_node_type('_Rb_tree_node', self._val.type).pointer() return self._iter(RbtreeIterator(self._val), node) def display_hint(self): return 'map' class StdSetPrinter(printer_base): """Print a std::set or std::multiset.""" # Turn an RbtreeIterator into a pretty-print iterator. class _iter(Iterator): def __init__(self, rbiter, type): self._rbiter = rbiter self._count = 0 self._type = type def __iter__(self): return self def __next__(self): item = next(self._rbiter) item = item.cast(self._type).dereference() item = get_value_from_Rb_tree_node(item) # FIXME: this is weird ... what to do? # Maybe a 'set' display hint? result = ('[%d]' % self._count, item) self._count = self._count + 1 return result def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): return '%s with %s' % (self._typename, num_elements(len(RbtreeIterator(self._val)))) def children(self): node = lookup_node_type('_Rb_tree_node', self._val.type).pointer() return self._iter(RbtreeIterator(self._val), node) class StdBitsetPrinter(printer_base): """Print a std::bitset.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): # If template_argument handled values, we could print the # size. Or we could use a regexp on the type. return '%s' % (self._typename) def children(self): try: # An empty bitset may not have any members which will # result in an exception being thrown. words = self._val['_M_w'] except: return [] wtype = words.type # The _M_w member can be either an unsigned long, or an # array. This depends on the template specialization used. # If it is a single long, convert to a single element list. if wtype.code == gdb.TYPE_CODE_ARRAY: tsize = wtype.target().sizeof else: words = [words] tsize = wtype.sizeof nwords = wtype.sizeof / tsize result = [] byte = 0 while byte < nwords: w = words[byte] bit = 0 while w != 0: if (w & 1) != 0: # Another spot where we could use 'set'? result.append(('[%d]' % (byte * tsize * 8 + bit), 1)) bit = bit + 1 w = w >> 1 byte = byte + 1 return result class StdDequePrinter(printer_base): """Print a std::deque.""" class _iter(Iterator): def __init__(self, node, start, end, last, buffer_size): self._node = node self._p = start self._end = end self._last = last self._buffer_size = buffer_size self._count = 0 def __iter__(self): return self def __next__(self): if self._p == self._last: raise StopIteration result = ('[%d]' % self._count, self._p.dereference()) self._count = self._count + 1 # Advance the 'cur' pointer. self._p = self._p + 1 if self._p == self._end: # If we got to the end of this bucket, move to the # next bucket. self._node = self._node + 1 self._p = self._node[0] self._end = self._p + self._buffer_size return result def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val self._elttype = val.type.template_argument(0) size = self._elttype.sizeof if size < 512: self._buffer_size = int(512 / size) else: self._buffer_size = 1 def to_string(self): start = self._val['_M_impl']['_M_start'] end = self._val['_M_impl']['_M_finish'] delta_n = end['_M_node'] - start['_M_node'] - 1 delta_s = start['_M_last'] - start['_M_cur'] delta_e = end['_M_cur'] - end['_M_first'] size = self._buffer_size * delta_n + delta_s + delta_e return '%s with %s' % (self._typename, num_elements(long(size))) def children(self): start = self._val['_M_impl']['_M_start'] end = self._val['_M_impl']['_M_finish'] return self._iter(start['_M_node'], start['_M_cur'], start['_M_last'], end['_M_cur'], self._buffer_size) def display_hint(self): return 'array' class StdDequeIteratorPrinter(printer_base): """Print std::deque::iterator.""" def __init__(self, typename, val): self._val = val def to_string(self): if not self._val['_M_cur']: return 'non-dereferenceable iterator for std::deque' return str(self._val['_M_cur'].dereference()) class StdStringPrinter(printer_base): """Print a std::basic_string of some kind.""" def __init__(self, typename, val): self._val = val self._new_string = typename.find("::__cxx11::basic_string") != -1 def to_string(self): # Make sure &string works, too. type = self._val.type if type.code == gdb.TYPE_CODE_REF: type = type.target() # Calculate the length of the string so that to_string returns # the string according to length, not according to first null # encountered. ptr = self._val['_M_dataplus']['_M_p'] if self._new_string: length = self._val['_M_string_length'] # https://sourceware.org/bugzilla/show_bug.cgi?id=17728 ptr = ptr.cast(ptr.type.strip_typedefs()) else: realtype = type.unqualified().strip_typedefs() reptype = gdb.lookup_type(str(realtype) + '::_Rep').pointer() header = ptr.cast(reptype) - 1 length = header.dereference()['_M_length'] if hasattr(ptr, "lazy_string"): return ptr.lazy_string(length=length) return ptr.string(length=length) def display_hint(self): return 'string' def access_streambuf_ptrs(streambuf): """Access the streambuf put area pointers.""" pbase = streambuf['_M_out_beg'] pptr = streambuf['_M_out_cur'] egptr = streambuf['_M_in_end'] return pbase, pptr, egptr class StdStringBufPrinter(printer_base): """Print a std::basic_stringbuf.""" def __init__(self, _, val): self._val = val def to_string(self): (pbase, pptr, egptr) = access_streambuf_ptrs(self._val) # Logic from basic_stringbuf::_M_high_mark() if pptr: if not egptr or pptr > egptr: return pbase.string(length=pptr - pbase) else: return pbase.string(length=egptr - pbase) return self._val['_M_string'] def display_hint(self): return 'string' class StdStringStreamPrinter(printer_base): """Print a std::basic_stringstream.""" def __init__(self, typename, val): self._val = val self._typename = typename # Check if the stream was redirected. This is essentially: # val['_M_streambuf'] != val['_M_stringbuf'].address # However, GDB can't resolve the virtual inheritance, so we do that # manually. basetype = [f.type for f in val.type.fields() if f.is_base_class][0] gdb.set_convenience_variable('__stream', val.cast(basetype).address) self._streambuf = gdb.parse_and_eval('$__stream->rdbuf()') self._was_redirected = self._streambuf != val['_M_stringbuf'].address def to_string(self): if self._was_redirected: return "%s redirected to %s" % ( self._typename, self._streambuf.dereference()) return self._val['_M_stringbuf'] def display_hint(self): if self._was_redirected: return None return 'string' class Tr1HashtableIterator(Iterator): def __init__(self, hashtable): self._buckets = hashtable['_M_buckets'] self._bucket = 0 self._bucket_count = hashtable['_M_bucket_count'] self._node_type = find_type(hashtable.type, '_Node').pointer() self._node = 0 while self._bucket != self._bucket_count: self._node = self._buckets[self._bucket] if self._node: break self._bucket = self._bucket + 1 def __iter__(self): return self def __next__(self): if self._node == 0: raise StopIteration node = self._node.cast(self._node_type) result = node.dereference()['_M_v'] self._node = node.dereference()['_M_next'] if self._node == 0: self._bucket = self._bucket + 1 while self._bucket != self._bucket_count: self._node = self._buckets[self._bucket] if self._node: break self._bucket = self._bucket + 1 return result class StdHashtableIterator(Iterator): def __init__(self, hashtable): self._node = hashtable['_M_before_begin']['_M_nxt'] valtype = hashtable.type.template_argument(1) cached = hashtable.type.template_argument(9).template_argument(0) node_type = lookup_templ_spec('std::__detail::_Hash_node', str(valtype), 'true' if cached else 'false') self._node_type = node_type.pointer() def __iter__(self): return self def __next__(self): if self._node == 0: raise StopIteration elt = self._node.cast(self._node_type).dereference() self._node = elt['_M_nxt'] valptr = elt['_M_storage'].address valptr = valptr.cast(elt.type.template_argument(0).pointer()) return valptr.dereference() class Tr1UnorderedSetPrinter(printer_base): """Print a std::unordered_set or tr1::unordered_set.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def _hashtable(self): if self._typename.startswith('std::tr1'): return self._val return self._val['_M_h'] def to_string(self): count = self._hashtable()['_M_element_count'] return '%s with %s' % (self._typename, num_elements(count)) @staticmethod def _format_count(i): return '[%d]' % i def children(self): counter = imap(self._format_count, itertools.count()) if self._typename.startswith('std::tr1'): return izip(counter, Tr1HashtableIterator(self._hashtable())) return izip(counter, StdHashtableIterator(self._hashtable())) class Tr1UnorderedMapPrinter(printer_base): """Print a std::unordered_map or tr1::unordered_map.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def _hashtable(self): if self._typename.startswith('std::tr1'): return self._val return self._val['_M_h'] def to_string(self): count = self._hashtable()['_M_element_count'] return '%s with %s' % (self._typename, num_elements(count)) @staticmethod def _flatten(list): for elt in list: for i in elt: yield i @staticmethod def _format_one(elt): return (elt['first'], elt['second']) @staticmethod def _format_count(i): return '[%d]' % i def children(self): counter = imap(self._format_count, itertools.count()) # Map over the hash table and flatten the result. if self._typename.startswith('std::tr1'): data = self._flatten( imap(self._format_one, Tr1HashtableIterator(self._hashtable()))) # Zip the two iterators together. return izip(counter, data) data = self._flatten( imap(self._format_one, StdHashtableIterator(self._hashtable()))) # Zip the two iterators together. return izip(counter, data) def display_hint(self): return 'map' class StdForwardListPrinter(printer_base): """Print a std::forward_list.""" class _iterator(Iterator): def __init__(self, nodetype, head): self._nodetype = nodetype self._base = head['_M_next'] self._count = 0 def __iter__(self): return self def __next__(self): if self._base == 0: raise StopIteration elt = self._base.cast(self._nodetype).dereference() self._base = elt['_M_next'] count = self._count self._count = self._count + 1 valptr = elt['_M_storage'].address valptr = valptr.cast(elt.type.template_argument(0).pointer()) return ('[%d]' % count, valptr.dereference()) def __init__(self, typename, val): self._val = val self._typename = strip_versioned_namespace(typename) def children(self): nodetype = lookup_node_type('_Fwd_list_node', self._val.type).pointer() return self._iterator(nodetype, self._val['_M_impl']['_M_head']) def to_string(self): if self._val['_M_impl']['_M_head']['_M_next'] == 0: return 'empty %s' % self._typename return '%s' % self._typename class SingleObjContainerPrinter(printer_base): """Base class for printers of containers of single objects.""" def __init__(self, val, viz, hint=None): self._contained_value = val self._visualizer = viz self._hint = hint def _recognize(self, type): """Return type as a string after applying type printers.""" global _use_type_printing if not _use_type_printing: return str(type) return gdb.types.apply_type_recognizers(gdb.types.get_type_recognizers(), type) or str(type) class _contained(Iterator): def __init__(self, val): self._val = val def __iter__(self): return self def __next__(self): if self._val is None: raise StopIteration retval = self._val self._val = None return ('[contained value]', retval) def children(self): if self._contained_value is None: return self._contained(None) if hasattr(self._visualizer, 'children'): return self._visualizer.children() return self._contained(self._contained_value) def display_hint(self): if (hasattr(self._visualizer, 'children') and hasattr(self._visualizer, 'display_hint')): # If contained value is a map we want to display in the same way. return self._visualizer.display_hint() return self._hint def function_pointer_to_name(f): """Find the name of the function referred to by the gdb.Value f, which should contain a function pointer from the program.""" # Turn the function pointer into an actual address. # This is needed to unpack ppc64 function descriptors. f = f.dereference().address if sys.version_info[0] == 2: # Older versions of GDB need to use long for Python 2, # because int(f) on 64-bit big-endian values raises a # gdb.error saying "Cannot convert value to int." f = long(f) else: f = int(f) try: # If the function can't be found older versions of GDB raise a # RuntimeError saying "Cannot locate object file for block." return gdb.block_for_pc(f).function.name except: return None class StdExpAnyPrinter(SingleObjContainerPrinter): """Print a std::any or std::experimental::any.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._typename = strip_fundts_namespace(self._typename) self._val = val self._contained_type = None contained_value = None visualizer = None mgr = self._val['_M_manager'] if mgr != 0: func = function_pointer_to_name(mgr) if not func: raise ValueError( "Invalid function pointer in %s" % (self._typename)) # We want to use this regular expression: # T::_Manager_xxx<.*>::_S_manage\(T::_Op, const T\*, T::_Arg\*\) # where T is std::any or std::experimental::any. # But we need to account for variances in demangled names # between GDB versions, e.g. 'enum T::_Op' instead of 'T::_Op'. rx = ( r"({0}::_Manager_\w+<.*>)::_S_manage\(" r"(enum )?{0}::_Op, (const {0}|{0} const) ?\*, " r"(union )?{0}::_Arg ?\*\)" ).format(typename) m = re.match(rx, func) if not m: raise ValueError( "Unknown manager function in %s" % self._typename) mgrname = m.group(1) # FIXME need to expand 'std::string' so that gdb.lookup_type works if 'std::string' in mgrname: mgrtypes = [] for s in StdExpAnyPrinter._string_types(): try: x = re.sub(r"std::string(?!\w)", s, m.group(1)) # The following lookup might raise gdb.error if the # manager function was never instantiated for 's' in # the program, because there will be no such type. mgrtypes.append(gdb.lookup_type(x)) except gdb.error: pass if len(mgrtypes) != 1: # FIXME: this is unlikely in practice, but possible for # programs that use both old and new string types with # std::any in a single program. Can we do better? # Maybe find the address of each type's _S_manage and # compare to the address stored in _M_manager? raise ValueError( 'Cannot uniquely determine std::string type ' 'used in std::any' ) mgrtype = mgrtypes[0] else: mgrtype = gdb.lookup_type(mgrname) self._contained_type = mgrtype.template_argument(0) valptr = None if '::_Manager_internal' in mgrname: valptr = self._val['_M_storage']['_M_buffer'].address elif '::_Manager_external' in mgrname: valptr = self._val['_M_storage']['_M_ptr'] else: raise ValueError( "Unknown manager function in %s" % self._typename) contained_value = valptr.cast( self._contained_type.pointer()).dereference() visualizer = gdb.default_visualizer(contained_value) super(StdExpAnyPrinter, self).__init__(contained_value, visualizer) def to_string(self): if self._contained_type is None: return '%s [no contained value]' % self._typename desc = "%s containing " % self._typename if hasattr(self._visualizer, 'children'): return desc + self._visualizer.to_string() valtype = self._recognize(self._contained_type) return desc + strip_versioned_namespace(str(valtype)) @staticmethod def _string_types(): # This lookup for std::string might return the __cxx11 version, # but that's not necessarily the one used by the std::any # manager function we're trying to find. strings = {str(gdb.lookup_type('std::string').strip_typedefs())} # So also consider all the other possible std::string types! s = 'basic_string<char, std::char_traits<char>, std::allocator<char> >' quals = ['std::', 'std::__cxx11::', 'std::' + _versioned_namespace] strings |= {q + s for q in quals} # set of unique strings return strings class StdExpOptionalPrinter(SingleObjContainerPrinter): """Print a std::optional or std::experimental::optional.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._typename = strip_fundts_namespace(self._typename) payload = val['_M_payload'] if self._typename.startswith('std::experimental'): engaged = val['_M_engaged'] contained_value = payload else: engaged = payload['_M_engaged'] contained_value = payload['_M_payload'] try: # Since GCC 9 contained_value = contained_value['_M_value'] except: pass visualizer = gdb.default_visualizer(contained_value) if not engaged: contained_value = None super(StdExpOptionalPrinter, self).__init__( contained_value, visualizer) def to_string(self): if self._contained_value is None: return "%s [no contained value]" % self._typename if hasattr(self._visualizer, 'children'): return "%s containing %s" % (self._typename, self._visualizer.to_string()) return self._typename class StdVariantPrinter(SingleObjContainerPrinter): """Print a std::variant.""" def __init__(self, typename, val): alternatives = get_template_arg_list(val.type) self._typename = strip_versioned_namespace(typename) self._index = val['_M_index'] if self._index >= len(alternatives): self._contained_type = None contained_value = None visualizer = None else: self._contained_type = alternatives[int(self._index)] addr = val['_M_u']['_M_first']['_M_storage'].address contained_value = addr.cast( self._contained_type.pointer()).dereference() visualizer = gdb.default_visualizer(contained_value) super(StdVariantPrinter, self).__init__( contained_value, visualizer, 'array') def to_string(self): if self._contained_value is None: return "%s [no contained value]" % self._typename if hasattr(self._visualizer, 'children'): return "%s [index %d] containing %s" % (self._typename, self._index, self._visualizer.to_string()) return "%s [index %d]" % (self._typename, self._index) class StdNodeHandlePrinter(SingleObjContainerPrinter): """Print a container node handle.""" def __init__(self, typename, val): self._value_type = val.type.template_argument(1) nodetype = val.type.template_argument(2).template_argument(0) self._is_rb_tree_node = is_specialization_of( nodetype.name, '_Rb_tree_node') self._is_map_node = val.type.template_argument(0) != self._value_type nodeptr = val['_M_ptr'] if nodeptr: if self._is_rb_tree_node: contained_value = get_value_from_Rb_tree_node( nodeptr.dereference()) else: contained_value = get_value_from_aligned_membuf(nodeptr['_M_storage'], self._value_type) visualizer = gdb.default_visualizer(contained_value) else: contained_value = None visualizer = None optalloc = val['_M_alloc'] self._alloc = optalloc['_M_payload'] if optalloc['_M_engaged'] else None super(StdNodeHandlePrinter, self).__init__(contained_value, visualizer, 'array') def to_string(self): desc = 'node handle for ' if not self._is_rb_tree_node: desc += 'unordered ' if self._is_map_node: desc += 'map' else: desc += 'set' if self._contained_value: desc += ' with element' if hasattr(self._visualizer, 'children'): return "%s = %s" % (desc, self._visualizer.to_string()) return desc else: return 'empty %s' % desc class StdExpStringViewPrinter(printer_base): """ Print a std::basic_string_view or std::experimental::basic_string_view """ def __init__(self, typename, val): self._val = val def to_string(self): ptr = self._val['_M_str'] len = self._val['_M_len'] if hasattr(ptr, "lazy_string"): return ptr.lazy_string(length=len) return ptr.string(length=len) def display_hint(self): return 'string' class StdExpPathPrinter(printer_base): """Print a std::experimental::filesystem::path.""" def __init__(self, typename, val): self._val = val self._typename = typename start = self._val['_M_cmpts']['_M_impl']['_M_start'] finish = self._val['_M_cmpts']['_M_impl']['_M_finish'] self._num_cmpts = int(finish - start) def _path_type(self): t = str(self._val['_M_type']) if t[-9:] == '_Root_dir': return "root-directory" if t[-10:] == '_Root_name': return "root-name" return None def to_string(self): path = "%s" % self._val['_M_pathname'] if self._num_cmpts == 0: t = self._path_type() if t: path = '%s [%s]' % (path, t) return "experimental::filesystem::path %s" % path class _iterator(Iterator): def __init__(self, cmpts, pathtype): self._pathtype = pathtype self._item = cmpts['_M_impl']['_M_start'] self._finish = cmpts['_M_impl']['_M_finish'] self._count = 0 def __iter__(self): return self def __next__(self): if self._item == self._finish: raise StopIteration item = self._item.dereference() count = self._count self._count = self._count + 1 self._item = self._item + 1 path = item['_M_pathname'] t = StdExpPathPrinter(self._pathtype, item)._path_type() if not t: t = count return ('[%s]' % t, path) def children(self): return self._iterator(self._val['_M_cmpts'], self._typename) class StdPathPrinter(printer_base): """Print a std::filesystem::path.""" def __init__(self, typename, val): self._val = val self._typename = typename impl = unique_ptr_get(self._val['_M_cmpts']['_M_impl']) self._type = impl.cast(gdb.lookup_type('uintptr_t')) & 3 if self._type == 0: self._impl = impl else: self._impl = None def _path_type(self): t = str(self._type.cast(gdb.lookup_type(self._typename + '::_Type'))) if t[-9:] == '_Root_dir': return "root-directory" if t[-10:] == '_Root_name': return "root-name" return None def to_string(self): path = "%s" % self._val['_M_pathname'] if self._type != 0: t = self._path_type() if t: path = '%s [%s]' % (path, t) return "filesystem::path %s" % path class _iterator(Iterator): def __init__(self, impl, pathtype): self._pathtype = pathtype if impl: # We can't access _Impl::_M_size because _Impl is incomplete # so cast to int* to access the _M_size member at offset zero, int_type = gdb.lookup_type('int') cmpt_type = gdb.lookup_type(pathtype + '::_Cmpt') char_type = gdb.lookup_type('char') impl = impl.cast(int_type.pointer()) size = impl.dereference() #self._capacity = (impl + 1).dereference() if hasattr(gdb.Type, 'alignof'): sizeof_Impl = max(2 * int_type.sizeof, cmpt_type.alignof) else: sizeof_Impl = 2 * int_type.sizeof begin = impl.cast(char_type.pointer()) + sizeof_Impl self._item = begin.cast(cmpt_type.pointer()) self._finish = self._item + size self._count = 0 else: self._item = None self._finish = None def __iter__(self): return self def __next__(self): if self._item == self._finish: raise StopIteration item = self._item.dereference() count = self._count self._count = self._count + 1 self._item = self._item + 1 path = item['_M_pathname'] t = StdPathPrinter(self._pathtype, item)._path_type() if not t: t = count return ('[%s]' % t, path) def children(self): return self._iterator(self._impl, self._typename) class StdPairPrinter(printer_base): """Print a std::pair object, with 'first' and 'second' as children.""" def __init__(self, typename, val): self._val = val class _iter(Iterator): """An iterator for std::pair types. Returns 'first' then 'second'.""" def __init__(self, val): self._val = val self._which = 'first' def __iter__(self): return self def __next__(self): if self._which is None: raise StopIteration which = self._which if which == 'first': self._which = 'second' else: self._which = None return (which, self._val[which]) def children(self): return self._iter(self._val) def to_string(self): return None class StdCmpCatPrinter(printer_base): """Print a comparison category object.""" def __init__(self, typename, val): self._typename = typename[typename.rfind(':') + 1:] self._val = val['_M_value'] def to_string(self): if self._typename == 'strong_ordering' and self._val == 0: name = 'equal' else: names = {2: 'unordered', -1: 'less', 0: 'equivalent', 1: 'greater'} name = names[int(self._val)] return 'std::{}::{}'.format(self._typename, name) class StdErrorCodePrinter(printer_base): """Print a std::error_code or std::error_condition.""" _system_is_posix = None # Whether std::system_category() use errno values. def __init__(self, typename, val): self._val = val self._typename = strip_versioned_namespace(typename) # Do this only once ... if StdErrorCodePrinter._system_is_posix is None: try: import posix StdErrorCodePrinter._system_is_posix = True except ImportError: StdErrorCodePrinter._system_is_posix = False @staticmethod def _find_errc_enum(name): typ = gdb.lookup_type(name) if typ is not None and typ.code == gdb.TYPE_CODE_ENUM: return typ return None @classmethod def _find_standard_errc_enum(cls, name): for ns in ['', _versioned_namespace]: try: qname = 'std::{}{}'.format(ns, name) return cls._find_errc_enum(qname) except RuntimeError: pass @classmethod def _match_net_ts_category(cls, cat): net_cats = ['stream', 'socket', 'ip::resolver'] for c in net_cats: func = c + '_category()' for ns in ['', _versioned_namespace]: ns = 'std::{}experimental::net::v1'.format(ns) sym = gdb.lookup_symbol('{}::{}::__c'.format(ns, func))[0] if sym is not None: if cat == sym.value().address: name = 'net::' + func enum = cls._find_errc_enum('{}::{}_errc'.format(ns, c)) return (name, enum) return (None, None) @classmethod def _category_info(cls, cat): """Return details of a std::error_category.""" name = None enum = None is_errno = False # Try these first, or we get "warning: RTTI symbol not found" when # using cat.dynamic_type on the local class types for Net TS # categories. func, enum = cls._match_net_ts_category(cat) if func is not None: return (None, func, enum, is_errno) # This might give a warning for a program-defined category defined as # a local class, but there doesn't seem to be any way to avoid that. typ = cat.dynamic_type.target() # Shortcuts for the known categories defined by libstdc++. if typ.tag.endswith('::generic_error_category'): name = 'generic' is_errno = True if typ.tag.endswith('::system_error_category'): name = 'system' is_errno = cls._system_is_posix if typ.tag.endswith('::future_error_category'): name = 'future' enum = cls._find_standard_errc_enum('future_errc') if typ.tag.endswith('::io_error_category'): name = 'io' enum = cls._find_standard_errc_enum('io_errc') if name is None: try: # Want to call std::error_category::name() override, but it's # unsafe: https://sourceware.org/bugzilla/show_bug.cgi?id=28856 # gdb.set_convenience_variable('__cat', cat) # return '"%s"' % gdb.parse_and_eval('$__cat->name()').string() pass except: pass return (name, typ.tag, enum, is_errno) @staticmethod def _unqualified_name(name): """ Strip any nested-name-specifier from name to give an unqualified name. """ return name.split('::')[-1] def to_string(self): value = self._val['_M_value'] cat = self._val['_M_cat'] name, alt_name, enum, is_errno = self._category_info(cat) if value == 0: default_cats = {'error_code': 'system', 'error_condition': 'generic'} if name == default_cats[self._unqualified_name(self._typename)]: return self._typename + ' = { }' # default-constructed value strval = str(value) if is_errno and value != 0: try: strval = errno.errorcode[int(value)] except: pass elif enum is not None: strval = self._unqualified_name(str(value.cast(enum))) if name is not None: name = '"%s"' % name else: name = alt_name return '%s = {%s: %s}' % (self._typename, name, strval) class StdRegexStatePrinter(printer_base): """Print a state node in the NFA for a std::regex.""" def __init__(self, typename, val): self._val = val self._typename = typename def to_string(self): opcode = str(self._val['_M_opcode']) if opcode: opcode = opcode[25:] next_id = self._val['_M_next'] variants = {'repeat': 'alt', 'alternative': 'alt', 'subexpr_begin': 'subexpr', 'subexpr_end': 'subexpr', 'line_begin_assertion': None, 'line_end_assertion': None, 'word_boundary': 'neg', 'subexpr_lookahead': 'neg', 'backref': 'backref_index', 'match': None, 'accept': None, 'dummy': None, 'unknown': None } v = variants[opcode] s = "opcode={}, next={}".format(opcode, next_id) if v is not None and self._val['_M_' + v] is not None: s = "{}, {}={}".format(s, v, self._val['_M_' + v]) return "{%s}" % (s) class StdSpanPrinter(printer_base): """Print a std::span.""" class _iterator(Iterator): def __init__(self, begin, size): self._count = 0 self._begin = begin self._size = size def __iter__(self): return self def __next__(self): if self._count == self._size: raise StopIteration count = self._count self._count = self._count + 1 return '[%d]' % count, (self._begin + count).dereference() def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val size_max = gdb.parse_and_eval('static_cast<std::size_t>(-1)') if val.type.template_argument(1) == size_max: self._size = val['_M_extent']['_M_extent_value'] else: self._size = val.type.template_argument(1) def to_string(self): return '%s of length %d' % (self._typename, self._size) def children(self): return self._iterator(self._val['_M_ptr'], self._size) def display_hint(self): return 'array' class StdInitializerListPrinter(printer_base): """Print a std::initializer_list.""" def __init__(self, typename, val): self._typename = typename self._val = val self._size = val['_M_len'] def to_string(self): return '%s of length %d' % (self._typename, self._size) def children(self): return StdSpanPrinter._iterator(self._val['_M_array'], self._size) def display_hint(self): return 'array' class StdAtomicPrinter(printer_base): """Print a std:atomic.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val self._shptr_printer = None self._value_type = self._val.type.template_argument(0) if self._value_type.tag is not None: typ = strip_versioned_namespace(self._value_type.tag) if (typ.startswith('std::shared_ptr<') or typ.startswith('std::weak_ptr<')): impl = val['_M_impl'] self._shptr_printer = SharedPointerPrinter(typename, impl) self.children = self._shptr_children def _shptr_children(self): return SmartPtrIterator(self._shptr_printer._pointer) def to_string(self): if self._shptr_printer is not None: return self._shptr_printer.to_string() if self._value_type.code == gdb.TYPE_CODE_INT: val = self._val['_M_i'] elif self._value_type.code == gdb.TYPE_CODE_FLT: val = self._val['_M_fp'] elif self._value_type.code == gdb.TYPE_CODE_PTR: val = self._val['_M_b']['_M_p'] elif self._value_type.code == gdb.TYPE_CODE_BOOL: val = self._val['_M_base']['_M_i'] else: val = self._val['_M_i'] return '%s<%s> = { %s }' % (self._typename, str(self._value_type), val) class StdFormatArgsPrinter(printer_base): """Print a std::basic_format_args.""" # TODO: add printer for basic_format_arg<Context> and print out children. # TODO: add printer for __format::_ArgStore<Context, Args...>. def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): targs = get_template_arg_list(self._val.type) char_type = get_template_arg_list(targs[0])[1] if char_type == gdb.lookup_type('char'): typ = 'std::format_args' elif char_type == gdb.lookup_type('wchar_t'): typ = 'std::wformat_args' else: typ = 'std::basic_format_args' size = self._val['_M_packed_size'] if size == 1: return "%s with 1 argument" % (typ) if size == 0: size = self._val['_M_unpacked_size'] return "%s with %d arguments" % (typ, size) class StdChronoDurationPrinter(printer_base): """Print a std::chrono::duration.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def _ratio(self): # TODO use reduced period i.e. duration::period period = self._val.type.template_argument(1) num = period.template_argument(0) den = period.template_argument(1) return (num, den) def _suffix(self): num, den = self._ratio() if num == 1: if den == 1: return 's' if den == 1000: return 'ms' if den == 1000000: return 'us' if den == 1000000000: return 'ns' elif den == 1: if num == 60: return 'min' if num == 3600: return 'h' if num == 86400: return 'd' return '[{}]s'.format(num) return "[{}/{}]s".format(num, den) def to_string(self): r = self._val['__r'] if r.type.strip_typedefs().code == gdb.TYPE_CODE_FLT: r = "%g" % r return "std::chrono::duration = {{ {}{} }}".format(r, self._suffix()) class StdChronoTimePointPrinter(printer_base): """Print a std::chrono::time_point.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def _clock(self): clock = self._val.type.template_argument(0) name = strip_versioned_namespace(clock.name) if name == 'std::chrono::_V2::system_clock' \ or name == 'std::chrono::system_clock': return ('std::chrono::sys_time', 0) # XXX need to remove leap seconds from utc, gps, and tai if name == 'std::chrono::utc_clock': return ('std::chrono::utc_time', None) # XXX if name == 'std::chrono::gps_clock': return ('std::chrono::gps_time', None) # XXX 315964809 if name == 'std::chrono::tai_clock': return ('std::chrono::tai_time', None) # XXX -378691210 if name == 'std::filesystem::__file_clock': return ('std::chrono::file_time', 6437664000) if name == 'std::chrono::local_t': return ('std::chrono::local_time', 0) return ('{} time_point'.format(name), None) def to_string(self, abbrev=False): clock, offset = self._clock() d = self._val['__d'] r = d['__r'] printer = StdChronoDurationPrinter(d.type.name, d) suffix = printer._suffix() time = '' if offset is not None: num, den = printer._ratio() secs = (r * num / den) + offset try: dt = datetime.datetime.fromtimestamp(secs, _utc_timezone) time = ' [{:%Y-%m-%d %H:%M:%S}]'.format(dt) except: pass s = '%d%s%s' % (r, suffix, time) if abbrev: return s return '%s = { %s }' % (clock, s) class StdChronoZonedTimePrinter(printer_base): """Print a std::chrono::zoned_time.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): zone = self._val['_M_zone'].dereference()['_M_name'] time = self._val['_M_tp'] printer = StdChronoTimePointPrinter(time.type.name, time) time = printer.to_string(True) return 'std::chrono::zoned_time = {{ {} {} }}'.format(zone, time) months = [None, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] class StdChronoCalendarPrinter(printer_base): """Print a std::chrono::day, std::chrono::month, std::chrono::year etc.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): val = self._val typ = self._typename if 'month' in typ and typ != 'std::chrono::year_month_day_last': m = val['_M_m'] if typ.startswith('std::chrono::year'): y = val['_M_y'] if typ == 'std::chrono::day': return '{}'.format(int(val['_M_d'])) if typ == 'std::chrono::month': if m < 1 or m >= len(months): return "%d is not a valid month" % m return months[m] if typ == 'std::chrono::year': return '{}y'.format(y) if typ == 'std::chrono::weekday': wd = val['_M_wd'] if wd < 0 or wd >= len(weekdays): return "%d is not a valid weekday" % wd return '{}'.format(weekdays[wd]) if typ == 'std::chrono::weekday_indexed': return '{}[{}]'.format(val['_M_wd'], int(val['_M_index'])) if typ == 'std::chrono::weekday_last': return '{}[last]'.format(val['_M_wd']) if typ == 'std::chrono::month_day': return '{}/{}'.format(m, val['_M_d']) if typ == 'std::chrono::month_day_last': return '{}/last'.format(m) if typ == 'std::chrono::month_weekday': return '{}/{}'.format(m, val['_M_wdi']) if typ == 'std::chrono::month_weekday_last': return '{}/{}'.format(m, val['_M_wdl']) if typ == 'std::chrono::year_month': return '{}/{}'.format(y, m) if typ == 'std::chrono::year_month_day': return '{}/{}/{}'.format(y, m, val['_M_d']) if typ == 'std::chrono::year_month_day_last': return '{}/{}'.format(y, val['_M_mdl']) if typ == 'std::chrono::year_month_weekday': return '{}/{}/{}'.format(y, m, val['_M_wdi']) if typ == 'std::chrono::year_month_weekday_last': return '{}/{}/{}'.format(y, m, val['_M_wdl']) if typ.startswith('std::chrono::hh_mm_ss'): fract = '' if val['fractional_width'] != 0: fract = '.{:0{}d}'.format(int(val['_M_ss']['_M_r']), int(val['fractional_width'])) h = int(val['_M_h']['__r']) m = int(val['_M_m']['__r']) s = int(val['_M_s']['__r']) if val['_M_is_neg']: h = -h return '{:02}:{:02}:{:02}{}'.format(h, m, s, fract) class StdChronoTimeZonePrinter(printer_base): """Print a chrono::time_zone or chrono::time_zone_link.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): str = '%s = %s' % (self._typename, self._val['_M_name']) if self._typename.endswith("_link"): str += ' -> %s' % (self._val['_M_target']) return str class StdChronoLeapSecondPrinter(printer_base): """Print a chrono::leap_second.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): date = self._val['_M_s']['__r'] neg = '+-'[date < 0] return '%s %d (%c)' % (self._typename, abs(date), neg) class StdChronoTzdbPrinter(printer_base): """Print a chrono::tzdb.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): return '%s %s' % (self._typename, self._val['version']) class StdChronoTimeZoneRulePrinter(printer_base): """Print a chrono::time_zone rule.""" def __init__(self, typename, val): self._typename = strip_versioned_namespace(typename) self._val = val def to_string(self): on = self._val['on'] kind = on['kind'] month = months[on['month']] suffixes = {1: 'st', 2: 'nd', 3: 'rd', 21: 'st', 22: 'nd', 23: 'rd', 31: 'st'} day = on['day_of_month'] ordinal_day = '{}{}'.format(day, suffixes.get(day, 'th')) if kind == 0: # DayOfMonth start = '{} {}'.format(month, ordinal_day) else: weekday = weekdays[on['day_of_week']] if kind == 1: # LastWeekDay start = 'last {} in {}'.format(weekday, month) else: if kind == 2: # LessEq direction = ('last', '<=') else: direction = ('first', '>=') day = on['day_of_month'] start = '{} {} {} {} {}'.format(direction[0], weekday, direction[1], month, ordinal_day) return 'time_zone rule {} from {} to {} starting on {}'.format( self._val['name'], self._val['from'], self._val['to'], start) class StdLocalePrinter(printer_base): """Print a std::locale.""" def __init__(self, typename, val): self._val = val self._typename = typename def to_string(self): names = self._val['_M_impl']['_M_names'] mod = '' if names[0] == 0: name = '*' else: cats = gdb.parse_and_eval(self._typename + '::_S_categories') ncat = gdb.parse_and_eval(self._typename + '::_S_categories_size') n = names[0].string() cat = cats[0].string() name = '{}={}'.format(cat, n) cat_names = {cat: n} i = 1 while i < ncat and names[i] != 0: n = names[i].string() cat = cats[i].string() name = '{};{}={}'.format(name, cat, n) cat_names[cat] = n i = i + 1 uniq_names = set(cat_names.values()) if len(uniq_names) == 1: name = n elif len(uniq_names) == 2: n1, n2 = (uniq_names) name_list = list(cat_names.values()) other = None if name_list.count(n1) == 1: name = n2 other = n1 elif name_list.count(n2) == 1: name = n1 other = n2 if other is not None: cat = next(c for c, n in cat_names.items() if n == other) mod = ' with "{}={}"'.format(cat, other) return 'std::locale = "{}"{}'.format(name, mod) class StdIntegralConstantPrinter(printer_base): """Print a std::true_type or std::false_type.""" def __init__(self, typename, val): self._val = val self._typename = typename def to_string(self): value_type = self._val.type.template_argument(0) value = self._val.type.template_argument(1) if value_type.code == gdb.TYPE_CODE_BOOL: if value: return "std::true_type" else: return "std::false_type" typename = strip_versioned_namespace(self._typename) return "{}<{}, {}>".format(typename, value_type, value) class StdTextEncodingPrinter(printer_base): """Print a std::text_encoding.""" def __init__(self, typename, val): self._val = val self._typename = typename def to_string(self): rep = self._val['_M_rep'].dereference() if rep['_M_id'] == 1: return self._val['_M_name'] if rep['_M_id'] == 2: return 'unknown' return rep['_M_name'] # A "regular expression" printer which conforms to the # "SubPrettyPrinter" protocol from gdb.printing. class RxPrinter(object): def __init__(self, name, function): super(RxPrinter, self).__init__() self.name = name self._function = function self.enabled = True def invoke(self, value): if not self.enabled: return None if value.type.code == gdb.TYPE_CODE_REF: if hasattr(gdb.Value, "referenced_value"): value = value.referenced_value() return self._function(self.name, value) # A pretty-printer that conforms to the "PrettyPrinter" protocol from # gdb.printing. It can also be used directly as an old-style printer. class Printer(object): def __init__(self, name): super(Printer, self).__init__() self.name = name self._subprinters = [] self._lookup = {} self.enabled = True self._compiled_rx = re.compile('^([a-zA-Z0-9_:]+)(<.*>)?$') def add(self, name, function): # A small sanity check. # FIXME if not self._compiled_rx.match(name): raise ValueError( 'libstdc++ programming error: "%s" does not match' % name) printer = RxPrinter(name, function) self._subprinters.append(printer) self._lookup[name] = printer # Add a name using _GLIBCXX_BEGIN_NAMESPACE_VERSION. def add_version(self, base, name, function): self.add(base + name, function) if '__cxx11' not in base: vbase = re.sub('^(std|__gnu_cxx)::', r'\g<0>%s' % _versioned_namespace, base) self.add(vbase + name, function) # Add a name using _GLIBCXX_BEGIN_NAMESPACE_CONTAINER. def add_container(self, base, name, function): self.add_version(base, name, function) self.add_version(base + '__cxx1998::', name, function) @staticmethod def get_basic_type(type): # If it points to a reference, get the reference. if type.code == gdb.TYPE_CODE_REF: type = type.target() # Get the unqualified type, stripped of typedefs. type = type.unqualified().strip_typedefs() return type.tag def __call__(self, val): typename = self.get_basic_type(val.type) if not typename: return None # All the types we match are template types, so we can use a # dictionary. match = self._compiled_rx.match(typename) if not match: return None basename = match.group(1) if val.type.code == gdb.TYPE_CODE_REF: if hasattr(gdb.Value, "referenced_value"): val = val.referenced_value() if basename in self._lookup: return self._lookup[basename].invoke(val) # Cannot find a pretty printer. Return None. return None libstdcxx_printer = None class TemplateTypePrinter(object): """ 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<T, std::allocator<T> >' with 'std::vector<T>'. """ def __init__(self, name, defargs): self.name = name self._defargs = defargs self.enabled = True class _recognizer(object): """The recognizer class for TemplateTypePrinter.""" def __init__(self, name, defargs): self.name = name self._defargs = defargs # self._type_obj = None def recognize(self, type_obj): """ 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. """ if type_obj.tag is None: return None if not type_obj.tag.startswith(self.name): return None template_args = get_template_arg_list(type_obj) displayed_args = [] require_defaulted = False for n in range(len(template_args)): # The actual template argument in the type: targ = template_args[n] # The default template argument for the class template: defarg = self._defargs.get(n) if defarg is not None: # Substitute other template arguments into the default: defarg = defarg.format(*template_args) # Fail to recognize the type (by returning None) # unless the actual argument is the same as the default. try: if targ != gdb.lookup_type(defarg): return None except gdb.error: # Type lookup failed, just use string comparison: if targ.tag != defarg: return None # All subsequent args must have defaults: require_defaulted = True elif require_defaulted: return None else: # Recursively apply recognizers to the template argument # and add it to the arguments that will be displayed: displayed_args.append(self._recognize_subtype(targ)) # This assumes no class templates in the nested-name-specifier: template_name = type_obj.tag[0:type_obj.tag.find('<')] template_name = strip_inline_namespaces(template_name) return template_name + '<' + ', '.join(displayed_args) + '>' def _recognize_subtype(self, type_obj): """Convert a gdb.Type to a string by applying recognizers, or if that fails then simply converting to a string.""" if type_obj.code == gdb.TYPE_CODE_PTR: return self._recognize_subtype(type_obj.target()) + '*' if type_obj.code == gdb.TYPE_CODE_ARRAY: type_str = self._recognize_subtype(type_obj.target()) if str(type_obj.strip_typedefs()).endswith('[]'): return type_str + '[]' # array of unknown bound return "%s[%d]" % (type_str, type_obj.range()[1] + 1) if type_obj.code == gdb.TYPE_CODE_REF: return self._recognize_subtype(type_obj.target()) + '&' if hasattr(gdb, 'TYPE_CODE_RVALUE_REF'): if type_obj.code == gdb.TYPE_CODE_RVALUE_REF: return self._recognize_subtype(type_obj.target()) + '&&' type_str = gdb.types.apply_type_recognizers( gdb.types.get_type_recognizers(), type_obj) if type_str: return type_str return str(type_obj) def instantiate(self): """Return a recognizer object for this type printer.""" return self._recognizer(self.name, self._defargs) def add_one_template_type_printer(obj, name, defargs): """ 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<std::pair<const {0}, {1}> >' } """ printer = TemplateTypePrinter('std::' + name, defargs) gdb.types.register_type_printer(obj, printer) # Add type printer for same type in debug namespace: printer = TemplateTypePrinter('std::__debug::' + name, defargs) gdb.types.register_type_printer(obj, printer) if '__cxx11' not in name: # Add second type printer for same type in versioned namespace: ns = 'std::' + _versioned_namespace # PR 86112 Cannot use dict comprehension here: defargs = dict((n, d.replace('std::', ns)) for (n, d) in defargs.items()) printer = TemplateTypePrinter(ns + name, defargs) gdb.types.register_type_printer(obj, printer) # Add type printer for same type in debug namespace: printer = TemplateTypePrinter('std::__debug::' + name, defargs) gdb.types.register_type_printer(obj, printer) class FilteringTypePrinter(object): """ 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<C, T> 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<char,...>' and not 'basic_string<wchar_t,...>'. This rejects non-matching specializations more quickly, without needing to do GDB type lookups. """ def __init__(self, template, name, targ1=None): self._template = template self.name = name self._targ1 = targ1 self.enabled = True class _recognizer(object): """The recognizer class for FilteringTypePrinter.""" def __init__(self, template, name, targ1): self._template = template self.name = name self._targ1 = targ1 self._type_obj = None def recognize(self, type_obj): """ If type_obj starts with self._template and is the same type as self.name then return self.name, otherwise None. """ if type_obj.tag is None: return None if self._type_obj is None: if self._targ1 is not None: s = '{}<{}'.format(self._template, self._targ1) if not type_obj.tag.startswith(s): # Filter didn't match. return None elif not type_obj.tag.startswith(self._template): # Filter didn't match. return None try: self._type_obj = gdb.lookup_type( self.name).strip_typedefs() except: pass if self._type_obj is None: return None t1 = gdb.types.get_basic_type(self._type_obj) t2 = gdb.types.get_basic_type(type_obj) if t1 == t2: return strip_inline_namespaces(self.name) # Workaround ambiguous typedefs matching both std:: and # std::__cxx11:: symbols. if self._template.split('::')[-1] == 'basic_string': s1 = self._type_obj.tag.replace('__cxx11::', '') s2 = type_obj.tag.replace('__cxx11::', '') if s1 == s2: return strip_inline_namespaces(self.name) return None def instantiate(self): """Return a recognizer object for this type printer.""" return self._recognizer(self._template, self.name, self._targ1) def add_one_type_printer(obj, template, name, targ1=None): printer = FilteringTypePrinter('std::' + template, 'std::' + name, targ1) gdb.types.register_type_printer(obj, printer) if '__cxx11' not in template: ns = 'std::' + _versioned_namespace printer = FilteringTypePrinter(ns + template, ns + name, targ1) gdb.types.register_type_printer(obj, printer) def register_type_printers(obj): global _use_type_printing if not _use_type_printing: return # Add type printers for typedefs std::string, std::wstring etc. for ch in (('', 'char'), ('w', 'wchar_t'), ('u8', 'char8_t'), ('u16', 'char16_t'), ('u32', 'char32_t')): add_one_type_printer(obj, 'basic_string', ch[0] + 'string', ch[1]) add_one_type_printer(obj, '__cxx11::basic_string', ch[0] + 'string', ch[1]) # Typedefs for __cxx11::basic_string used to be in namespace __cxx11: add_one_type_printer(obj, '__cxx11::basic_string', '__cxx11::' + ch[0] + 'string', ch[1]) add_one_type_printer(obj, 'basic_string_view', ch[0] + 'string_view', ch[1]) # Add type printers for typedefs std::istream, std::wistream etc. for ch in (('', 'char'), ('w', 'wchar_t')): for x in ('ios', 'streambuf', 'istream', 'ostream', 'iostream', 'filebuf', 'ifstream', 'ofstream', 'fstream'): add_one_type_printer(obj, 'basic_' + x, ch[0] + x, ch[1]) for x in ('stringbuf', 'istringstream', 'ostringstream', 'stringstream'): add_one_type_printer(obj, 'basic_' + x, ch[0] + x, ch[1]) # <sstream> types are in __cxx11 namespace, but typedefs aren't: add_one_type_printer(obj, '__cxx11::basic_' + x, ch[0] + x, ch[1]) # Add type printers for typedefs regex, wregex, cmatch, wcmatch etc. for abi in ('', '__cxx11::'): for ch in (('', 'char'), ('w', 'wchar_t')): add_one_type_printer(obj, abi + 'basic_regex', abi + ch[0] + 'regex', ch[1]) for ch in ('c', 's', 'wc', 'ws'): add_one_type_printer( obj, abi + 'match_results', abi + ch + 'match') for x in ('sub_match', 'regex_iterator', 'regex_token_iterator'): add_one_type_printer(obj, abi + x, abi + ch + x) # Note that we can't have a printer for std::wstreampos, because # it is the same type as std::streampos. add_one_type_printer(obj, 'fpos', 'streampos') # Add type printers for <chrono> typedefs. for dur in ('nanoseconds', 'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks', 'years', 'months'): add_one_type_printer(obj, 'chrono::duration', 'chrono::' + dur) # Add type printers for <random> typedefs. add_one_type_printer(obj, 'linear_congruential_engine', 'minstd_rand0') add_one_type_printer(obj, 'linear_congruential_engine', 'minstd_rand') add_one_type_printer(obj, 'mersenne_twister_engine', 'mt19937') add_one_type_printer(obj, 'mersenne_twister_engine', 'mt19937_64') add_one_type_printer(obj, 'subtract_with_carry_engine', 'ranlux24_base') add_one_type_printer(obj, 'subtract_with_carry_engine', 'ranlux48_base') add_one_type_printer(obj, 'discard_block_engine', 'ranlux24') add_one_type_printer(obj, 'discard_block_engine', 'ranlux48') add_one_type_printer(obj, 'shuffle_order_engine', 'knuth_b') # Add type printers for experimental::basic_string_view typedefs. ns = 'experimental::fundamentals_v1::' for ch in (('', 'char'), ('w', 'wchar_t'), ('u8', 'char8_t'), ('u16', 'char16_t'), ('u32', 'char32_t')): add_one_type_printer(obj, ns + 'basic_string_view', ns + ch[0] + 'string_view', ch[1]) # Do not show defaulted template arguments in class templates. add_one_template_type_printer(obj, 'unique_ptr', {1: 'std::default_delete<{0}>'}) add_one_template_type_printer(obj, 'deque', {1: 'std::allocator<{0}>'}) add_one_template_type_printer( obj, 'forward_list', {1: 'std::allocator<{0}>'}) add_one_template_type_printer(obj, 'list', {1: 'std::allocator<{0}>'}) add_one_template_type_printer( obj, '__cxx11::list', {1: 'std::allocator<{0}>'}) add_one_template_type_printer(obj, 'vector', {1: 'std::allocator<{0}>'}) add_one_template_type_printer(obj, 'map', {2: 'std::less<{0}>', 3: 'std::allocator<std::pair<{0} const, {1}>>'}) add_one_template_type_printer(obj, 'multimap', {2: 'std::less<{0}>', 3: 'std::allocator<std::pair<{0} const, {1}>>'}) add_one_template_type_printer(obj, 'set', {1: 'std::less<{0}>', 2: 'std::allocator<{0}>'}) add_one_template_type_printer(obj, 'multiset', {1: 'std::less<{0}>', 2: 'std::allocator<{0}>'}) add_one_template_type_printer(obj, 'unordered_map', {2: 'std::hash<{0}>', 3: 'std::equal_to<{0}>', 4: 'std::allocator<std::pair<{0} const, {1}>>'}) add_one_template_type_printer(obj, 'unordered_multimap', {2: 'std::hash<{0}>', 3: 'std::equal_to<{0}>', 4: 'std::allocator<std::pair<{0} const, {1}>>'}) add_one_template_type_printer(obj, 'unordered_set', {1: 'std::hash<{0}>', 2: 'std::equal_to<{0}>', 3: 'std::allocator<{0}>'}) add_one_template_type_printer(obj, 'unordered_multiset', {1: 'std::hash<{0}>', 2: 'std::equal_to<{0}>', 3: 'std::allocator<{0}>'}) def register_libstdcxx_printers(obj): """Register libstdc++ pretty-printers with objfile Obj.""" global _use_gdb_pp global libstdcxx_printer if _use_gdb_pp: gdb.printing.register_pretty_printer(obj, libstdcxx_printer) else: if obj is None: obj = gdb obj.pretty_printers.append(libstdcxx_printer) register_type_printers(obj) def build_libstdcxx_dictionary(): global libstdcxx_printer libstdcxx_printer = Printer("libstdc++-v6") # libstdc++ objects requiring pretty-printing. # In order from: # http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html libstdcxx_printer.add_version('std::', 'basic_string', StdStringPrinter) libstdcxx_printer.add_version( 'std::__cxx11::', 'basic_string', StdStringPrinter) libstdcxx_printer.add_container('std::', 'bitset', StdBitsetPrinter) libstdcxx_printer.add_container('std::', 'deque', StdDequePrinter) libstdcxx_printer.add_container('std::', 'list', StdListPrinter) libstdcxx_printer.add_container('std::__cxx11::', 'list', StdListPrinter) libstdcxx_printer.add_container('std::', 'map', StdMapPrinter) libstdcxx_printer.add_container('std::', 'multimap', StdMapPrinter) libstdcxx_printer.add_container('std::', 'multiset', StdSetPrinter) libstdcxx_printer.add_version('std::', 'pair', StdPairPrinter) libstdcxx_printer.add_version('std::', 'priority_queue', StdStackOrQueuePrinter) libstdcxx_printer.add_version('std::', 'queue', StdStackOrQueuePrinter) libstdcxx_printer.add_version('std::', 'tuple', StdTuplePrinter) libstdcxx_printer.add_container('std::', 'set', StdSetPrinter) libstdcxx_printer.add_version('std::', 'stack', StdStackOrQueuePrinter) libstdcxx_printer.add_version('std::', 'unique_ptr', UniquePointerPrinter) libstdcxx_printer.add_container('std::', 'vector', StdVectorPrinter) # vector<bool> libstdcxx_printer.add_version('std::', 'locale', StdLocalePrinter) if hasattr(gdb.Value, 'dynamic_type'): libstdcxx_printer.add_version('std::', 'error_code', StdErrorCodePrinter) libstdcxx_printer.add_version('std::', 'error_condition', StdErrorCodePrinter) # Printer registrations for classes compiled with -D_GLIBCXX_DEBUG. libstdcxx_printer.add('std::__debug::bitset', StdBitsetPrinter) libstdcxx_printer.add('std::__debug::deque', StdDequePrinter) libstdcxx_printer.add('std::__debug::list', StdListPrinter) libstdcxx_printer.add('std::__debug::map', StdMapPrinter) libstdcxx_printer.add('std::__debug::multimap', StdMapPrinter) libstdcxx_printer.add('std::__debug::multiset', StdSetPrinter) libstdcxx_printer.add('std::__debug::set', StdSetPrinter) libstdcxx_printer.add('std::__debug::vector', StdVectorPrinter) # These are the TR1 and C++11 printers. # For array - the default GDB pretty-printer seems reasonable. libstdcxx_printer.add_version('std::', 'shared_ptr', SharedPointerPrinter) libstdcxx_printer.add_version('std::', 'weak_ptr', SharedPointerPrinter) libstdcxx_printer.add_container('std::', 'unordered_map', Tr1UnorderedMapPrinter) libstdcxx_printer.add_container('std::', 'unordered_set', Tr1UnorderedSetPrinter) libstdcxx_printer.add_container('std::', 'unordered_multimap', Tr1UnorderedMapPrinter) libstdcxx_printer.add_container('std::', 'unordered_multiset', Tr1UnorderedSetPrinter) libstdcxx_printer.add_container('std::', 'forward_list', StdForwardListPrinter) libstdcxx_printer.add_version( 'std::tr1::', 'shared_ptr', SharedPointerPrinter) libstdcxx_printer.add_version( 'std::tr1::', 'weak_ptr', SharedPointerPrinter) libstdcxx_printer.add_version('std::tr1::', 'unordered_map', Tr1UnorderedMapPrinter) libstdcxx_printer.add_version('std::tr1::', 'unordered_set', Tr1UnorderedSetPrinter) libstdcxx_printer.add_version('std::tr1::', 'unordered_multimap', Tr1UnorderedMapPrinter) libstdcxx_printer.add_version('std::tr1::', 'unordered_multiset', Tr1UnorderedSetPrinter) libstdcxx_printer.add_version('std::', 'initializer_list', StdInitializerListPrinter) libstdcxx_printer.add_version('std::', 'atomic', StdAtomicPrinter) libstdcxx_printer.add_version( 'std::', 'basic_stringbuf', StdStringBufPrinter) libstdcxx_printer.add_version( 'std::__cxx11::', 'basic_stringbuf', StdStringBufPrinter) for sstream in ('istringstream', 'ostringstream', 'stringstream'): libstdcxx_printer.add_version( 'std::', 'basic_' + sstream, StdStringStreamPrinter) libstdcxx_printer.add_version( 'std::__cxx11::', 'basic_' + sstream, StdStringStreamPrinter) libstdcxx_printer.add_version('std::chrono::', 'duration', StdChronoDurationPrinter) libstdcxx_printer.add_version('std::chrono::', 'time_point', StdChronoTimePointPrinter) libstdcxx_printer.add_version('std::', 'integral_constant', StdIntegralConstantPrinter) # std::regex components libstdcxx_printer.add_version('std::__detail::', '_State', StdRegexStatePrinter) # These are the C++11 printer registrations for -D_GLIBCXX_DEBUG cases. # The tr1 namespace containers do not have any debug equivalents, # so do not register printers for them. libstdcxx_printer.add('std::__debug::unordered_map', Tr1UnorderedMapPrinter) libstdcxx_printer.add('std::__debug::unordered_set', Tr1UnorderedSetPrinter) libstdcxx_printer.add('std::__debug::unordered_multimap', Tr1UnorderedMapPrinter) libstdcxx_printer.add('std::__debug::unordered_multiset', Tr1UnorderedSetPrinter) libstdcxx_printer.add('std::__debug::forward_list', StdForwardListPrinter) # Library Fundamentals TS components libstdcxx_printer.add_version('std::experimental::fundamentals_v1::', 'any', StdExpAnyPrinter) libstdcxx_printer.add_version('std::experimental::fundamentals_v1::', 'optional', StdExpOptionalPrinter) libstdcxx_printer.add_version('std::experimental::fundamentals_v1::', 'basic_string_view', StdExpStringViewPrinter) # Filesystem TS components libstdcxx_printer.add_version('std::experimental::filesystem::v1::', 'path', StdExpPathPrinter) libstdcxx_printer.add_version('std::experimental::filesystem::v1::__cxx11::', 'path', StdExpPathPrinter) libstdcxx_printer.add_version('std::filesystem::', 'path', StdPathPrinter) libstdcxx_printer.add_version('std::filesystem::__cxx11::', 'path', StdPathPrinter) # C++17 components libstdcxx_printer.add_version('std::', 'any', StdExpAnyPrinter) libstdcxx_printer.add_version('std::', 'optional', StdExpOptionalPrinter) libstdcxx_printer.add_version('std::', 'basic_string_view', StdExpStringViewPrinter) libstdcxx_printer.add_version('std::', 'variant', StdVariantPrinter) libstdcxx_printer.add_version('std::', '_Node_handle', StdNodeHandlePrinter) # C++20 components libstdcxx_printer.add_version( 'std::', 'partial_ordering', StdCmpCatPrinter) libstdcxx_printer.add_version('std::', 'weak_ordering', StdCmpCatPrinter) libstdcxx_printer.add_version('std::', 'strong_ordering', StdCmpCatPrinter) libstdcxx_printer.add_version('std::', 'span', StdSpanPrinter) libstdcxx_printer.add_version('std::', 'basic_format_args', StdFormatArgsPrinter) for c in ['day', 'month', 'year', 'weekday', 'weekday_indexed', 'weekday_last', 'month_day', 'month_day_last', 'month_weekday', 'month_weekday_last', 'year_month', 'year_month_day', 'year_month_day_last', 'year_month_weekday', 'year_month_weekday_last', 'hh_mm_ss']: libstdcxx_printer.add_version('std::chrono::', c, StdChronoCalendarPrinter) libstdcxx_printer.add_version('std::chrono::', 'time_zone', StdChronoTimeZonePrinter) libstdcxx_printer.add_version('std::chrono::', 'time_zone_link', StdChronoTimeZonePrinter) libstdcxx_printer.add_version('std::chrono::', 'zoned_time', StdChronoZonedTimePrinter) libstdcxx_printer.add_version('std::chrono::', 'leap_second', StdChronoLeapSecondPrinter) libstdcxx_printer.add_version( 'std::chrono::', 'tzdb', StdChronoTzdbPrinter) # libstdcxx_printer.add_version('std::chrono::(anonymous namespace)', 'Rule', # StdChronoTimeZoneRulePrinter) # C++26 components libstdcxx_printer.add_version('std::', 'text_encoding', StdTextEncodingPrinter) # Extensions. libstdcxx_printer.add_version('__gnu_cxx::', 'slist', StdSlistPrinter) if True: # These shouldn't be necessary, if GDB "print *i" worked. # But it often doesn't, so here they are. libstdcxx_printer.add_container('std::', '_List_iterator', StdListIteratorPrinter) libstdcxx_printer.add_container('std::', '_List_const_iterator', StdListIteratorPrinter) libstdcxx_printer.add_version('std::', '_Rb_tree_iterator', StdRbtreeIteratorPrinter) libstdcxx_printer.add_version('std::', '_Rb_tree_const_iterator', StdRbtreeIteratorPrinter) libstdcxx_printer.add_container('std::', '_Deque_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add_container('std::', '_Deque_const_iterator', StdDequeIteratorPrinter) libstdcxx_printer.add_version('__gnu_cxx::', '__normal_iterator', StdVectorIteratorPrinter) libstdcxx_printer.add_container('std::', '_Bit_iterator', StdBitIteratorPrinter) libstdcxx_printer.add_container('std::', '_Bit_const_iterator', StdBitIteratorPrinter) libstdcxx_printer.add_container('std::', '_Bit_reference', StdBitReferencePrinter) libstdcxx_printer.add_version('__gnu_cxx::', '_Slist_iterator', StdSlistIteratorPrinter) libstdcxx_printer.add_container('std::', '_Fwd_list_iterator', StdFwdListIteratorPrinter) libstdcxx_printer.add_container('std::', '_Fwd_list_const_iterator', StdFwdListIteratorPrinter) # Debug (compiled with -D_GLIBCXX_DEBUG) printer # registrations. libstdcxx_printer.add('__gnu_debug::_Safe_iterator', StdDebugIteratorPrinter) build_libstdcxx_dictionary() PK���\����qqlibstdcxx/v6/xmethods.pynu�[���# Xmethods for libstdc++. # Copyright (C) 2014-2025 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import gdb import gdb.xmethod import re matcher_name_prefix = 'libstdc++::' def get_bool_type(): return gdb.lookup_type('bool') def get_std_size_type(): return gdb.lookup_type('std::size_t') _versioned_namespace = '__8::' def is_specialization_of(x, template_name): """ 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. """ if isinstance(x, gdb.Type): x = x.tag template_name = '(%s)?%s' % (_versioned_namespace, template_name) return re.match(r'^std::(__\d::)?%s<.*>$' % template_name, x) is not None class LibStdCxxXMethod(gdb.xmethod.XMethod): def __init__(self, name, worker_class): gdb.xmethod.XMethod.__init__(self, name) self.worker_class = worker_class # Xmethods for std::array class ArrayWorkerBase(gdb.xmethod.XMethodWorker): def __init__(self, val_type, size): self._val_type = val_type self._size = size def null_value(self): nullptr = gdb.parse_and_eval('(void *) 0') return nullptr.cast(self._val_type.pointer()).dereference() class ArraySizeWorker(ArrayWorkerBase): def __init__(self, val_type, size): ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None def get_result_type(self, obj): return get_std_size_type() def __call__(self, obj): return self._size class ArrayEmptyWorker(ArrayWorkerBase): def __init__(self, val_type, size): ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None def get_result_type(self, obj): return get_bool_type() def __call__(self, obj): return (int(self._size) == 0) class ArrayFrontWorker(ArrayWorkerBase): def __init__(self, val_type, size): ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None def get_result_type(self, obj): return self._val_type def __call__(self, obj): if int(self._size) > 0: return obj['_M_elems'][0] else: return self.null_value() class ArrayBackWorker(ArrayWorkerBase): def __init__(self, val_type, size): ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None def get_result_type(self, obj): return self._val_type def __call__(self, obj): if int(self._size) > 0: return obj['_M_elems'][self._size - 1] else: return self.null_value() class ArrayAtWorker(ArrayWorkerBase): def __init__(self, val_type, size): ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, index): return self._val_type def __call__(self, obj, index): if int(index) >= int(self._size): raise IndexError('Array index "%d" should not be >= %d.' % ((int(index), self._size))) return obj['_M_elems'][index] class ArraySubscriptWorker(ArrayWorkerBase): def __init__(self, val_type, size): ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, index): return self._val_type def __call__(self, obj, index): if int(self._size) > 0: return obj['_M_elems'][index] else: return self.null_value() class ArrayMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + 'array') self._method_dict = { 'size': LibStdCxxXMethod('size', ArraySizeWorker), 'empty': LibStdCxxXMethod('empty', ArrayEmptyWorker), 'front': LibStdCxxXMethod('front', ArrayFrontWorker), 'back': LibStdCxxXMethod('back', ArrayBackWorker), 'at': LibStdCxxXMethod('at', ArrayAtWorker), 'operator[]': LibStdCxxXMethod('operator[]', ArraySubscriptWorker), } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, 'array'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None try: value_type = class_type.template_argument(0) size = class_type.template_argument(1) except: return None return method.worker_class(value_type, size) # Xmethods for std::deque class DequeWorkerBase(gdb.xmethod.XMethodWorker): def __init__(self, val_type): self._val_type = val_type self._bufsize = 512 // val_type.sizeof or 1 def size(self, obj): start = obj['_M_impl']['_M_start'] finish = obj['_M_impl']['_M_finish'] if start['_M_cur'] == finish['_M_cur']: return 0 return (self._bufsize * (finish['_M_node'] - start['_M_node'] - 1) + (finish['_M_cur'] - finish['_M_first']) + (start['_M_last'] - start['_M_cur'])) def index(self, obj, idx): start = obj['_M_impl']['_M_start'] first_node_size = start['_M_last'] - start['_M_cur'] if idx < first_node_size: return start['_M_cur'][idx] idx = idx - first_node_size index_node = start['_M_node'][1 + int(idx) // self._bufsize] return index_node[idx % self._bufsize] class DequeEmptyWorker(DequeWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return get_bool_type() def __call__(self, obj): return (obj['_M_impl']['_M_start']['_M_cur'] == obj['_M_impl']['_M_finish']['_M_cur']) class DequeSizeWorker(DequeWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return get_std_size_type() def __call__(self, obj): return self.size(obj) class DequeFrontWorker(DequeWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return self._val_type def __call__(self, obj): return obj['_M_impl']['_M_start']['_M_cur'][0] class DequeBackWorker(DequeWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return self._val_type def __call__(self, obj): if (obj['_M_impl']['_M_finish']['_M_cur'] == obj['_M_impl']['_M_finish']['_M_first']): prev_node = obj['_M_impl']['_M_finish']['_M_node'] - 1 return prev_node[0][self._bufsize - 1] else: return obj['_M_impl']['_M_finish']['_M_cur'][-1] class DequeSubscriptWorker(DequeWorkerBase): def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, subscript): return self._val_type def __call__(self, obj, subscript): return self.index(obj, subscript) class DequeAtWorker(DequeWorkerBase): def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, index): return self._val_type def __call__(self, obj, index): deque_size = int(self.size(obj)) if int(index) >= deque_size: raise IndexError('Deque index "%d" should not be >= %d.' % (int(index), deque_size)) else: return self.index(obj, index) class DequeMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + 'deque') self._method_dict = { 'empty': LibStdCxxXMethod('empty', DequeEmptyWorker), 'size': LibStdCxxXMethod('size', DequeSizeWorker), 'front': LibStdCxxXMethod('front', DequeFrontWorker), 'back': LibStdCxxXMethod('back', DequeBackWorker), 'operator[]': LibStdCxxXMethod('operator[]', DequeSubscriptWorker), 'at': LibStdCxxXMethod('at', DequeAtWorker) } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, 'deque'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None return method.worker_class(class_type.template_argument(0)) # Xmethods for std::forward_list class ForwardListWorkerBase(gdb.xmethod.XMethodMatcher): def __init__(self, val_type, node_type): self._val_type = val_type self._node_type = node_type def get_arg_types(self): return None class ForwardListEmptyWorker(ForwardListWorkerBase): def get_result_type(self, obj): return get_bool_type() def __call__(self, obj): return obj['_M_impl']['_M_head']['_M_next'] == 0 class ForwardListFrontWorker(ForwardListWorkerBase): def get_result_type(self, obj): return self._val_type def __call__(self, obj): node = obj['_M_impl']['_M_head']['_M_next'].cast(self._node_type) val_address = node['_M_storage']['_M_storage'].address return val_address.cast(self._val_type.pointer()).dereference() class ForwardListMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): matcher_name = matcher_name_prefix + 'forward_list' gdb.xmethod.XMethodMatcher.__init__(self, matcher_name) self._method_dict = { 'empty': LibStdCxxXMethod('empty', ForwardListEmptyWorker), 'front': LibStdCxxXMethod('front', ForwardListFrontWorker) } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, 'forward_list'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None val_type = class_type.template_argument(0) node_type = gdb.lookup_type(str(class_type) + '::_Node').pointer() return method.worker_class(val_type, node_type) # Xmethods for std::list class ListWorkerBase(gdb.xmethod.XMethodWorker): def __init__(self, val_type, node_type): self._val_type = val_type self._node_type = node_type def get_arg_types(self): return None def get_value_from_node(self, node): node = node.dereference() if node.type.fields()[1].name == '_M_data': # C++03 implementation, node contains the value as a member return node['_M_data'] # C++11 implementation, node stores value in __aligned_membuf addr = node['_M_storage'].address return addr.cast(self._val_type.pointer()).dereference() class ListEmptyWorker(ListWorkerBase): def get_result_type(self, obj): return get_bool_type() def __call__(self, obj): base_node = obj['_M_impl']['_M_node'] if base_node['_M_next'] == base_node.address: return True else: return False class ListSizeWorker(ListWorkerBase): def get_result_type(self, obj): return get_std_size_type() def __call__(self, obj): begin_node = obj['_M_impl']['_M_node']['_M_next'] end_node = obj['_M_impl']['_M_node'].address size = 0 while begin_node != end_node: begin_node = begin_node['_M_next'] size += 1 return size class ListFrontWorker(ListWorkerBase): def get_result_type(self, obj): return self._val_type def __call__(self, obj): node = obj['_M_impl']['_M_node']['_M_next'].cast(self._node_type) return self.get_value_from_node(node) class ListBackWorker(ListWorkerBase): def get_result_type(self, obj): return self._val_type def __call__(self, obj): prev_node = obj['_M_impl']['_M_node']['_M_prev'].cast(self._node_type) return self.get_value_from_node(prev_node) class ListMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + 'list') self._method_dict = { 'empty': LibStdCxxXMethod('empty', ListEmptyWorker), 'size': LibStdCxxXMethod('size', ListSizeWorker), 'front': LibStdCxxXMethod('front', ListFrontWorker), 'back': LibStdCxxXMethod('back', ListBackWorker) } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, '(__cxx11::)?list'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None val_type = class_type.template_argument(0) node_type = gdb.lookup_type(str(class_type) + '::_Node').pointer() return method.worker_class(val_type, node_type) # Xmethods for std::vector class VectorWorkerBase(gdb.xmethod.XMethodWorker): def __init__(self, val_type): self._val_type = val_type def size(self, obj): if self._val_type.code == gdb.TYPE_CODE_BOOL: start = obj['_M_impl']['_M_start']['_M_p'] finish = obj['_M_impl']['_M_finish']['_M_p'] finish_offset = obj['_M_impl']['_M_finish']['_M_offset'] bit_size = start.dereference().type.sizeof * 8 return (finish - start) * bit_size + finish_offset else: return obj['_M_impl']['_M_finish'] - obj['_M_impl']['_M_start'] def get(self, obj, index): if self._val_type.code == gdb.TYPE_CODE_BOOL: start = obj['_M_impl']['_M_start']['_M_p'] bit_size = start.dereference().type.sizeof * 8 valp = start + index // bit_size offset = index % bit_size return (valp.dereference() & (1 << offset)) > 0 else: return obj['_M_impl']['_M_start'][index] class VectorEmptyWorker(VectorWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return get_bool_type() def __call__(self, obj): return int(self.size(obj)) == 0 class VectorSizeWorker(VectorWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return get_std_size_type() def __call__(self, obj): return self.size(obj) class VectorFrontWorker(VectorWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return self._val_type def __call__(self, obj): return self.get(obj, 0) class VectorBackWorker(VectorWorkerBase): def get_arg_types(self): return None def get_result_type(self, obj): return self._val_type def __call__(self, obj): return self.get(obj, int(self.size(obj)) - 1) class VectorAtWorker(VectorWorkerBase): def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, index): return self._val_type def __call__(self, obj, index): size = int(self.size(obj)) if int(index) >= size: raise IndexError('Vector index "%d" should not be >= %d.' % ((int(index), size))) return self.get(obj, int(index)) class VectorSubscriptWorker(VectorWorkerBase): def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, subscript): return self._val_type def __call__(self, obj, subscript): return self.get(obj, int(subscript)) class VectorMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + 'vector') self._method_dict = { 'size': LibStdCxxXMethod('size', VectorSizeWorker), 'empty': LibStdCxxXMethod('empty', VectorEmptyWorker), 'front': LibStdCxxXMethod('front', VectorFrontWorker), 'back': LibStdCxxXMethod('back', VectorBackWorker), 'at': LibStdCxxXMethod('at', VectorAtWorker), 'operator[]': LibStdCxxXMethod('operator[]', VectorSubscriptWorker), } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, 'vector'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None return method.worker_class(class_type.template_argument(0)) # Xmethods for associative containers class AssociativeContainerWorkerBase(gdb.xmethod.XMethodWorker): def __init__(self, unordered): self._unordered = unordered def node_count(self, obj): if self._unordered: return obj['_M_h']['_M_element_count'] else: return obj['_M_t']['_M_impl']['_M_node_count'] def get_arg_types(self): return None class AssociativeContainerEmptyWorker(AssociativeContainerWorkerBase): def get_result_type(self, obj): return get_bool_type() def __call__(self, obj): return int(self.node_count(obj)) == 0 class AssociativeContainerSizeWorker(AssociativeContainerWorkerBase): def get_result_type(self, obj): return get_std_size_type() def __call__(self, obj): return self.node_count(obj) class AssociativeContainerMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self, name): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + name) self._name = name self._method_dict = { 'size': LibStdCxxXMethod('size', AssociativeContainerSizeWorker), 'empty': LibStdCxxXMethod('empty', AssociativeContainerEmptyWorker), } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, self._name): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None unordered = 'unordered' in self._name return method.worker_class(unordered) # Xmethods for std::unique_ptr class UniquePtrGetWorker(gdb.xmethod.XMethodWorker): """ Implement std::unique_ptr<T>::get() and std::unique_ptr<T>::operator->(). """ def __init__(self, elem_type): self._is_array = elem_type.code == gdb.TYPE_CODE_ARRAY if self._is_array: self._elem_type = elem_type.target() else: self._elem_type = elem_type def get_arg_types(self): return None def get_result_type(self, obj): return self._elem_type.pointer() def _supports(self, method_name): # operator-> is not supported for unique_ptr<T[]> return method_name == 'get' or not self._is_array def __call__(self, obj): impl_type = obj.dereference().type.fields()[0].type.tag # Check for new implementations first: if is_specialization_of(impl_type, '__uniq_ptr_(data|impl)'): tuple_member = obj['_M_t']['_M_t'] elif is_specialization_of(impl_type, 'tuple'): tuple_member = obj['_M_t'] else: return None tuple_impl_type = tuple_member.type.fields()[0].type # _Tuple_impl tuple_head_type = tuple_impl_type.fields()[1].type # _Head_base head_field = tuple_head_type.fields()[0] if head_field.name == '_M_head_impl': return tuple_member.cast(tuple_head_type)['_M_head_impl'] elif head_field.is_base_class: return tuple_member.cast(head_field.type) else: return None class UniquePtrDerefWorker(UniquePtrGetWorker): """Implement std::unique_ptr<T>::operator*().""" def __init__(self, elem_type): UniquePtrGetWorker.__init__(self, elem_type) def get_result_type(self, obj): return self._elem_type def _supports(self, method_name): # operator* is not supported for unique_ptr<T[]> return not self._is_array def __call__(self, obj): return UniquePtrGetWorker.__call__(self, obj).dereference() class UniquePtrSubscriptWorker(UniquePtrGetWorker): """Implement std::unique_ptr<T>::operator[](size_t).""" def __init__(self, elem_type): UniquePtrGetWorker.__init__(self, elem_type) def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, index): return self._elem_type def _supports(self, method_name): # operator[] is only supported for unique_ptr<T[]> return self._is_array def __call__(self, obj, index): return UniquePtrGetWorker.__call__(self, obj)[index] class UniquePtrMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + 'unique_ptr') self._method_dict = { 'get': LibStdCxxXMethod('get', UniquePtrGetWorker), 'operator->': LibStdCxxXMethod('operator->', UniquePtrGetWorker), 'operator*': LibStdCxxXMethod('operator*', UniquePtrDerefWorker), 'operator[]': LibStdCxxXMethod('operator[]', UniquePtrSubscriptWorker), } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, 'unique_ptr'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None worker = method.worker_class(class_type.template_argument(0)) if worker._supports(method_name): return worker return None # Xmethods for std::shared_ptr class SharedPtrGetWorker(gdb.xmethod.XMethodWorker): """ Implements std::shared_ptr<T>::get() and std::shared_ptr<T>::operator->(). """ def __init__(self, elem_type): self._is_array = elem_type.code == gdb.TYPE_CODE_ARRAY if self._is_array: self._elem_type = elem_type.target() else: self._elem_type = elem_type def get_arg_types(self): return None def get_result_type(self, obj): return self._elem_type.pointer() def _supports(self, method_name): # operator-> is not supported for shared_ptr<T[]> return method_name == 'get' or not self._is_array def __call__(self, obj): return obj['_M_ptr'] class SharedPtrDerefWorker(SharedPtrGetWorker): """Implement std::shared_ptr<T>::operator*().""" def __init__(self, elem_type): SharedPtrGetWorker.__init__(self, elem_type) def get_result_type(self, obj): return self._elem_type def _supports(self, method_name): # operator* is not supported for shared_ptr<T[]> return not self._is_array def __call__(self, obj): return SharedPtrGetWorker.__call__(self, obj).dereference() class SharedPtrSubscriptWorker(SharedPtrGetWorker): """Implement std::shared_ptr<T>::operator[](size_t).""" def __init__(self, elem_type): SharedPtrGetWorker.__init__(self, elem_type) def get_arg_types(self): return get_std_size_type() def get_result_type(self, obj, index): return self._elem_type def _supports(self, method_name): # operator[] is only supported for shared_ptr<T[]> return self._is_array def __call__(self, obj, index): # Check bounds if _elem_type is an array of known bound m = re.match(r'.*\[(\d+)]$', str(self._elem_type)) if m and index >= int(m.group(1)): raise IndexError('shared_ptr<%s> index "%d" should not be >= %d.' % (self._elem_type, int(index), int(m.group(1)))) return SharedPtrGetWorker.__call__(self, obj)[index] class SharedPtrUseCountWorker(gdb.xmethod.XMethodWorker): """Implement std::shared_ptr<T>::use_count().""" def __init__(self, elem_type): pass def get_arg_types(self): return None def get_result_type(self, obj): return gdb.lookup_type('long') def _supports(self, method_name): return True def __call__(self, obj): refcounts = obj['_M_refcount']['_M_pi'] return refcounts['_M_use_count'] if refcounts else 0 class SharedPtrUniqueWorker(SharedPtrUseCountWorker): """Implement std::shared_ptr<T>::unique().""" def __init__(self, elem_type): SharedPtrUseCountWorker.__init__(self, elem_type) def get_result_type(self, obj): return gdb.lookup_type('bool') def __call__(self, obj): return SharedPtrUseCountWorker.__call__(self, obj) == 1 class SharedPtrMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): gdb.xmethod.XMethodMatcher.__init__(self, matcher_name_prefix + 'shared_ptr') self._method_dict = { 'get': LibStdCxxXMethod('get', SharedPtrGetWorker), 'operator->': LibStdCxxXMethod('operator->', SharedPtrGetWorker), 'operator*': LibStdCxxXMethod('operator*', SharedPtrDerefWorker), 'operator[]': LibStdCxxXMethod('operator[]', SharedPtrSubscriptWorker), 'use_count': LibStdCxxXMethod('use_count', SharedPtrUseCountWorker), 'unique': LibStdCxxXMethod('unique', SharedPtrUniqueWorker), } self.methods = [self._method_dict[m] for m in self._method_dict] def match(self, class_type, method_name): if not is_specialization_of(class_type, 'shared_ptr'): return None method = self._method_dict.get(method_name) if method is None or not method.enabled: return None worker = method.worker_class(class_type.template_argument(0)) if worker._supports(method_name): return worker return None def register_libstdcxx_xmethods(locus): gdb.xmethod.register_xmethod_matcher(locus, ArrayMethodsMatcher()) gdb.xmethod.register_xmethod_matcher(locus, ForwardListMethodsMatcher()) gdb.xmethod.register_xmethod_matcher(locus, DequeMethodsMatcher()) gdb.xmethod.register_xmethod_matcher(locus, ListMethodsMatcher()) gdb.xmethod.register_xmethod_matcher(locus, VectorMethodsMatcher()) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('set')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('map')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('multiset')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('multimap')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('unordered_set')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('unordered_map')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('unordered_multiset')) gdb.xmethod.register_xmethod_matcher( locus, AssociativeContainerMethodsMatcher('unordered_multimap')) gdb.xmethod.register_xmethod_matcher(locus, UniquePtrMethodsMatcher()) gdb.xmethod.register_xmethod_matcher(locus, SharedPtrMethodsMatcher()) PK���\��2libstdcxx/__init__.pynu�[��� PK���\�@JY��3libstdcxx/__pycache__/__init__.cpython-36.opt-1.pycnu�[���PK���\�@JY��-�libstdcxx/__pycache__/__init__.cpython-36.pycnu�[���PK���\ �B�666�libstdcxx/v6/__pycache__/__init__.cpython-36.opt-1.pycnu�[���PK���\ �B�660\libstdcxx/v6/__pycache__/__init__.cpython-36.pycnu�[���PK���\�3,�xexe6�libstdcxx/v6/__pycache__/printers.cpython-36.opt-1.pycnu�[���PK���\�3,�xexe0�llibstdcxx/v6/__pycache__/printers.cpython-36.pycnu�[���PK���\��e��6��libstdcxx/v6/__pycache__/xmethods.cpython-36.opt-1.pycnu�[���PK���\��e��0�alibstdcxx/v6/__pycache__/xmethods.cpython-36.pycnu�[���PK���\ܯ�}}:�libstdcxx/v6/__init__.pynu�[���PK���\C�B�������libstdcxx/v6/printers.pynu�[���PK���\����qq<�libstdcxx/v6/xmethods.pynu�[���PK���\��2�libstdcxx/__init__.pynu�[���PK��
/home/emeraadmin/www/node_modules/form-data/../make-iterator/../../test/../4d695/python.zip