Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/__pycache__/debugger.cpython-312.opt-1.pyc

�

%Μg�Q���dZddlZddlZddl�ddlmZmZddlmZddl	m
Z
ddlmZGd�d	ej�Zd
�Zd�ZGd�d
�ZGd�de
�ZGd�d�Zedk(rddlmZeddd��yy)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�0��||_t�|�	�y�N)�gui�super�__init__)�selfr
�	__class__s  ��-/usr/local/lib/python3.12/idlelib/debugger.pyrzIdb.__init__ s������
����c��t|�r|j�yt|�}	|jj	||�y#t
$rYywxYw)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$sM��
����M�M�O�� ��'��	��H�H� � ��%�0���	��	�s�A�	A�Ac��t|�r|j�yt|�}|jj	|||�y)z)Handle an the occurrence of an exception.N)rrrr
r)rr�exc_infors    r�user_exceptionzIdb.user_exception2s6������M�M�O�� ��'�������W�e�X�6r)�__name__�
__module__�__qualname__�__doc__rrr�
__classcell__)rs@rr
r
s���<���7rr
c��|jjjd�ry|j}|�y|jj}d|vrd|vryt	|�S)z)Determine if debugger is within RPC code.zrpc.pyTF�idlelib�debugger)�f_code�co_filename�count�f_backr)r�
prev_frame�	prev_names   rrr:s_���|�|���%�%�h�/���\�\�
�����%�%�1�1�	��	�!�j�I�&=���J�'�'rc���|j}|j}|j}tjj|�}|�d|��}|jdk7r|�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�w����)�H��
�!�F�8�$�G��|�|�s���I�R����~�R�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!y)�Debuggerz�The debugger interface.

    This class handles the drawing of the debugger window and
    the interactions with the underlying debugger session.
    Nc��|�t|�}||_||_d|_|j	�d|_d|_y)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__cs@���;��d�)�C���������
��
�
�� �����rc������jdkDr1�j��jjd��fd��y	d�_�j
j��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.runusc���>����!��O�O���I�I�O�O�C�!8�9��	%�#�D���4�8�8�<�<��&�$�D���u�D��s�A+�+	A4c�T�	|j�|jr|jj	�y|j
r!|j
j
�d|_|jj�|jj�y#t$rY��wxYw)zClose the debugger and window.N)
�quit�	Exceptionr@�top�bell�stackviewer�closer=�close_debugger�destroy�r�events  rrQzDebugger.close�s���	��I�I�K�����H�H�M�M�O��������"�"�$��d�&6�	
���#�#�%���������	��	�s�B�	B'�&B'c�J�|j}|j|_|jx|_}t|�x|_}|jjd�|jj
d�|jd|j�|jjd|j�t|�x|_}|jjd��gx|_
}t|d|j��x|_}|j#|�t|d	|j$��x|_}|j#|�t|d
|j(��x|_}|j#|�t|d|j,��x|_}|j#|�t|d|j0��x|_}|j#|�|D]&}|j3d
��|jd���(t|�x|_}|j4jd��|j6s5t9|�|j:_|j6j=d�t?|d|j@|j6��|_!|jBjEdd��|jFst9|�|j:_#t?|d|jH|jF��|_%|jJjEdd��|jLs5t9|�|j:_&|jLj=d�t?|d|jN|jL��|_(|jPjEdd��|jRst9|�|j:_)t?|d|jT|jR��|_+|jVjEdd��tY|d��|_-|jZjd��tY|d��|_.|j\jdd��|j\j_d�|_0t|d��|_1|jbjdd��t|�|_2|jdjdd��t|d��|_3|jfjdd��|j6ji�r|jA�|jLji�r|jO�|jRji�r|jU�yy) 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�J�7����
�
�j�$�*�*�-�$�S�z�)���f��������$�����r���T�4�9�9�E�E��
�Q�
�	�	�!����V�T�Y�Y�G�G��
�Q�
�	�	�!����V�T�Y�Y�G�G��
�Q�
�	�	�!���v�E�4�8�8�D�D��	�A�
�	�	�!���v�F�D�I�I�F�F��	�A�
�	�	�!���A�
�K�K�j�K�)�
�F�F��F��� %�V�}�,���f������f��%��{�{�$.�s�O�D�N�N�!��K�K�O�O�A��!�&��$�/�/�D�K�K�I��������Q�q��)��|�|�%/��_�D�N�N�"�"�6��4�#3�#3�d�l�l�L��������a���*��|�|�%/��_�D�N�N�"��L�L���Q��"�6��4�#3�#3�d�l�l�L��������a���*��}�}�&0��o�D�N�N�#�#�F��D�$5�$5��
�
�O��
��
�
���q���+��C��,����������$��3�s�+��
��
�
���s���-��z�z���|�4����C��*�����������/��S�z�����������0��c�!�,��
��
�
���!�&��1��;�;�?�?���O�O���<�<���������=�=��������rc�0�||_|jj|��|r |\}}}	|j}|�	|�d|��}d}nd}d}|j}|jj||��|j}	|	r;|jj|j|�\}
}|	j|
|�|jd�|jj�r|j�|j D]}|jd�	��|j"j%�|xj&dz
c_|j(j*j-d
d�|xj&dzc_|j D]}|jd�	��|jjd��|jjd|j��d|_y#t$rdt|�z}Y���wxYw#Y���xYw)
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�s�����
������7��+��"�O�D�%��
&��]�]��� ���4�r�%��)�B��B��B��B����B��
�
���"���4�
�
�
��
��x�x�)�)�$�*�*�b�9�H�E�1��M�M�%��#����A���<�<�����!�!�#����A�
�K�K�h�K�'��	
������	
���a����	�	�����'�#4�5����a������A�
�K�K�j�K�)�������2��&��
�
���"�����>���
��Q"�
&��C��I�%��
&����s�G2�H�2H
�H
�Hc���|j}|sy|j|�\}}|dd|ddzdk7r=tjj	|�r|j
j
||�yyy)Nrg���z<>)r�_Debugger__frame2fileliner3r4�existsrw�gotofileline)rrr8r9s    rr�zDebugger.sync_source_line.sk���
�
�����0�0��7���&��B�Q�<�(�2�3�-�'�4�/�B�G�G�N�N�8�4L��J�J�#�#�H�f�5�5M�/rc�R�|j}|j}|j}||fSr)r(r)r2)rrr7r8r9s     r�__frame2filelinezDebugger.__frame2fileline6s*���|�|���#�#���������rc�X�|jj�|j�yr)r>�set_continuerH�rs rr�z
Debugger.cont<s�����������rc�X�|jj�|j�yr)r>rrHr�s rr�z
Debugger.step@������������rc�n�|jj|j�|j�yr)r>�set_nextrrHr�s rr�z
Debugger.nextDs"�������$�*�*�%����rc�n�|jj|j�|j�yr)r>�
set_returnrrHr�s rr�zDebugger.retHs"�������D�J�J�'����rc�X�|jj�|j�yr)r>�set_quitrHr�s rrLz
Debugger.quitLr�rc�R�|jjjddd�y)Nr�r��1)rIr�r�r�s rrHzDebugger.abort_loopPs���	�	�����%�!2�C�8rc���|js�|jj�rqt|j|j
|�x|_}|jr<|jj|jd�\}}|j||�yy|j}|r1|jj�sd|_|j�d|jd<y)Nrgrs)rPr�r��StackViewerr�rwrr>r�r�rQ)rr�r�r�s    rr�zDebugger.show_stackSs������D�K�K�O�O�$5�$/����T�Z�Z��$N�N�D��r��z�z��8�8�-�-�d�j�j�$�?���q��
�
�e�Q�'���!�!�B��$�+�+�/�/�+�#'�� ����
�$%�D�K�K��!rc�Z�|jj�r|j�yyr)r�r�r�r�s rr�zDebugger.show_source`s#���<�<�����!�!�#�rc�8�|d|_|j�y�Nr)rr�)r�	stackitems  r�
show_framezDebugger.show_frameds���q�\��
����rc��|j}|jj�r|sDt|jd�|_n(|r&d|_|j�d|jd<|j
�y)Nrnrgrs)�localsviewerr�r��NamespaceViewerr�rQr�)r�lvs  rr�zDebugger.show_localshsa��
�
�
���<�<�����$3�D�L�L�(�$K��!��$(��!����
�)*����X�&����rc��|j}|jj�r|sDt|jd�|_n(|r&d|_|j�d|jd<|j
�y)Nrorgrs)�
globalsviewerr�r�r�r�rQr�)r�gvs  rr�zDebugger.show_globalstsa��
�
�
���=�=�����%4�T�]�]�I�%N��"��%)��"����
�*+��
�
�h�'����rc�l�|j}|j}|j}|sdx}}n"|j}|j}|r|r||urd}|r1|j|||jjj�|r2|j|||jjj�yyr)	r�r�r�f_locals�	f_globals�	load_dictr=�interp�rpcclt)r�forcer�r�r�ldict�gdicts       rr�zDebugger.show_variables�s���
�
�
��
�
�
���
�
��� � �E�E��N�N�E��O�O�E��b�U�e�^���
��L�L���t�|�|�':�':�'A�'A�B�
��L�L���t�|�|�':�':�'A�'A�B�rc�<�|jj||�y)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�<�|jj||�yr)r>�clear_breakr�s   r�clear_breakpointzDebugger.clear_breakpoint�s�������X�v�.rc�:�|jj|�yr)r>�clear_all_file_breaks)rr8s  r�clear_file_breakszDebugger.clear_file_breaks�s�����&�&�x�0rc���|jjjD]<}|jj}	|j
D]}|j
||���>y#t$rY�KwxYw)z>Load PyShellEditorWindow breakpoints into subprocess debugger.N)r=rw�inversedict�ior8�breakpointsr�r�)r�editwinr8r9s    r�load_breakpointszDebugger.load_breakpoints�sd���|�|�)�)�5�5�G��z�z�*�*�H�
�%�1�1�F��'�'��&�9�2�6��
"�
��
�s�#A!�!	A-�,A-r)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 �X0�d6� ������9�&�$��
�
�C� -�/�1�rr;c�H�eZdZdZd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zy)
r�z#Code stack viewer for debugger GUI.c��tj�rtj||�ntj||d��||_||_g|_y)N�P)�width)r�isAquaTkrrrwr
r�)r�masterrwr
s    rrzStackViewer.__init__�sE���?�?��
�!�!�$��/��!�!�$��b�9���
������
rNc���||_|j�tt|��D]�}||\}}	|jd}|j
}|j}|j}	ddl}
|
j||�}|j�}|	dvr	d|||fz}n	d||	||fz}||k(rd|z}|j|���|�|j|�yy#d}Y��xYw)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�s�����
��
�
���s�5�z�"�A�!�!�H�M�E�6�
��/�/�*�5���<�<�D��'�'�H��|�|�H��"�*�*�8�V�<�J�#�)�)�+�J��?�*�(�G�V�Z�+H�H��-��(�17��1E�E���E�z��d�{���K�K���'#�(���K�K�����!
���s�C�Cc�H�|jrtj||�Sy��Override base method.N)r�r�popup_eventrTs  rrzStackViewer.popup_event�s!���:�:��+�+�D�%�8�8�rc��|j}|jd|j��|jd|j��y)rzGo to source line)�labelr]zShow stack frameN)�menu�add_command�goto_source_line�show_stack_frame)rrs  r�	fill_menuzStackViewer.fill_menu�sI���y�y�����2�!%�!6�!6�	�	8����1�!%�!6�!6�	�	8rc��d|cxkrt|j�kr,ny|jj|j|�yy)rrN)rr�r
r��rr	s  r�	on_selectzStackViewer.on_select�s7����'��D�J�J��'��H�H����
�
�5� 1�2�(rc�&�|j|�yr)r�rs  r�	on_doublezStackViewer.on_double�s������rc�\�|jjd�}|j|�y)N�active)�listboxr	r�rs  rrzStackViewer.goto_source_line�s$�����"�"�8�,������rc���|jjd�}d|cxkrt|j�kr,ny|jj|j|�yy)Nrr)r r	rr�r
r�rs  rrzStackViewer.show_stack_frame�sK�����"�"�8�,����'��D�J�J��'��H�H����
�
�5� 1�2�(rc�8�d|cxkrt|j�ksyy|j|\}}|j}|j}tj
j
|�r0|jj|�}|r|j|�yyyr�)
rr�r(r)r3r4�isfilerw�open�gotoline)rr	rr9r7r8�edits       rr�zStackViewer.show_source�s����U�,�S����_�,��-���
�
�5�)�
��v��|�|���#�#��
�7�7�>�>�(�#��:�:�?�?�8�,�D���
�
�f�%��$rr)
r r!r"r#rr�rrrrrrr�r�rrr�r��s2��)�
��49�
8�3�
 � �3�
	&rr�c�*�eZdZdZdd�ZdZdd�Zd�Zy)	r�z/Global/local namespace viewer for debugger GUI.Nc
��d}d}|rdt|�z}||_||_ddl}|j	�|_d|j
_d|j
_t|�x|_	}|jjdd��t||dd	�
�|_|jjd��t|d
��x|_}|jdd��t|t!dt#d|��dd||f��x|_}	|	jddd��|	j&|d<|j(|	d<t|	�x|_}
|	j-dd|
d��|_|j1|�y)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__�sW���������E�
�]�F������
���L�L�N��	� ��	�	����	�	��"�6�]�*��
�U��
�
���q�v��.��5�u�!�H�M��
��
�
���S��!�$�U��8�8��	�D��	�	�w�S�	�)�%�e�-0��c�"�f�o�-F�45�q�%��3H� J�	J���f�	����f�Q��7� �,�,��Y��#'�8�8��� �#(��=�0��
���(�(��A�h�t�(�L��	����u�rr�c�x�||jur|sy|j}|j}t|jj��D]}|j
��d|_|s!t|d��}|jdd��n�|j�}t|�}	d}
|	D]�}||}|jj|�}
|r|
dd}
t||��}|j|
dd��t|dd�	�}|jd|
�|j|
dd��|
dz}
��||_|j�|j�}|j!�}|j"}dd||f|j"d
<|dkDrd|d<|j%d�
�y||d<|j%d�
�y)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�O�#�E���=�=���
�
���h�'�'�.�.�0�1�A�
�I�I�K�2������h�V�,�A�
�F�F�q��F�#��
�
��I��9�%�E��C����d���������.���#�A�b�\�F��(��.�����3�q���6��(�!��;������F�#����3�q���6��!�e��� ����!�!�#��'�'�)���)�)�+������'(�!�U�F�&;����N�#��C�<�"�F�8���J�J�a�J� �%�F�8���J�J�a�J� rc�8�|jj�yr)rrSr�s rrQzNamespaceViewer.closeRs���
�
���rr)rN)r r!r"r#rrKr�rQr�rrr�r��s��5��6�J�4!�lrr��__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�:
(�	�P�P�f
Q&�,�Q&�hW�W�t�z����	*�a�e�D�r

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