Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.224.139.33
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : debugger.cpython-311.pyc
�

Tf�Q���dZddlZddlZddlTddlmZmZddlmZddl	m
Z
ddlmZGd�d	ej
��Zd
�Zd�ZGd�d
��ZGd�de
��ZGd�d��ZedkrddlmZeddd���dSdS)a�Debug user code with a GUI interface to a subclass of bdb.Bdb.

The Idb idb and Debugger gui instances each need a reference to each
other or to an rpc proxy for each other.

If IDLE is started with '-n', so that user code and idb both run in the
IDLE process, Debugger is called without an idb.  Debugger.__init__
calls Idb with its incomplete self.  Idb.__init__ stores gui and gui
then stores idb.

If IDLE is started normally, so that user code executes in a separate
process, debugger_r.start_remote_debugger is called, executing in the
IDLE process.  It calls 'start the debugger' in the remote process,
which calls Idb with a gui proxy.  Then Debugger is called in the IDLE
for more.
�N)�*)�Frame�	Scrollbar)�macosx)�ScrolledList)�ListedToplevelc�.��eZdZdZ�fd�Zd�Zd�Z�xZS)�Idbz6Supply user_line and user_exception functions for Bdb.c�V��||_t�����dS�N)�gui�super�__init__)�selfr
�	__class__s  ��9/usr/local/python-3.11/lib/python3.11/idlelib/debugger.pyrzIdb.__init__ s&������
����������c���t|��r|���dSt|��}	|j�||��dS#t
$rYdSwxYw)zmHandle a user stopping or breaking at a line.

        Convert frame to a string and send it to gui.
        N)�_in_rpc_code�set_step�_frame2messager
�interaction�TclError)r�frame�messages   r�	user_linez
Idb.user_line$sx��
����	��M�M�O�O�O��F� ��'�'��	��H� � ��%�0�0�0�0�0���	�	�	��D�D�	���s�A�
A!� A!c��t|��r|���dSt|��}|j�|||��dS)z)Handle an the occurrence of an exception.N)rrrr
r)rr�exc_infors    r�user_exceptionzIdb.user_exception2sQ������	��M�M�O�O�O��F� ��'�'������W�e�X�6�6�6�6�6r)�__name__�
__module__�__qualname__�__doc__rrr�
__classcell__)rs@rr
r
s\�������<�<���������7�7�7�7�7�7�7rr
c��|jj�d��rdS|j}|�dS|jj}d|vrd|vrdSt	|��S)z)Determine if debugger is within RPC code.zrpc.pyTNF�idlelib�debugger)�f_code�co_filename�count�f_backr)r�
prev_frame�	prev_names   rrr:si���|��%�%�h�/�/�(��t��\�
����5��%�1�	��	�!�!�j�I�&=�&=��5��J�'�'�'rc��|j}|j}|j}tj�|��}|�d|��}|jdkr
|�d|j�d�}|S)z"Return a message string for frame.�:�?�: z())r(r)�f_lineno�os�path�basename�co_name)r�code�filename�linenor5rs      rrrIsj���<�D���H�
�^�F��w����)�)�H��$�$�F�$�$�G��|�s����0�0���0�0�0���Nrc��eZdZdZdZdZdZdZdZdZ	dZ
dd�Zd�Zdd�Z
d�Zdd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Z d�Z!dS)�Debuggerz�The debugger interface.

    This class handles the drawing of the debugger window and
    the interactions with the underlying debugger session.
    Nc��|�t|��}||_||_d|_|���d|_d|_dS)aInstantiate and draw a debugger window.

        :param pyshell: An instance of the PyShell Window
        :type  pyshell: :class:`idlelib.pyshell.PyShell`

        :param idb: An instance of the IDLE debugger (optional)
        :type  idb: :class:`idlelib.debugger.Idb`
        NFr)r
�pyshell�idbr�make_gui�interacting�
nesting_level)rr=r>s   rrzDebugger.__init__csL���;��d�)�)�C���������
��
�
���� �������rc������jdkr5�����j�d��fd���dS	d�_�jj��d�_S#d�_wxYw)zRun the debugger.r�dc����j��Sr)�run)�argsrs��r�<lambda>zDebugger.run.<locals>.<lambda>�s������4��rNTF)rA�
abort_loop�root�afterr@r>rE)rrFs``rrEzDebugger.runus�����>���!�!��O�O�����I�O�O�C�!8�!8�!8�!8�!8�9�9�9��F�	%�#�D���4�8�<��&�$�D����u�D��$�$�$�$s�A!�!	A*c�H�	|���n#t$rYnwxYw|jr|j���dS|jr |j���d|_|j���|j�	��dS)zClose the debugger and window.N)
�quit�	Exceptionr@�top�bell�stackviewer�closer=�close_debugger�destroy�r�events  rrQzDebugger.close�s���	��I�I�K�K�K�K���	�	�	��D�	������	��H�M�M�O�O�O��F���	>���"�"�$�$�$��d�&6�	
��#�#�%�%�%���������s��
$�$c��|j}|j|_|jx|_}t|��x|_}|j�d��|j�d��|�d|j��|j�	d|j��t|��x|_}|j�d���gx|_
}t|d|j���x|_}|�|��t|d	|j���x|_}|�|��t|d
|j���x|_}|�|��t|d|j���x|_}|�|��t|d|j���x|_}|�|��|D].}|�d
���|�d����/t|��x|_}|j�d���|js3t9|��|j_|j�d��t?|d|j |j���|_!|j!�"dd���|j#st9|��|j_#t?|d|j$|j#���|_%|j%�"dd���|j&s3t9|��|j_&|j&�d��t?|d|j'|j&���|_(|j(�"dd���|j)st9|��|j_)t?|d|j*|j)���|_+|j+�"dd���tY|d���|_-|j-�d���tY|d���|_.|j.�dd���|j.�/d��|_0t|d���|_1|j1�dd���t|��|_2|j2�dd���t|d���|_3|j3�dd���|j�4��r|� ��|j&�4��r|�'��|j)�4��r|�*��dSdS) z$Draw the debugger gui on the screen.z
Debug Control�Debug�WM_DELETE_WINDOWz<Escape>�w)�anchor�Go)�text�command�Step�Over�Out�Quit�disabled��state�left)�side��Stack)r\r]�variabler��row�column�Source�Locals�Globals�x)rZ�fill�
background)�height�both��expandrqN)5r=�flistrIrrN�wm_title�wm_iconname�wm_protocolrQ�bindr�bframe�pack�buttons�Button�cont�bcont�append�step�bstep�next�bnext�ret�bretrL�	configure�cframe�vstack�
BooleanVarr�set�Checkbutton�
show_stack�bstack�grid�vsource�show_source�bsource�vlocals�show_locals�blocals�vglobals�show_globals�bglobals�Label�status�error�cget�errorbg�fstack�flocals�fglobals�get)rr=rIrNr|�bl�br�s        rr?zDebugger.make_gui�s���,���]��
�"�<�'��	�D�'��-�-�-���3�����/�*�*�*�����W�%�%�%����*�D�J�7�7�7���
�
�j�$�*�-�-�-�$�S�z�z�)���f�������$�$�$�����r���T�4�9�E�E�E�E��
�Q�
�	�	�!������V�T�Y�G�G�G�G��
�Q�
�	�	�!������V�T�Y�G�G�G�G��
�Q�
�	�	�!�����v�E�4�8�D�D�D�D��	�A�
�	�	�!�����v�F�D�I�F�F�F�F��	�A�
�	�	�!�����	 �	 �A�
�K�K�j�K�)�)�)�
�F�F��F�����$�V�}�}�,���f�����f��%�%�%��{�	�$.�s�O�O�D�N�!��K�O�O�A����!�&��$�/�D�K�I�I�I�������Q�q��)�)�)��|�	5�%/��_�_�D�N�"�"�6��4�#3�d�l�L�L�L�������a���*�*�*��|�	 �%/��_�_�D�N�"��L���Q����"�6��4�#3�d�l�L�L�L�������a���*�*�*��}�	6�&0��o�o�D�N�#�#�F��D�$5��
�O�O�O��
��
���q���+�+�+��C��,�,�,���������$�$�$��3�s�+�+�+��
��
���s���-�-�-��z���|�4�4����C��*�*�*����������/�/�/��S�z�z����������0�0�0��c�!�,�,�,��
��
���!�&��1�1�1��;�?�?���	��O�O�����<�����	��������=�����	 ���������	 �	 rc���||_|j�|���|rF|\}}}	|j}n"#t$rdt|��z}YnwxYw|�	|�d|��}n#YnxYwd}nd}d}|j}|j�||���|j}	|	r9|j	�
|j|��\}
}|	�|
|��|�d��|j
���r|���|jD]}|�d�	���|j���|xjdz
c_|jj�d
d��|xjdzc_|jD]}|�d�	���|j�d���|j�d|j���d|_dS)
N�r\z%sr1�yellow�)r\rrrg�normalrc�vwait�::idledebugwaitrb)rr�r�r �AttributeError�strr�r�rPr>�	get_stack�
load_stack�show_variablesr�r��sync_source_liner~rN�wakeuprArI�tk�call)
rrr�info�type�value�tb�m1�bg�sv�stack�ir�s
             rrzDebugger.interaction�s8����
�����7��+�+�+��	�"�O�D�%��
&��]����!�
&�
&�
&��C��I�I�%����
&����� ���)�)�%�)�)�B�B����D�����B�B��B��B���B��
���"���4�4�4�
�
��
�	$��x�)�)�$�*�b�9�9�H�E�1��M�M�%��#�#�#����A�����<�����	$��!�!�#�#�#���	(�	(�A�
�K�K�h�K�'�'�'�'��������	
���a�����	����'�#4�5�5�5����a������	*�	*�A�
�K�K�j�K�)�)�)�)�����2��&�&�&��
���"����>�>�>���
�
�
s�4�A�A�A!�!A%c��|j}|sdS|�|��\}}|dd�|dd�zdkr<tj�|��r|j�||��dSdSdS)Nrg���z<>)r�_Debugger__frame2fileliner3r4�existsrw�gotofileline)rrr8r9s    rr�zDebugger.sync_source_line.s����
���	��F��0�0��7�7���&��B�Q�B�<�(�2�3�3�-�'�4�/�/�B�G�N�N�8�4L�4L�/��J�#�#�H�f�5�5�5�5�5�0�/�/�/rc�4�|j}|j}|j}||fSr)r(r)r2)rrr7r8r9s     r�__frame2filelinezDebugger.__frame2fileline6s#���|���#��������rc�`�|j���|���dSr)r>�set_continuerH�rs rr�z
Debugger.cont<s,����������������rc�`�|j���|���dSr)r>rrHr�s rr�z
Debugger.step@�,����������������rc�l�|j�|j��|���dSr)r>�set_nextrrHr�s rr�z
Debugger.nextDs0������$�*�%�%�%��������rc�l�|j�|j��|���dSr)r>�
set_returnrrHr�s rr�zDebugger.retHs0������D�J�'�'�'��������rc�`�|j���|���dSr)r>�set_quitrHr�s rrLz
Debugger.quitLr�rc�H�|jj�ddd��dS)Nr�r��1)rIr�r�r�s rrHzDebugger.abort_loopPs%���	����%�!2�C�8�8�8�8�8rc��|js|j���rft|j|j|��x|_}|jr;|j�|jd��\}}|�	||��dSdS|j}|r4|j���sd|_|�
��d|jd<dS)Nrgrs)rPr�r��StackViewerr�rwrr>r�r�rQ)rr�r�r�s    rr�zDebugger.show_stackSs�����
	&�D�K�O�O�$5�$5�
	&�$/���T�Z��$N�$N�N�D��r��z�
(��8�-�-�d�j�$�?�?���q��
�
�e�Q�'�'�'�'�'�
(�
(��!�B��
�$�+�/�/�+�+�
�#'�� ����
�
�
�$%�D�K��!�!�!rc�d�|j���r|���dSdSr)r�r�r�r�s rr�zDebugger.show_source`s:���<�����	$��!�!�#�#�#�#�#�	$�	$rc�H�|d|_|���dS�Nr)rr�)r�	stackitems  r�
show_framezDebugger.show_frameds%���q�\��
��������rc��|j}|j���r|st|jd��|_n'|r%d|_|���d|jd<|���dS)Nrnrgrs)�localsviewerr�r��NamespaceViewerr�rQr�)r�lvs  rr�zDebugger.show_localshs��
�
���<�����	+��
L�$3�D�L�(�$K�$K��!���
+�$(��!����
�
�
�)*���X�&��������rc��|j}|j���r|st|jd��|_n'|r%d|_|���d|jd<|���dS)Nrorgrs)�
globalsviewerr�r�r�r�rQr�)r�gvs  rr�zDebugger.show_globalsts��
�
���=�����	,��
O�%4�T�]�I�%N�%N��"���
,�%)��"����
�
�
�*+��
�h�'��������rrc��|j}|j}|j}|sdx}}n|j}|j}|r|r||urd}|r&|�|||jjj��|r(|�|||jjj��dSdSr)	r�r�r�f_locals�	f_globals�	load_dictr=�interp�rpcclt)r�forcer�r�r�ldict�gdicts       rr�zDebugger.show_variables�s���
�
��
�
���
���	� � �E�E�E��N�E��O�E��
�b�
�U�e�^�^���
�	C��L�L���t�|�':�'A�B�B�B�
�	C��L�L���t�|�':�'A�B�B�B�B�B�	C�	Crc�<�|j�||��dS)zzSet a filename-lineno breakpoint in the debugger.

        Called from self.load_breakpoints and EW.setbreakpoint
        N)r>�	set_break�rr8r9s   r�set_breakpointzDebugger.set_breakpoint�s"��
	
����8�V�,�,�,�,�,rc�<�|j�||��dSr)r>�clear_breakr�s   r�clear_breakpointzDebugger.clear_breakpoint�s ������X�v�.�.�.�.�.rc�:�|j�|��dSr)r>�clear_all_file_breaks)rr8s  r�clear_file_breakszDebugger.clear_file_breaks�s����&�&�x�0�0�0�0�0rc��|jjjD]?}|jj}	|jD]}|�||����0#t$rY�<wxYwdS)z>Load PyShellEditorWindow breakpoints into subprocess debugger.N)r=rw�inversedict�ior8�breakpointsr�r�)r�editwinr8r9s    r�load_breakpointszDebugger.load_breakpoints�s����|�)�5�	�	�G��z�*�H�
�%�1�:�:�F��'�'��&�9�9�9�9�:��!�
�
�
���
����	�	s� A�
A�Ar)r)"r r!r"r#r�r�r�r�rPr�r�rrErQr?rr�r�r�r�r�r�rLrHr�r�r�r�r�r�r�r�r�r��rrr;r;Us���������
�F��G��G��H��K��L��M�����$'%�'%�'%�R����$J �J �J �X0�0�0�0�d6�6�6� � � ����������������9�9�9�&�&�&�$�$�$����
�
�
�
�
�
�C�C�C�C� -�-�-�/�/�/�1�1�1�����rr;c�J�eZdZdZd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�ZdS)
r�z#Code stack viewer for debugger GUI.c��tj��rtj||��ntj||d���||_||_g|_dS)N�P)�width)r�isAquaTkrrrwr
r�)r�masterrwr
s    rrzStackViewer.__init__�s[���?���	:�
�!�$��/�/�/�/��!�$��b�9�9�9�9���
������
�
�
rNc���||_|���tt|����D]�}||\}}	|jd}n	#d}YnxYw|j}|j}|j}	ddl}
|
�	||��}|�
��}|	dvr	d|||fz}n	d||	||fz}||krd|z}|�|����|�|�|��dSdS)Nr r0r)r0r�Nz%s, line %d: %sz%s.%s(), line %d: %sz> )
r��clear�range�lenr�r(r)r6�	linecache�getline�stripr��select)
rr��indexr�rr9�modnamer7r8�funcnamer�
sourceline�items
             rr�zStackViewer.load_stack�s2����
��
�
�����s�5�z�z�"�"�	�	�A�!�!�H�M�E�6�
��/�*�5����
���������<�D��'�H��|�H�����"�*�*�8�V�<�<�J�#�)�)�+�+�J��?�*�*�(�G�V�Z�+H�H���-��(�17��1E�E���E�z�z��d�{���K�K���������K�K��������s�
A�Ac�>�|jrtj||��SdS��Override base method.N)r�r�popup_eventrTs  rrzStackViewer.popup_event�s)���:�	9��+�D�%�8�8�8�	9�	9rc��|j}|�d|j���|�d|j���dS)rzGo to source line)�labelr]zShow stack frameN)�menu�add_command�goto_source_line�show_stack_frame)rrs  r�	fill_menuzStackViewer.fill_menu�s_���y�����2�!%�!6�	�	8�	8�	8����1�!%�!6�	�	8�	8�	8�	8�	8rc��d|cxkrt|j��kr+ndS|j�|j|��dSdS)rrN)rr�r
r��rr	s  r�	on_selectzStackViewer.on_select�sZ����'�'�'�'��D�J���'�'�'�'�'�'��H����
�5� 1�2�2�2�2�2�(�'rc�0�|�|��dSr)r�rs  r�	on_doublezStackViewer.on_double�s����������rc�d�|j�d��}|�|��dS)N�active)�listboxr	r�rs  rrzStackViewer.goto_source_line�s1����"�"�8�,�,����������rc���|j�d��}d|cxkrt|j��kr+ndS|j�|j|��dSdS)Nrr)r r	rr�r
r�rs  rrzStackViewer.show_stack_frame�so����"�"�8�,�,����'�'�'�'��D�J���'�'�'�'�'�'��H����
�5� 1�2�2�2�2�2�(�'rc�0�d|cxkrt|j��ksndS|j|\}}|j}|j}tj�|��r3|j�|��}|r|�	|��dSdSdSr�)
rr�r(r)r3r4�isfilerw�open�gotoline)rr	rr9r7r8�edits       rr�zStackViewer.show_source�s����U�,�,�,�,�S���_�_�,�,�,�,��F��
�5�)�
��v��|���#��
�7�>�>�(�#�#�	&��:�?�?�8�,�,�D��
&��
�
�f�%�%�%�%�%�	&�	&�
&�
&rr)
r r!r"r#rr�rrrrrrr�r�rrr�r��s�������)�)�
�
�
�����49�9�9�
8�8�8�3�3�3�
 � � � � � �3�3�3�
	&�	&�	&�	&�	&rr�c�,�eZdZdZdd�ZdZd	d�Zd�ZdS)
r�z/Global/local namespace viewer for debugger GUI.Nc
�@�d}d}|rdt|��z}||_||_ddl}|���|_d|j_d|j_t|��x|_	}|j	�
dd���t||dd	�
��|_|j�
d���t|d
���x|_}|�
dd���t|t!dt#d|����dd||f���x|_}	|	�
ddd���|	j|d<|j|	d<t|	��x|_}
|	�dd|
d���|_|�|��dS)Nr�(��<rgrtru��groove)r\�borderwidth�reliefrp)rq�vbar)�name�right�y)rfrq�,)rs�scrollregionre)rfrqrvr]�yscrollcommand�nw)�windowrZ)rr�title�reprlib�Repr�repr�	maxstring�maxotherrrr}r�rrr0�Canvas�min�max�canvas�yviewr��subframe�
create_window�sfidr�)rrr9�odictr�rsr:rr0rBrDs           rrzNamespaceViewer.__init__�s��������	#���E�
�
�]�F������
������L�L�N�N��	� ��	����	��"�6�]�]�*��
�U��
���q�v��.�.�.��5�u�!�H�M�M�M��
��
���S��!�!�!�$�U��8�8�8�8��	�D��	�	�w�S�	�)�)�)�%�e�-0��c�"�f�o�o�-F�-F�45�q�%��3H� J� J� J�	J���f�	����f�Q��7�7�7� �,��Y��#'�8��� �#(��=�=�0��
���(�(��A�h�t�(�L�L��	����u�����rr�rc���||jur|sdS|j}|j}t|j�����D]}|����d|_|s)t|d���}|�dd���n�|�	��}t|��}	d}
|	D]�}||}|j�|��}
|r
|
dd�}
t||���}|�|
dd���t|dd�	��}|�
d|
��|�|
dd���|
dz}
��||_|���|���}|���}|j}dd||f|jd
<|dkrd|d<|�d�
��dS||d<|�d�
��dS)N�Noner�rrjrgr�r7)rkrl�sticky)r�r.r5r4rs)rv)�
prev_odictrDr�list�children�valuesrSr�r��keys�sortedr<�Entry�insert�update_idletasks�winfo_reqwidth�winfo_reqheightrBr})rrGr��
rpc_clientrDr�c�l�	keys_list�namesrkr1r��svaluer�rsrBs                 rr�zNamespaceViewer.load_dicts���D�O�#�#�E�#��F��=���
���h�'�.�.�0�0�1�1�	�	�A�
�I�I�K�K�K�K�����	��h�V�,�,�,�A�
�F�F�q��F�#�#�#�#��
�
���I��9�%�%�E��C��
�
���d��������.�.���*�#�A�b�D�\�F��(��.�.�.�����3�q���6�6�6��(�!��;�;�;������F�#�#�#����3�q���6�6�6��!�e�������!�!�#�#�#��'�'�)�)���)�)�+�+�����'(�!�U�F�&;���N�#��C�<�<�"�F�8���J�J�a�J� � � � � �%�F�8���J�J�a�J� � � � � rc�8�|j���dSr)rrSr�s rrQzNamespaceViewer.closeRs���
�������rr)rN)r r!r"r#rrKr�rQr�rrr�r��sY������5�5�����6�J�4!�4!�4!�4!�l����rr��__main__)�mainzidlelib.idle_test.test_debuggerr,F)�	verbosity�exit)r#�bdbr3�tkinter�tkinter.ttkrrr&r�idlelib.scrolledlistr�idlelib.windowr�Bdbr
rrr;r�r�r �unittestr^r�rr�<module>rhs�����"�
�
�
�	�	�	�	�����(�(�(�(�(�(�(�(�������-�-�-�-�-�-�)�)�)�)�)�)�7�7�7�7�7�#�'�7�7�7�:
(�
(�
(�	�	�	�P�P�P�P�P�P�P�P�f
Q&�Q&�Q&�Q&�Q&�,�Q&�Q&�Q&�hW�W�W�W�W�W�W�W�t�z����������D�	*�a�e�D�D�D�D�D�D��r
© 2025 GrazzMean