Your IP : 3.17.175.167


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/Debugger.cpython-35.opt-2.pyc



���]FI�@s�ddlZddlZddlTddlmZddlmZddlmZGdd�dej	�Z
Gdd	�d	�ZGd
d�de�ZGdd
�d
�Z
dS)�N)�*)�ListedToplevel)�ScrolledList)�
macosxSupportc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�IdbcCs||_tjj|�dS)N)�gui�bdb�Bdb�__init__)�selfr�r�-/opt/alt/python35/lib64/python3.5/Debugger.pyr
s	zIdb.__init__cCs\|j|�r|j�dS|j|�}y|jj||�Wntk
rWYnXdS)N)�in_rpc_code�set_step�_Idb__frame2messager�interactionZTclError)r�frame�messagerrr
�	user_lines

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

zIdb.user_exceptioncCsL|jjjd�rdS|j}|jjjd�r;dS|j|�SdS)Nzrpc.pyTzDebugger.pyF)�f_code�co_filename�count�f_backr)rrZ
prev_framerrr
r s	zIdb.in_rpc_codecCsc|j}|j}|j}tjj|�}d||f}|jdkr_d||jf}|S)Nz%s:%s�?z%s: %s())rr�f_lineno�os�path�basename�co_name)rr�code�filename�linenorrrrr
Z__frame2message*s			zIdb.__frame2messageN)�__name__�
__module__�__qualname__r
rrrrrrrr
r	s


rc@sTeZdZdZZZZddd�Zdd�Zddd�Z	dd	�Z
dd
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdZdd�Zdd�Zd d!�ZdZdZd"d#�Zd$d%�Zd&d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z dS)1�DebuggerNcCsS|dkrt|�}||_||_d|_|j�d|_d|_dS)Nr)r�pyshell�idbr�make_gui�interacting�
nesting_level)rr(r)rrr
r
9s			
	zDebugger.__init__csm�jdkr?�j��jjd��fdd��dSzd�_�jj��SWdd�_XdS)Nr�dcs
�j��S)N)�runr)�argsrrr
�<lambda>cszDebugger.run.<locals>.<lambda>�)r,�
abort_loop�root�afterr+r)r.)rr/r)r/rr
r.Cs
"	zDebugger.runcCszy|j�Wntk
r"YnX|jr=|jj�dS|jr\|jj�d|_|jj�|jj	�dS)N)
�quit�	Exceptionr+�topZbell�stackviewer�closer(Zclose_debugger�destroy)r�eventrrr
r9ks
	
	
	
zDebugger.closecCs�|j}|j|_|j|_}t|�|_}|jjd�|jjd�|jd|j�|jj	d|j�t
|�|_}|jjdd�g|_
}t|ddd	|j�|_}|j|�t|dd
d	|j�|_}|j|�t|ddd	|j�|_}|j|�t|ddd	|j�|_}|j|�t|dd
d	|j�|_}|j|�x.|D]&}|jdd�|jdd�q�Wt
|�|_}|jjdd�|js!t|�|j_|jjd�t|ddd	|j d|j�|_!|j!j"dddd�|j#s|t|�|j_#t|ddd	|j$d|j#�|_%|j%j"dddd�|j&s�t|�|j_&|j&jd�t|ddd	|j'd|j&�|_(|j(j"dddd�|j)sBt|�|j_)t|ddd	|j*d|j)�|_+|j+j"dddd�t,|dd�|_-|j-jdd�t,|dd�|_.|j.jdddd�|j.j/d�|_0t
|dd�|_1|j1jdddd �t
|�|_2|j2jdddd �t
|dd�|_3|j3jdddd �|jj4�r�|j �|j&j4�r�|j'�|j)j4�r�|j*�dS)!Nz
Debug ControlZDebugZWM_DELETE_WINDOWz<Escape>�anchor�w�textZGo�commandZStepZOverZOutZQuit�state�disabled�side�leftr1ZStack�variable�rowr�columnZSource�Locals�Globals�fill�x�
background�height�expand�both)5r(�flistr3rr7Zwm_titleZwm_iconnameZwm_protocolr9�bind�Frame�bframe�pack�buttonsZButton�contZbcont�append�stepZbstep�nextZbnext�retZbretr5�	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)rr(r3r7rRZbl�br[rrr
r*|s�	
"
"
"
"
"

								

zDebugger.make_guic
Cs�||_|jjd|�|r�|\}}}y
|j}Wn"tk
rbdt|�}YnX|dk	r�yd|t|�f}WnYnXd}nd}d}|j}|jjd|d|�|j}	|	r|j	j
|j|�\}
}|	j|
|�|jd�|j
j�r.|j�x!|jD]}|jdd	�q8W|jj�|jd7_|jjjd
d�|jd8_x!|jD]}|jdd�q�W|jjdd�|jjddd|j�d|_dS)
Nr>z%sz%s: %sZyellow�rKr1r@ZnormalZvwaitz::idledebugwaitrA)rrhrZr$�AttributeError�strrjrir8r)�	get_stack�
load_stack�show_variablesrarn�sync_source_linerTr7�wakeupr,r3�tk�call)
rrrr�type�value�tb�m1�bg�sv�stack�irorrr
r�sH	

			


zDebugger.interactioncCsu|j}|sdS|j|�\}}|dd�|dd�dkrqtjj|�rq|jj||�dS)Nr1z<>���)r�_Debugger__frame2filelinerr�existsrOZgotofileline)rrr"r#rrr
rv�s	6zDebugger.sync_source_linecCs%|j}|j}|j}||fS)N)rrr)rrr!r"r#rrr
Z__frame2filelines			zDebugger.__frame2filelinecCs|jj�|j�dS)N)r)Zset_continuer2)rrrr
rUs
z
Debugger.contcCs|jj�|j�dS)N)r)rr2)rrrr
rW
s
z
Debugger.stepcCs!|jj|j�|j�dS)N)r)Zset_nextrr2)rrrr
rXsz
Debugger.nextcCs!|jj|j�|j�dS)N)r)Z
set_returnrr2)rrrr
rYszDebugger.retcCs|jj�|j�dS)N)r)Zset_quitr2)rrrr
r5s
z
Debugger.quitcCs|jjjddd�dS)Nr^z::idledebugwait�1)r3rxry)rrrr
r2szDebugger.abort_loopcCs�|jrr|jj�rrt|j|j|�|_}|jr�|jj|jd�\}}|j	||�n?|j}|r�|jj�r�d|_|j
�d|jd<dS)Nr1rL)r8r\rn�StackViewerrkrOrr)rsrtr9)rrr�r�rrr
r_s			
zDebugger.show_stackcCs|jj�r|j�dS)N)rarnrv)rrrr
rb,szDebugger.show_sourcecCs|d|_|j�dS)Nr)rru)rZ	stackitemrrr
�
show_frame0s
zDebugger.show_framecCsj|j}|jj�r6|s\t|jd�|_n&|r\d|_|j�d|jd<|j�dS)NrGr1rL)�localsviewerrcrn�NamespaceViewerrlr9ru)r�lvrrr
rd7s		

zDebugger.show_localscCsj|j}|jj�r6|s\t|jd�|_n&|r\d|_|j�d|jd<|j�dS)NrHr1rL)�
globalsviewerrernr�rmr9ru)r�gvrrr
rfCs		

zDebugger.show_globalsrcCs�|j}|j}|j}|s.d}}n0|j}|j}|r^|r^||kr^d}|r�|j|||jjj�|r�|j|||jjj�dS)N)	r�r�r�f_locals�	f_globals�	load_dictr(ZinterpZrpcclt)r�forcer�r�rZldictZgdictrrr
ruOs			
		zDebugger.show_variablescCs|jj||�dS)N)r)Z	set_break)rr"r#rrr
�set_breakpoint_here_szDebugger.set_breakpoint_herecCs|jj||�dS)N)r)Zclear_break)rr"r#rrr
�clear_breakpoint_herebszDebugger.clear_breakpoint_herecCs|jj|�dS)N)r)Zclear_all_file_breaks)rr"rrr
�clear_file_breakseszDebugger.clear_file_breakscCsjxc|jjjD]R}|jj}y(x!|jD]}|j||�q/WWqtk
rawYqXqWdS)N)r(rOZinversedict�ior"Zbreakpointsr�rq)rZeditwinr"r#rrr
�load_breakpointshs
zDebugger.load_breakpoints)!r$r%r&r\rarcrer
r.r9r*rrvr�rUrWrXrYr5r2r8r_rbr�r�r�rdrfrur�r�r�r�rrrr
r'5s6
(K1
r'c@seZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)r�cCsTtj�rtj||�ntj||dd�||_||_g|_dS)N�width�P)rZisAquaTkrr
rOrr�)r�masterrOrrrr
r
ts		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|�q&W|dk	r|j|�dS)	Nr$rrrpz%s, line %d: %sz%s.%s(), line %d: %sz> )rrpN)
r��clear�range�lenr�rrr �	linecache�getline�striprV�select)
rr��indexr�rr#�modnamer!r"�funcnamer�Z
sourceline�itemrrr
rt�s.	
				

zStackViewer.load_stackcCs|jrtj||�SdS)N)r�r�popup_event)rr;rrr
r��s	zStackViewer.popup_eventcCs?|j}|jddd|j�|jddd|j�dS)N�labelzGo to source liner?zShow stack frame)�menuZadd_command�goto_source_line�show_stack_frame)rr�rrr
�	fill_menu�s
	
zStackViewer.fill_menucCs@d|ko t|j�knr<|jj|j|�dS)Nr)r�r�rr�)rr�rrr
�	on_select�s%zStackViewer.on_selectcCs|j|�dS)N)rb)rr�rrr
�	on_double�szStackViewer.on_doublecCs#|jjd�}|j|�dS)N�active)�listboxr�rb)rr�rrr
r��szStackViewer.goto_source_linecCsR|jjd�}d|ko2t|j�knrN|jj|j|�dS)Nr�r)r�r�r�r�rr�)rr�rrr
r��s%zStackViewer.show_stack_framecCs�d|ko t|j�kns)dS|j|\}}|j}|j}tjj|�r�|jj|�}|r�|j	|�dS)Nr)
r�r�rrrr�isfilerO�openZgotoline)rr�rr#r!r"Zeditrrr
rb�s%		zStackViewer.show_source)r$r%r&r
rtr�r�r�r�r�r�rbrrrr
r�rsr�c@sCeZdZddd�Zd
Zdddd�Zdd	�ZdS)r�Nc	Cs�d}d}|r"dt|�}||_||_ddl}|j�|_d|j_d|j_t|�|_	}|j	j
dddd�t|d	|d
ddd
�|_|jj
dd�t
|dd�|_}|j
dddd�t|dtdtd|��ddd||f�|_}	|	j
dddddd�|	j|d<|j|	d<t|	�|_}
|	jddd|
dd�|_|j|�dS)Nr�(��<rMr1rIrNr>�borderwidth�ZreliefZgrooverJ�name�vbarrB�right�yrLi,�scrollregionrCr?ZyscrollcommandZwindowr<�nw)r�r��title�reprlib�Repr�repr�	maxstring�maxotherrQrrSrgr�Z	Scrollbarr�ZCanvas�min�max�canvasZyviewr^�subframeZ
create_windowZsfidr�)rr�r��dictr�rLr�rr�r�r�rrr
r
�s2		!	

!zNamespaceViewer.__init__r1rcCs||jkr|rdS|j}|j}x't|jj��D]}|j�qBWd|_|s�t|dd�}|jdddd�n�|j	�}t
|�}	d}
x�|	D]�}||}|jj|�}
|r�|
dd�}
t|d|�}|jd|
dddd�t|d	dd
d�}|j
d|
�|jd|
dddd�|
d}
q�W||_|j�|j�}|j�}|j}dd||f|jd<|dkr�d|d
<|jdd�n||d
<|jdd�dS)Nr>�NonerErrFr1Zstickyr�r�r�r�i,rLrMr�)r�r�r�listZchildren�valuesr:rgr`�keys�sortedr�ZEntry�insertZupdate_idletasksZwinfo_reqwidthZwinfo_reqheightr�rS)rr�r�Z
rpc_clientr�r�c�lZ	keys_list�namesrEr�r{Zsvaluer�rLr�rrr
r��sF			


	
	

zNamespaceViewer.load_dictcCs|jj�dS)N)rr:)rrrr
r9szNamespaceViewer.closer�)r$r%r&r
r�r�r9rrrr
r��s6r�)rr�tkinterZidlelib.WindowListrZidlelib.ScrolledListrZidlelibrr	rr'r�r�rrrr
�<module>s
,�>S

?>