Sindbad~EG File Manager

Current Path : /usr/local/share/gdb/python/gdb/command/__pycache__/
Upload File :
Current File : /usr/local/share/gdb/python/gdb/command/__pycache__/pretty_printers.cpython-311.pyc

�

��g�8����dZddlZddlZddlZd�Zd�ZGd�dej��Zd�Zd�Z	dd
�Z
d�Zd�Zd
�Z
Gd�dej��ZGd�dej��Zd�Ze��dS)z.GDB commands for working with pretty-printers.�Nc�z�tj|��}t|��}d}d}d}|dkrtd���|dkr|d}|dkr?|d�dd��}|d}t|��dkr|d}	tj|��}n #t$rtd	|z���wxYw	tj|��}n #t$rtd
|z���wxYw|�6	tj|��}	n"#t$rtd|z���wxYwd}	|||	fS)a�Internal utility to parse a pretty-printer command argv.

    Arguments:
        arg: The arguments to the command.  The format is:
             [object-regexp [name-regexp]].
             Individual printers in a collection are named as
             printer-name;subprinter-name.

    Returns:
        The result is a 3-tuple of compiled regular expressions, except that
        the resulting compiled subprinter regexp is None if not provided.

    Raises:
        SyntaxError: an error processing ARG
    �N�ztoo many arguments�r��;zinvalid object regexp: %szinvalid name regexp: %szinvalid subname regexp: %s)�gdb�string_to_argv�len�SyntaxError�split�re�compile)
�arg�argv�argc�
object_regexp�name_regexp�subname_regexp�name_subname�	object_re�name_re�
subname_res
          � ./gdb/command/pretty_printers.py�parse_printer_regexpsrs���"��c�"�"�D��t�9�9�D��M��K��N��a�x�x��.�/�/�/��q�y�y��Q��
��q�y�y��A�w�}�}�S�!�,�,��"�1�o���|����!�!�)�!�_�N�G��J�}�-�-�	�	���G�G�G��5�
�E�F�F�F�G����C��*�[�)�)�����C�C�C��3�k�A�B�B�B�C�����!�	M���N�3�3�J�J���	M�	M�	M��:�^�K�L�L�L�	M�����
��w�
�+�+s$�B(�(C�	C�C;�D�D3c�4�t|d��r|jSdS)z>Internal utility to see if printer (or subprinter) is enabled.�enabledT)�hasattrr��printers r�printer_enabled_pr!Ms!���w�	�"�"������t�c�`��eZdZdZ�fd�Zed���Zed���Zd�Zd�Z	d�Z
�xZS)�InfoPrettyPrintera�GDB command to list all registered pretty-printers.

    Usage: info pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]

    OBJECT-REGEXP is a regular expression matching the objects to list.
    Objects are "global", the program space's file, and the objfiles within
    that program space.

    NAME-REGEXP matches the name of the pretty-printer.
    Individual printers in a collection are named as
    printer-name;subprinter-name.c�n��tt|���dtj��dS)Nzinfo pretty-printer)�superr$�__init__r	�COMMAND_DATA��self�	__class__s �rr'zInfoPrettyPrinter.__init__bs.���
���&�&�/�/�0E�s�GW�X�X�X�X�Xr"c�(�t|��rdSdS)z9Return "" if PRINTER is enabled, otherwise " [disabled]".rz [disabled])r!rs r�enabled_stringz InfoPrettyPrinter.enabled_stringes���W�%�%�	!��2� �=r"c�b�t|d��r|jSt|d��r|jSdS)zReturn the printer's name.�name�__name__�unknown)rr/r0rs r�printer_namezInfoPrettyPrinter.printer_namems@���7�F�#�#�	 ��<���7�J�'�'�	$��#�#�
�yr"c	�(�ttj|��|j���}|D]�}|�|��}|�|��}|�|��r�td|�|����t
|d��r�|j�zttj|j��|j���}|D]J}	|r|�|	j��r,td|	j�|�|	�������K��dS)z Print a list of pretty-printers.)�keyz  �subprintersNz    )	�sorted�copyr2r-�match�printrr5r/)
r*�pretty_printersrr�sorted_pretty_printersr r/r�sorted_subprinters�
subprinters
          r�list_pretty_printersz&InfoPrettyPrinter.list_pretty_printerszsC��"(��I�o�&�&�D�,=�"
�"
�"
��.�	�	�G��$�$�W�-�-�D��)�)�'�2�2�G��}�}�T�"�"�
���$�$���0�1�1�1��7�M�2�2�	�w�7J�7V�)/��	�'�"5�6�6�D�<M�*�*�*�&�'9���
�)��Z�-=�-=�j�o�-N�-N��!�E�#-�?�?�D�4G�4G�
�4S�4S�4S�!U������	�	r"c��|r=|�|��r*t|��|�|||��dSdSdS)z$Subroutine of invoke to simplify it.N)r8r9r>)r*�title�printer_list�obj_name_to_matchrrrs       r�invoke1zInfoPrettyPrinter.invoke1�sc���	I�I�O�O�,=�>�>�	I��%�L�L�L��%�%�l�G�Z�H�H�H�H�H�	I�	I�	I�	Ir"c	�l�t|��\}}}|�dtjd|||��tj��}|�d|jz|jd|||��tj��D].}|�d|jz|j|j|||���/dS)�&GDB calls this to perform the command.zglobal pretty-printers:�globalzprogspace %s pretty-printers:�	progspacezobjfile %s pretty-printers:N)rrCr	r:�current_progspace�filename�objfiles)r*r�from_ttyrrr�cp�objfiles        r�invokezInfoPrettyPrinter.invoke�s���+@��+E�+E�(��G�Z����%�������
	
�	
�	
��
"�
$�
$�����+�b�k�9�������
	
�	
�	
��|�~�~�	�	�G��L�L�-��0@�@��'�� ����

�
�
�
�	�	r")r0�
__module__�__qualname__�__doc__r'�staticmethodr-r2r>rCrN�
__classcell__�r+s@rr$r$Us��������
%�
%�Y�Y�Y�Y�Y��!�!��\�!��
�
��\�
����.I�I�I�������r"r$c��d}d}|D]w}t|d��rL|j�Et|��r|jD]}t|��r|dz
}�|t|j��z
}�^t|��r|dz
}|dz
}�x||fS)z9Return a 2-tuple of number of enabled and total printers.rr5Nr)rr5r!r)r:r�totalr r=s     r�count_enabled_printersrW�s����G�
�E�"�
�
���7�M�*�*�		�w�/B�/N� ��)�)�
%�")�"5�%�%�J�(��4�4�%��1�����S��,�-�-�-�E�E� ��)�)�
��1����Q�J�E�E��U��r"c�0�d}d}ttj��\}}||z
}||z
}ttj��j��\}}||z
}||z
}tj��D]#}t|j��\}}||z
}||z
}�$||fS)zkReturn a 2-tuble of the enabled state and total number of all printers.
    This includes subprinters.
    r)rWr	r:rHrJ)�
enabled_count�total_count�	t_enabled�t_totalrMs     r�count_all_enabled_printersr]�s����M��K�1�#�2E�F�F��Y���Y��M��7��K�1�����/����Y���Y��M��7��K��<�>�>����5�g�6M�N�N���G���"�
��w�����;�'�'r"�sc��|dkr|�|��S|S)z!Return TEXT pluralized if N != 1.r�)�text�n�suffixs   r�	pluralizerd�s���A�v�v���v�v�&�&��r"c�P�t��\}}td||fz��dS)zZPrint the number of printers enabled/disabled.
    We count subprinters individually.
    z%d of %d printers enabledN)r]r9)rYrZs  r�#show_pretty_printer_enabled_summaryrf�s3��$>�#?�#?� �]�K�	�
%���(D�
D�E�E�E�E�Er"c�L�d}|D�]}t|d��r|�|j��s*t|d��r�|�|j��r�t|d��r�|j��|s9t|��|kr|jD]}t|��r|dz
}�||_��|jD]J}|�|j��r.t|��rt|��|kr|dz
}||_�K��|st|��|kr|dz
}||_��|S)a�Worker for enabling/disabling pretty-printers.

    Arguments:
        pretty_printers: list of pretty-printers
        name_re: regular-expression object to select printers
        subname_re: regular expression object to select subprinters or None
                    if all are affected
        flag: True for Enable, False for Disable

    Returns:
        The number of printers affected.
        This is just for informational purposes for the user.
    rr/r0r5Nr)rr8r/r0r5r!r)r:rr�flagrVr r=s       r�do_enable_pretty_printer_1ri�st��
�E�"�,+�,+���G�V�$�$�+	+��
�
�g�l�+�+�+	+��w�
�+�+�+	+��
�
�g�.�/�/�	+	+��w�
�.�.�%
+�7�3F�3R�!�6�(��1�1�T�9�9�*1�*=�+�+�J�0��<�<�+� %��
���&*�G�O�O�
'.�&9�6�6�
�%�+�+�J�O�<�<�6�!2�'� :� :�+�$5�j�$A�$A�T�$I�$I� %��
��15�J�.��6�("�+�(��1�1�T�9�9���
��&*�G�O���Lr"c� �t|��\}}}d}|�d��r|ttj|||��z
}tj��}|�d��r|t|j|||��z
}tj��D]6}|�|j��r|t|j|||��z
}�7|rd}nd}td|td|��|fz��t��dS)	z7Internal worker for enabling/disabling pretty-printers.rrFrGr�disabledz%d %s %sr N)rr8rir	r:rHrJrIr9rdrf)	rrhrrrrVrLrM�states	         r�do_enable_pretty_printerrm.s9��'<�S�'A�'A�$�Y���
�E����x� � �
�
�+����*�d�
�
�	
��

�	�	 �	 �B����{�#�#�
�
�+�����T�
�
�	
���<�>�>�����?�?�7�+�,�,�	��/��'��*�d���
�E���������	�*��y��E�:�:�E�B�
B�C�C�C�
(�)�)�)�)�)r"c�(��eZdZdZ�fd�Zd�Z�xZS)�EnablePrettyPrintera�GDB command to enable the specified pretty-printer.

    Usage: enable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]

    OBJECT-REGEXP is a regular expression matching the objects to examine.
    Objects are "global", the program space's file, and the objfiles within
    that program space.

    NAME-REGEXP matches the name of the pretty-printer.
    Individual printers in a collection are named as
    printer-name;subprinter-name.c�n��tt|���dtj��dS)Nzenable pretty-printer)r&ror'r	r(r)s �rr'zEnablePrettyPrinter.__init__ds8���
�!�4�(�(�1�1�#�S�%5�	
�	
�	
�	
�	
r"c�&�t|d��dS)rETN�rm�r*rrKs   rrNzEnablePrettyPrinter.invokeis�� ��d�+�+�+�+�+r"�r0rOrPrQr'rNrSrTs@rroroWsQ�������
%�
%�
�
�
�
�
�
,�,�,�,�,�,�,r"roc�(��eZdZdZ�fd�Zd�Z�xZS)�DisablePrettyPrintera�GDB command to disable the specified pretty-printer.

    Usage: disable pretty-printer [OBJECT-REGEXP [NAME-REGEXP]]

    OBJECT-REGEXP is a regular expression matching the objects to examine.
    Objects are "global", the program space's file, and the objfiles within
    that program space.

    NAME-REGEXP matches the name of the pretty-printer.
    Individual printers in a collection are named as
    printer-name;subprinter-name.c�n��tt|���dtj��dS)Nzdisable pretty-printer)r&rvr'r	r(r)s �rr'zDisablePrettyPrinter.__init__{s8���
�"�D�)�)�2�2�$�c�&6�	
�	
�	
�	
�	
r"c�&�t|d��dS)rEFNrrrss   rrNzDisablePrettyPrinter.invoke�s�� ��e�,�,�,�,�,r"rtrTs@rrvrvnsQ�������
%�
%�
�
�
�
�
�
-�-�-�-�-�-�-r"rvc�Z�t��t��t��dS)zDCall from a top level script to install the pretty-printer commands.N)r$rorvr`r"r� register_pretty_printer_commandsrz�s,���������������r")r^)rQr7rr	rr!�Commandr$rWr]rdrfrirmrorvrzr`r"r�<module>r|s^��"5�4�����	�	�	�	�
�
�
�
�1,�1,�1,�h���`�`�`�`�`���`�`�`�F���$(�(�(�*����F�F�F�<�<�<�~*�*�*�R,�,�,�,�,�#�+�,�,�,�.-�-�-�-�-�3�;�-�-�-�.���!� �"�"�"�"�"r"

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists