Your IP : 3.144.1.100


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/debugger.cpython-36.opt-2.pyc

3

��2a�J�@s�ddlZddlZddlTddlmZddlmZddlmZddl	m
Z
Gdd�dej�ZGd	d
�d
�Z
Gdd�de�ZGd
d�d�Zedkr�ddlmZedddd�dS)�N)�*)�	Scrollbar)�macosx)�ScrolledList)�ListedToplevelc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�IdbcCs||_tjj|�dS)N)�gui�bdb�Bdb�__init__)�selfr�r
�-/opt/alt/python36/lib64/python3.6/debugger.pyrszIdb.__init__cCsL|j|�r|j�dS|j|�}y|jj||�Wntk
rFYnXdS)N)�in_rpc_code�set_step�_Idb__frame2messager�interactionZTclError)r�frame�messager
r
r�	user_lines

z
Idb.user_linecCs4|j|�r|j�dS|j|�}|jj|||�dS)N)rrrrr)rr�inforr
r
r�user_exceptions


zIdb.user_exceptioncCsB|jjjd�rdS|j}|jj}d|kr4d|kr4dS|j|�SdS)Nzrpc.pyT�idlelibZdebuggerF)�f_code�co_filename�count�f_backr)rrZ
prev_frameZ	prev_namer
r
rr#szIdb.in_rpc_codecCsF|j}|j}|j}tjj|�}d||f}|jdkrBd||jf}|S)Nz%s:%s�?z%s: %s())rr�f_lineno�os�path�basename�co_name)rr�code�filename�linenor!rr
r
rZ__frame2message/s
zIdb.__frame2messageN)�__name__�
__module__�__qualname__rrrrrr
r
r
rrs

rc@s�eZdZdZZZZd1dd�Zdd�Zd2dd�Z	dd	�Z
d3d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdZdd�Zdd�Zd d!�ZdZdZd"d#�Zd$d%�Zd4d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z dS)5�DebuggerNcCs:|dkrt|�}||_||_d|_|j�d|_d|_dS)Nr)r�pyshell�idbr�make_gui�interacting�
nesting_level)rr*r+r
r
rr>szDebugger.__init__csN�jdkr.�j��jjd��fdd��dSzd�_�jj��Sd�_XdS)Nr�dcs
�j��S)N)�runr
)�argsrr
r�<lambda>hszDebugger.run.<locals>.<lambda>�)r.�
abort_loop�root�afterr-r+r0)rr1r
)r1rrr0Hs
zDebugger.runcCsdy|j�Wntk
r YnX|jr6|jj�dS|jrL|jj�d|_|jj�|jj	�dS)N)
�quit�	Exceptionr-�topZbell�stackviewer�closer*Zclose_debugger�destroy)r�eventr
r
rr;ps


zDebugger.closecCsF|j}|j|_|j|_}t|�|_}|jjd�|jjd�|jd|j�|jj	d|j�t
|�|_}|jjdd�g|_
}t|d|jd�|_}|j|�t|d	|jd�|_}|j|�t|d
|jd�|_}|j|�t|d|jd�|_}|j|�t|d|jd�|_}|j|�x&|D]}|jd
d�|jdd��q*Wt
|�|_}|jjdd�|j�s�t|�|j_|jjd�t|d|j |jd�|_!|j!j"ddd�|j#�s�t|�|j_#t|d|j$|j#d�|_%|j%j"ddd�|j&�st|�|j_&|j&jd�t|d|j'|j&d�|_(|j(j"ddd�|j)�sBt|�|j_)t|d|j*|j)d�|_+|j+j"ddd�t,|dd�|_-|j-jdd�t,|dd�|_.|j.jddd�|j.j/d�|_0t
|dd�|_1|j1jddd�t
|�|_2|j2jddd�t
|dd�|_3|j3jddd�|jj4��r|j �|j&j4��r.|j'�|j)j4��rB|j*�dS)Nz
Debug ControlZDebugZWM_DELETE_WINDOWz<Escape>�w)�anchorZGo)�text�commandZStepZOverZOutZQuit�disabled)�state�left)�sider3ZStack)r@rA�variabler)�row�columnZSource�Locals�Globals�x)r?�fill�
background)�height�both)�expandrL)5r*�flistr5rr9Zwm_titleZwm_iconnameZwm_protocolr;Zbind�Frame�bframe�pack�buttonsZButton�contZbcont�append�stepZbstep�nextZbnext�retZbretr7�	configure�cframe�vstackZ
BooleanVar�	__class__�setZCheckbutton�
show_stackZbstack�grid�vsource�show_sourceZbsource�vlocals�show_localsZblocals�vglobals�show_globalsZbglobals�Label�status�errorZcget�errorbg�fstack�flocals�fglobals�get)rr*r5r9rSZbl�br\r
r
rr,�s�







zDebugger.make_guic
Cs|||_|jj|d�|r~|\}}}y
|j}Wn tk
rLdt|�}YnX|dk	rxyd|t|�f}WnYnXd}nd}d}|j}|jj||d�|j}	|	r�|j	j
|j|�\}
}|	j|
|�|jd�|j
j�r�|j�x|jD]}|jdd	�q�W|jj�|jd7_|jjjd
d�|jd8_x|jD]}|jdd	��q<W|jjdd�|jjd|jd�d|_dS)
N)r@z%sz%s: %sZyellow�)r@rMr3Znormal)rCZvwaitz::idledebugwaitrB)rrir[r&�AttributeError�strrkrjr:r+�	get_stack�
load_stack�show_variablesrbro�sync_source_linerUr9�wakeupr.r5�tk�call)
rrrr�type�value�tb�m1�bg�sv�stack�irpr
r
rr�sH




zDebugger.interactioncCsV|j}|sdS|j|�\}}|dd�|dd�dkrRtjj|�rR|jj||�dS)Nr3z<>���)r�_Debugger__frame2filelinerr �existsrQZgotofileline)rrr$r%r
r
rrw�s(zDebugger.sync_source_linecCs|j}|j}|j}||fS)N)rrr)rrr#r$r%r
r
rZ__frame2filelineszDebugger.__frame2filelinecCs|jj�|j�dS)N)r+Zset_continuer4)rr
r
rrVs
z
Debugger.contcCs|jj�|j�dS)N)r+rr4)rr
r
rrXs
z
Debugger.stepcCs|jj|j�|j�dS)N)r+Zset_nextrr4)rr
r
rrYsz
Debugger.nextcCs|jj|j�|j�dS)N)r+Z
set_returnrr4)rr
r
rrZszDebugger.retcCs|jj�|j�dS)N)r+Zset_quitr4)rr
r
rr7s
z
Debugger.quitcCs|jjjddd�dS)Nr_z::idledebugwait�1)r5ryrz)rr
r
rr4szDebugger.abort_loopcCs�|jrP|jj�rPt|j|j|�|_}|jr~|jj|jd�\}}|j	||�n.|j}|rt|jj�rtd|_|j
�d|jd<dS)Nr3rN)r:r]ro�StackViewerrlrQrr+rtrur;)rr�r�r�r
r
rr`$szDebugger.show_stackcCs|jj�r|j�dS)N)rbrorw)rr
r
rrc1s
zDebugger.show_sourcecCs|d|_|j�dS)Nr)rrv)rZ	stackitemr
r
r�
show_frame5s
zDebugger.show_framecCsL|j}|jj�r$|s@t|jd�|_n|r@d|_|j�d|jd<|j�dS)NrIr3rN)�localsviewerrdro�NamespaceViewerrmr;rv)r�lvr
r
rre<s

zDebugger.show_localscCsL|j}|jj�r$|s@t|jd�|_n|r@d|_|j�d|jd<|j�dS)NrJr3rN)�
globalsviewerrfror�rnr;rv)r�gvr
r
rrgHs

zDebugger.show_globalsrcCst|j}|j}|j}|s d}}n |j}|j}|r@|r@||kr@d}|rX|j|||jjj�|rp|j|||jjj�dS)N)	r�r�r�f_locals�	f_globals�	load_dictr*ZinterpZrpcclt)r�forcer�r�rZldictZgdictr
r
rrvTs
zDebugger.show_variablescCs|jj||�dS)N)r+Z	set_break)rr$r%r
r
r�set_breakpoint_heredszDebugger.set_breakpoint_herecCs|jj||�dS)N)r+Zclear_break)rr$r%r
r
r�clear_breakpoint_heregszDebugger.clear_breakpoint_herecCs|jj|�dS)N)r+Zclear_all_file_breaks)rr$r
r
r�clear_file_breaksjszDebugger.clear_file_breakscCsXxR|jjjD]D}|jj}y x|jD]}|j||�q"WWqtk
rNwYqXqWdS)N)r*rQZinversedict�ior$Zbreakpointsr�rr)rZeditwinr$r%r
r
r�load_breakpointsmszDebugger.load_breakpoints)N)N)N)r)!r&r'r(r]rbrdrfrr0r;r,rrwr�rVrXrYrZr7r4r:r`rcr�r�r�rergrvr�r�r�r�r
r
r
rr):s6

(
K
1

r)c@sVeZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)r�cCs<tj�rtj||�ntj||dd�||_||_g|_dS)N�P)�width)rZisAquaTkrrrQrr�)r�masterrQrr
r
rryszStackViewer.__init__Nc
Cs�||_|j�x�tt|��D]�}||\}}y|jd}Wnd}YnX|j}|j}|j}	ddl}
|
j	||�}|j
�}|	dkr�d|||f}nd||	||f}||kr�d|}|j|�qW|dk	r�|j|�dS)	Nr&rrrqz%s, line %d: %sz%s.%s(), line %d: %sz> )rrqN)
r��clear�range�lenr�rrr"�	linecache�getline�striprWZselect)
rr��indexr�rr%�modnamer#r$�funcnamer�Z
sourceline�itemr
r
rru�s.

zStackViewer.load_stackcCs|jrtj||�SdS)N)r�r�popup_event)rr=r
r
rr��szStackViewer.popup_eventcCs*|j}|jd|jd�|jd|jd�dS)NzGo to source line)�labelrAzShow stack frame)�menuZadd_command�goto_source_line�show_stack_frame)rr�r
r
r�	fill_menu�s

zStackViewer.fill_menucCs4d|kot|j�knr0|jj|j|�dS)Nr)r�r�rr�)rr�r
r
r�	on_select�szStackViewer.on_selectcCs|j|�dS)N)rc)rr�r
r
r�	on_double�szStackViewer.on_doublecCs|jjd�}|j|�dS)N�active)�listboxr�rc)rr�r
r
rr��szStackViewer.goto_source_linecCs@|jjd�}d|ko$t|j�knr<|jj|j|�dS)Nr�r)r�r�r�r�rr�)rr�r
r
rr��szStackViewer.show_stack_framecCsfd|kot|j�kns"dS|j|\}}|j}|j}tjj|�rb|jj|�}|rb|j	|�dS)Nr)
r�r�rrrr �isfilerQ�openZgotoline)rr�rr%r#r$Zeditr
r
rrc�szStackViewer.show_source)N)r&r'r(rrur�r�r�r�r�r�rcr
r
r
rr�ws
r�c@s,eZdZd
dd�ZdZddd�Zdd	�ZdS)
r�NcCs d}d}|rdt|�}||_||_ddl}|j�|_d|j_d|j_t|�|_	}|j	j
ddd�t||dd	d
�|_|jj
dd�t
|d
d�|_}|j
ddd�t|tdtd|��dd||fd�|_}	|	j
dddd�|	j|d<|j|	d<t|	�|_}
|	jdd|
dd�|_|j|�dS)Nr�(��<r3rO)rPrL�Zgroove)r@�borderwidthZreliefrK)rL�vbar)�name�right�y)rErLi,)rN�scrollregionrD)rErLrPrAZyscrollcommand�nw)Zwindowr?)r�r��title�reprlib�Repr�repr�	maxstring�maxotherrRrrTrhr�rr�ZCanvas�min�max�canvasZyviewr_�subframeZ
create_windowZsfidr�)rr�r��dictr�rNr�rr�r�r�r
r
rr�s2


zNamespaceViewer.__init__r3rcCsh||jkr|rdS|j}|j}xt|jj��D]}|j�q0Wd|_|sft|dd�}|jddd�n�|j	�}t
|�}	d}
x~|	D]v}||}|jj|�}
|r�|
dd
�}
t||d�}|j|
ddd�t|ddd�}|j
d|
�|j|
ddd�|
d}
q�W||_|j�|j�}|j�}|j}dd||f|jd	<|d
k�rPd
|d<|jdd�n||d<|jdd�dS)N�None)r@r)rGrHr3r�)rGrHZsticky)r�r�r�i,rN)rPr�)r�r�r�listZchildren�valuesr<rhra�keys�sortedr�ZEntry�insertZupdate_idletasksZwinfo_reqwidthZwinfo_reqheightr�rT)rr�r�Z
rpc_clientr�r�c�lZ	keys_list�namesrGr�r|Zsvaluer�rNr�r
r
rr��sF


zNamespaceViewer.load_dictcCs|jj�dS)N)rr<)rr
r
rr;szNamespaceViewer.close)Nr�)rN)r&r'r(rr�r�r;r
r
r
rr��s

6r��__main__)�mainzidlelib.idle_test.test_debuggerr�F)�	verbosity�exit)r	rZtkinterZtkinter.ttkrrrZidlelib.scrolledlistrZidlelib.windowrr
rr)r�r�r&Zunittestr�r
r
r
r�<module>s.?SX

?>