ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/bdb.cpython-34.pyc

�
h f:[�@s�dZddlZddlZddlZddlmZdddgZGdd�de�ZGdd�d�Z	d	d
�Z
Gdd�d�Zdd
�Zdd�Z
Gdd�de	�Zdd�Zdd�Zdd�ZdS)zDebugger basics�N)�CO_GENERATOR�BdbQuit�Bdb�
Breakpointc@seZdZdZdS)rz Exception to give up completely.N)�__name__�
__module__�__qualname__�__doc__�r
r
�(/opt/alt/python34/lib64/python3.4/bdb.pyr
sc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&d'�Zdd(d)�Zd*d+�Zd,d-�Zd.d/�Zdd0d1�Zd2d3�Zd4d5�Zd6ddd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCdD�Z#dEdF�Z$dGdH�Z%dIdJ�Z&dKdL�Z'dMdN�Z(dOdPdQ�Z)dddRdS�Z*dddTdU�Z+dVdW�Z,dXdY�Z-dS)Zrz�Generic Python debugger base class.

    This class takes care of details of the trace facility;
    a derived class should implement user interaction.
    The standard debugger class (pdb.Pdb) is an example.
    NcCs:|rt|�nd|_i|_i|_d|_dS)N)�set�skip�breaks�fncache�frame_returning)�selfr
r
r
r�__init__s		zBdb.__init__cCsr|d|dd�dkr"|S|jj|�}|sntjj|�}tjj|�}||j|<n|S)N�<��>���)r�get�os�path�abspath�normcase)r�filename�canonicr
r
rrszBdb.canoniccCs3ddl}|j�d|_|jdd�dS)Nr)�	linecache�
checkcache�botframe�
_set_stopinfo)rrr
r
r�reset&s
	z	Bdb.resetcCs�|jr
dS|dkr&|j|�S|dkrB|j||�S|dkr^|j||�S|dkrz|j||�S|dkr�|jS|dkr�|jS|dkr�|jStdt|��|jS)	N�line�call�returnZ	exceptionZc_callZc_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)�quitting�
dispatch_line�
dispatch_call�dispatch_return�dispatch_exception�trace_dispatch�print�repr)r�frameZevent�argr
r
rr+,s$	
zBdb.trace_dispatchcCsG|j|�s|j|�r@|j|�|jr@t�q@n|jS)N)�	stop_here�
break_here�	user_liner&rr+)rr.r
r
rr'@s

	zBdb.dispatch_linecCs�|jdkr"|j|_|jS|j|�p=|j|�sDdS|jrd|jjt@rd|jS|j	||�|j
r�t�n|jS)N)r �f_backr+r0�break_anywhere�	stopframe�f_code�co_flagsr�	user_callr&r)rr.r/r
r
rr(Fs		zBdb.dispatch_callcCs�|j|�s||jkr�|jr>|jjt@r>|jSz||_|j||�Wdd|_X|j	rzt
�n|j|kr�|jdkr�|jdd�q�n|jS)Nrr)
r0�returnframer5r6r7rr+r�user_returnr&r�
stoplinenor!)rr.r/r
r
rr)Vs	
		zBdb.dispatch_returncCs�|j|�rg|jjt@o<|dtko<|ddks�|j||�|jrdt�qdq�nf|jr�||jk	r�|jjjt@r�|dtt	fkr�|j||�|jr�t�q�n|j
S)Nr�)r0r6r7r�
StopIteration�user_exceptionr&rr5�
GeneratorExitr+)rr.r/r
r
rr*fs 		zBdb.dispatch_exceptioncCs.x'|jD]}tj||�r
dSq
WdS)NTF)r
�fnmatch)rZmodule_name�patternr
r
r�is_skipped_moduleszBdb.is_skipped_modulecCsk|jr(|j|jjd��r(dS||jkrZ|jdkrJdS|j|jkS|jsgdSdS)NrFrTr)r
rB�	f_globalsrr5r;�f_lineno)rr.r
r
rr0�s		z
Bdb.stop_herecCs�|j|jj�}||jkr(dS|j}||j|krj|jj}||j|krjdSnt|||�\}}|r�|j|_|r�|j	r�|j
t|j��ndSdSdS)NFT)rr6�co_filenamerrD�co_firstlineno�	effective�numberZ	currentbp�	temporary�do_clear�str)rr.r�lineno�bpZflagr
r
rr1�s	zBdb.break_herecCstd��dS)Nz)subclass of bdb must implement do_clear())�NotImplementedError)rr/r
r
rrJ�szBdb.do_clearcCs|j|jj�|jkS)N)rr6rEr)rr.r
r
rr4�szBdb.break_anywherecCsdS)znThis method is called when there is the remote possibility
        that we ever need to stop in this function.Nr
)rr.Z
argument_listr
r
rr8�sz
Bdb.user_callcCsdS)z9This method is called when we stop or break at this line.Nr
)rr.r
r
rr2�sz
Bdb.user_linecCsdS)z5This method is called when a return trap is set here.Nr
)rr.Zreturn_valuer
r
rr:�szBdb.user_returncCsdS)zmThis method is called if an exception occurs,
        but only if we are to stop at or just below this level.Nr
)rr.�exc_infor
r
rr>�szBdb.user_exceptionrcCs(||_||_d|_||_dS)NF)r5r9r&r;)rr5r9r;r
r
rr!�s			zBdb._set_stopinfocCs3|dkr|jd}n|j|||�dS)zxStop when the line with the line no greater than the current one is
        reached or when returning from current frameNr)rDr!)rr.rLr
r
r�	set_until�sz
Bdb.set_untilcCsK|jr7|jj}|r7|jr7|j|_q7n|jdd�dS)zStop after one line of code.N)rr3�f_tracer+r!)rZcaller_framer
r
r�set_step�s
	zBdb.set_stepcCs|j|d�dS)z2Stop on the next line in or below the given frame.N)r!)rr.r
r
r�set_next�szBdb.set_nextcCs=|jjt@r&|j|dd�n|j|j|�dS)z)Stop when returning from the given frame.Nrr)r6r7rr!r3)rr.r
r
r�
set_return�szBdb.set_returncCsq|dkrtj�j}n|j�x(|rR|j|_||_|j}q+W|j�tj|j�dS)zpStart debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N)	�sys�	_getframer3r"r+rQr rR�settrace)rr.r
r
r�	set_trace�s
		

z
Bdb.set_tracecCsm|j|jdd�|jsitjd�tj�j}x+|re||jk	re|`|j}q>WndS)Nrr)r!r rrUrWrVr3rQ)rr.r
r
r�set_continue�s	
zBdb.set_continuecCs/|j|_d|_d|_tjd�dS)NT)r r5r9r&rUrW)rr
r
r�set_quits		zBdb.set_quitFc
Cs�|j|�}ddl}|j||�}|sAd||fS|jj|g�}||krr|j|�nt|||||�}	dS)NrzLine %s:%d does not exist)rr�getliner�
setdefault�appendr)
rrrLrI�cond�funcnamerr#�listrMr
r
r�	set_breaksz
Bdb.set_breakcCsJ||ftjkr,|j|j|�n|j|sF|j|=ndS)N)r�bplistr�remove)rrrLr
r
r�
_prune_breaks!s
zBdb._prune_breakscCs�|j|�}||jkr&d|S||j|krGd||fSx/tj||fdd�D]}|j�qeW|j||�dS)NzThere are no breakpoints in %szThere is no breakpoint at %s:%d)rrrrb�deleteMerd)rrrLrMr
r
r�clear_break's$zBdb.clear_breakcCsiy|j|�}Wn/tk
rD}zt|�SWYdd}~XnX|j�|j|j|j�dS)N)�get_bpbynumber�
ValueErrorrKrerd�filer#)rr/rM�errr
r
r�clear_bpbynumber3s
zBdb.clear_bpbynumbercCsz|j|�}||jkr&d|SxC|j|D]4}tj||f}x|D]}|j�qTWq4W|j|=dS)NzThere are no breakpoints in %s)rrrrbre)rrr#ZblistrMr
r
r�clear_all_file_breaks;s
zBdb.clear_all_file_breakscCsA|js
dSx$tjD]}|r|j�qqWi|_dS)NzThere are no breakpoints)rr�
bpbynumberre)rrMr
r
r�clear_all_breaksEs	zBdb.clear_all_breakscCs�|std��nyt|�}Wn"tk
rItd|��YnXytj|}Wn"tk
rtd|��YnX|dkr�td|��n|S)NzBreakpoint number expectedz Non-numeric breakpoint number %sz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rh�intrrm�
IndexError)rr/rHrMr
r
rrgMs

zBdb.get_bpbynumbercCs/|j|�}||jko.||j|kS)N)rr)rrrLr
r
r�	get_break\sz
Bdb.get_breakcCsH|j|�}||jkrD||j|krDtj||fpGgS)N)rrrrb)rrrLr
r
r�
get_breaksaszBdb.get_breakscCs1|j|�}||jkr)|j|SgSdS)N)rr)rrr
r
r�get_file_breaksgszBdb.get_file_breakscCs|jS)N)r)rr
r
r�get_all_breaksnszBdb.get_all_breakscCs�g}|r'|j|kr'|j}nxB|dk	rk|j||jf�||jkr_Pn|j}q*W|j�tdt|�d�}x2|dk	r�|j|j|j	f�|j}q�W|dkr�tdt|�d�}n||fS)Nrr)
�tb_frame�tb_nextr]rDr r3�reverse�max�len�	tb_lineno)r�f�t�stack�ir
r
r�	get_stackts 


z
Bdb.get_stackz: cCs2ddl}ddl}|\}}|j|jj�}d||f}|jjrh||jj7}n
|d7}d|jkr�|jd}	nd}	|	r�||j|	�7}n
|d7}d|jkr�|jd}
|d7}||j|
�7}n|j|||j	�}|r.|||j
�7}n|S)Nrz%s(%r)z<lambda>Z__args__z()Z
__return__z->)r�reprlibrr6rE�co_name�f_localsr-r[rC�strip)rZframe_linenoZlprefixrr�r.rLr�s�args�rvr#r
r
r�format_stack_entry�s*



zBdb.format_stack_entrycCs�|dkr$ddl}|j}n|dkr9|}n|j�t|t�rgt|dd�}ntj|j�z-yt	|||�Wnt
k
r�YnXWdd|_tjd�XdS)Nrz<string>�execT)�__main__�__dict__r"�
isinstancerK�compilerUrWr+r�rr&)r�cmd�globals�localsr�r
r
r�run�s	

		zBdb.runcCs�|dkr$ddl}|j}n|dkr9|}n|j�tj|j�z-yt|||�SWntk
r~YnXWdd|_tjd�XdS)NrT)	r�r�r"rUrWr+�evalrr&)r�exprr�r�r�r
r
r�runeval�s	

		zBdb.runevalcCs|j|||�dS)N)r�)rr�r�r�r
r
r�runctx�sz
Bdb.runctxcOsj|j�tj|j�d}z,y|||�}Wntk
rJYnXWdd|_tjd�X|S)NT)r"rUrWr+rr&)r�funcr��kwds�resr
r
r�runcall�s

		zBdb.runcall).rrrr	rrr"r+r'r(r)r*rBr0r1rJr4r8r2r:r>r!rPrRrSrTrXrYrZrardrfrkrlrnrgrqrrrsrtrr�r�r�r�r�r
r
r
rrsX


cCst�j�dS)N)rrXr
r
r
rrX�srXc@s�eZdZdZdZiZdgZddddd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)ra�Breakpoint class.

    Implements temporary breakpoints, ignore counts, disabling and
    (re)-enabling, and conditionals.

    Breakpoints are indexed by number through bpbynumber and by
    the file,line tuple using bplist.  The former points to a
    single instance of class Breakpoint.  The latter points to a
    list of such instances since there may be more than one
    breakpoint per line.

    rNFcCs�||_d|_||_||_||_||_d|_d|_d|_t	j
|_t	j
d7_
|jj
|�||f|jkr�|j||fj
|�n|g|j||f<dS)NTrr)r_�func_first_executable_linerir#rIr^�enabled�ignore�hitsr�nextrHrmr]rb)rrir#rIr^r_r
r
rr�s									zBreakpoint.__init__cCsT|j|jf}d|j|j<|j|j|�|j|sP|j|=ndS)N)rir#rmrHrbrc)r�indexr
r
rre	s

zBreakpoint.deleteMecCs
d|_dS)NT)r�)rr
r
r�enableszBreakpoint.enablecCs
d|_dS)NF)r�)rr
r
r�disableszBreakpoint.disablecCs2|dkrtj}nt|j�d|�dS)Nri)rU�stdoutr,�bpformat)r�outr
r
r�bpprintszBreakpoint.bpprintcCs�|jrd}nd}|jr.|d}n
|d}d|j||j|jf}|jrw|d|jf7}n|jr�|d|jf7}n|jr�|jdkr�d	}nd
}|d|j|f7}n|S)Nzdel  zkeep zyes  zno   z%-4dbreakpoint   %s at %s:%dz
	stop only if %sz
	ignore next %d hitsrr��z"
	breakpoint already hit %d time%s)rIr�rHrir#r^r�r�)rZdispZretZssr
r
rr�s$			

				zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rHrir#)rr
r
r�__str__3szBreakpoint.__str__)rrrr	r�rbrmrrer�r�r�r�r�r
r
r
rr�s	cCsn|js#|j|jkrdSdS|jj|jkr<dS|jsT|j|_n|j|jkrjdSdS)z;Check whether we should break here because of `b.funcname`.FT)r_r#rDr6r�r�)�br.r
r
r�
checkfuncname8s		r�cCs�tj||f}x�|D]�}|js/qnt||�sDqn|jd7_|js�|jdkr�|jd8_qq�|dfSqySt|j|j|j	�}|r�|jdkr�|jd8_q�|dfSnWq|dfSYqXqWdS)z�Determine which breakpoint for this file:line is to be acted upon.

    Called only if we know there is a bpt at this
    location.  Returns breakpoint that was triggered and a flag
    that indicates if it is ok to delete a temporary bp.

    rrTFN)NN)
rrbr�r�r�r^r�r�rCr�)rir#r.Z	possiblesr��valr
r
rrGTs*
		
rGc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TdbcCs/|jj}|sd}ntd||�dS)Nz???z+++ call)r6r�r,)rr.r��namer
r
rr8�s	z
Tdb.user_callcCs}ddl}|jj}|s'd}n|j|jj�}|j||j|j�}td||j|d|j	��dS)Nrz???z+++�:)
rr6r�rrEr[rDrCr,r�)rr.rr��fnr#r
r
rr2�s	z
Tdb.user_linecCstd|�dS)Nz
+++ return)r,)rr.Zretvalr
r
rr:�szTdb.user_returncCstd|�|j�dS)Nz
+++ exception)r,rY)rr.Z	exc_stuffr
r
rr>�s
zTdb.user_exceptionN)rrrr8r2r:r>r
r
r
rr��sr�cCs1td|d�t|d�}td|�dS)Nzfoo(�)�
zbar returned)r,�bar)�n�xr
r
r�foo�sr�cCstd|d�|dS)Nzbar(r�r<)r,)�ar
r
rr��sr�cCst�}|jd�dS)Nzimport bdb; bdb.foo(10))r�r�)r|r
r
r�test�s	r�)r	r@rUr�inspectr�__all__�	ExceptionrrrXrr�rGr�r�r�r�r
r
r
r�<module>s ��Z0

Zerion Mini Shell 1.0