add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
U

�AT^���"@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
Gdd�de�Zdddddd	d
ddg	Zd
d�Zdd�Zdd�ZGdd�de�ZdZGdd�dejej�Zedk	�rbddddddddddd d!d"d#d$d%d&d'dd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g"ZeD]"Zeeed7e�j��d87Z�q.eejj7Z[[dId9d�Z dJd:d�Z!d;d�Z"d<d	�Z#dd=�d>d
�Z$dKd?d�Z%d@d�Z&dAZ'dBdC�Z(dDd�Z)dEZ*dFdG�Z+e,dHk�r�ddl-Z-e-�+�dS)L�Nc@seZdZdS)�RestartN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.8/pdb.pyrVsr�run�pm�Pdb�runeval�runctx�runcall�	set_trace�post_mortem�helpc
Cs�t�dt�|��}zt|�}Wntk
r6YdSX|�@t|dd�D],\}}|�|�rJ|||fW5QR�SqJW5QRXdS)Nzdef\s+%s\s*[(]�)�start)�re�compile�escape�open�OSError�	enumerate�match)�funcname�filenameZcre�fp�lineno�linerrr�
find_function]s
&rcCsXt�|�\}}t�|�r,|j|jkr,|dfSt�|�r>|dfSt�||d��|dfS�Nr)�inspectZ
findsourceZisframe�	f_globals�f_localsZismoduleZgetblock)�obj�linesrrrr�getsourcelinesjs
r&cCs8tt�|��}|��|D]\}}||kr|SqdS�Nr)�list�disZfindlinestarts�reverse)�codeZlastiZ
linestarts�irrrr�lasti2linenoss
r-c@seZdZdd�ZdS)�_rstrcCs|S�Nr��selfrrr�__repr__~sz_rstr.__repr__N)rrrr2rrrrr.|sr.z
-> c@seZdZdZd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZeZd�d8d9�Zd:d;�ZeZ eZ!eZ"d<d=�Z#eZ$d>d?�Z%d@dA�Z&dBdC�Z'eZ(dDdE�Z)eZ*dFdG�Z+eZ,dHdI�Z-eZ.dJdK�Z/e/Z0eZ1eZ2dLdM�Z3e3Z4e3Z5dNdO�Z6dPdQ�Z7e7Z8dRdS�Z9e9Z:dTdU�Z;e;Z<dVdW�Z=e=Z>dXdY�Z?e?Z@dZd[�ZAeAZBd\d]�ZCeCZDd^d_�ZEeEZFZGd`da�ZHeHZIdbdc�ZJeZKddde�ZLeLZMeLZNdfdg�ZOdhdi�ZPePZQdjdk�ZReRZSdldm�ZTd�dndo�ZUdpdq�ZVdrds�ZWeZXeZYeZZdtdu�Z[e[Z\dvdw�Z]e]Z^dxdy�Z_eZ`d�d{d|�Zad}d~�ZbeZcdd��ZdeZed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d�d�d�d�d�gZld�d��Zmenfd�d��Zod�d��ZpepZqd�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��ZvdS)�r
N�tabFTc		Cs>tjj||d�tj�||||�t�d�|r6d|_d|_i|_	i|_
d|_d|_i|_
zddl}|�d�Wntk
r�YnXd|_||_g|_|�rz,ttj�d���}|j�|�W5QRXWntk
r�YnXz$td	��}|j�|�W5QRXWntk
�rYnXi|_i|_i|_d|_d|_dS)
N)�skipzpdb.Pdbrz(Pdb) �Fz 	
`@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrcz.pdbrc)�bdb�Bdb�__init__�cmd�Cmd�sys�auditZuse_rawinput�prompt�aliases�
displaying�
mainpyfile�_wait_for_mainpyfile�	tb_lineno�readlineZset_completer_delims�ImportError�allow_kbdint�nosigint�rcLinesr�os�path�
expanduser�extendr�commands�commands_doprompt�commands_silent�commands_defining�
commands_bnum)	r1�completekey�stdin�stdoutr4rFZreadrcrCZrcFilerrrr8�sF

zPdb.__init__cCs*|jr
t�|�d�|��|�|�dS)Nz-
Program interrupted. (Use 'cont' to resume).)rE�KeyboardInterrupt�message�set_stepr)r1�signum�framerrr�sigint_handler�s

zPdb.sigint_handlercCstj�|�|��dSr/)r6r7�reset�forgetr0rrrrZ�sz	Pdb.resetcCs&d|_g|_d|_d|_|j��dSr')r�stack�curindex�curframerB�clearr0rrrr[�s
z
Pdb.forgetcCsh|��|�||�\|_|_|rDt|jj|j�}||j|j<|j	}q|j|jd|_
|j
j|_|�
�Sr')r[Z	get_stackr\r]r-�tb_frame�f_code�tb_lastirB�tb_nextr^r#�curframe_locals�execRcLines)r1�f�tbrrrr�setup�s
z	Pdb.setupcCsd|js
dS|j}|��g|_|r`|����}|r|ddkr|�|�r|jt|�7_dSqdS)Nr�#T)rGr*�pop�strip�onecmd�reversed)r1rGrrrrre�s
zPdb.execRcLinescCs.|jr
dS|�|�r*|�d�|�|d�dS)Nz--Call--)rAZ	stop_hererU�interaction)r1rXZ
argument_listrrr�	user_call�s


z
Pdb.user_callcCsH|jr.|j|�|jj�ks$|jdkr(dSd|_|�|�rD|�|d�dS)NrF)rAr@�canonicra�co_filename�f_lineno�bp_commandsrn)r1rXrrr�	user_line�s�
z
Pdb.user_linecCs�t|dd�r�|j|jkr�|j}d|_|j}|�|d�|j|D]}|�|�q@||_|j|sr|�|j|j	�|j
|r�|��|��dSdS)N�	currentbpFrr)
�getattrrurL�lastcmdrhrlrN�print_stack_entryr\r]rM�_cmdloopr[)r1rXruZlastcmd_backrrrrrss"
�

zPdb.bp_commandscCs.|jr
dS||jd<|�d�|�|d�dS)N�
__return__z
--Return--)rAr#rUrn)r1rXZreturn_valuerrr�user_returns


zPdb.user_returncCsh|jr
dS|\}}}||f|jd<|s2|tkr2dnd}|�d|t�||�d��f�|�||�dS)NZ
__exception__z	Internal r5z%s%s�����)rAr#�
StopIterationrU�	traceback�format_exception_onlyrkrn)r1rX�exc_info�exc_type�	exc_value�
exc_traceback�prefixrrr�user_exception's
���zPdb.user_exceptioncCsBzd|_|��d|_Wq>Wqtk
r:|�d�YqXqdS)NTFz--KeyboardInterrupt--)rE�cmdlooprTrUr0rrrry;szPdb._cmdloopcCs^|j�|j�}|rZ|��D]>\}}|�|�}||k	r||kr|||<|�d|||f�qdS)Nzdisplay %s: %r  [old: %r])r?�getr^�items�_getval_exceptrU)r1r?�exprZoldvalueZnewvaluerrr�preloopHs
�zPdb.preloopcCsttjr6zt�tjtj�Wntk
r.YnXdt_|�||�rN|��dS|�|j|j	�|�
�|��dSr/)r
�_previous_sigint_handler�signal�SIGINT�
ValueErrorrhr[rxr\r]ry)r1rXr~rrrrnUszPdb.interactioncCs|dk	r|�t|��dSr/)rU�repr)r1r$rrr�displayhookgszPdb.displayhookc	Cs�|dd�dkr|dd�}|j}|jj}zdt|ddd�}tj}tj}tj}z(|jt_|jt_|jt_t|||�W5|t_|t_|t_XWn4t�	�dd�}|�
tj|�d�
��YnXdS)Nr�!�
z<stdin>Zsingle�r|)rdr^r"rr;rSrRr��execr��errorr~rrk)	r1r�locals�globalsr+Zsave_stdoutZ
save_stdinZsave_displayhookr�rrr�defaultos(zPdb.defaultcCs�|��s|S|��}|d|jkr�|j|d}d}|dd�D] }|�dt|�|�}|d7}q@|�dd�|dd���}|��}q|ddkr�|�d�}|dkr�||dd���}|j�	|�|d|��
�}|S)	Nrr�%z%*� �aliasz;;r�)rk�splitr>�replace�str�join�find�lstrip�cmdqueue�append�rstrip)r1r�args�iiZtmpArgZmarker�nextrrr�precmd�s(�


z
Pdb.precmdcCs"|jstj�||�S|�|�SdSr/)rOr9r:rl�handle_command_def)r1rrrrrl�sz
Pdb.onecmdcCs�|�|�\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|�|d|�n
|�|�zt|d|�}Wntk
r�|j}YnX|j	|j
kr�d|j|j<g|_dSdS)NZsilentT�endrr��do_F)Z	parselinerNrPr�rLr�rv�AttributeErrorr�r�commands_resumingrM)r1rr9�argZcmdlist�funcrrrr��s,
zPdb.handle_command_defcCst||jd�dS)N��file��printrS�r1�msgrrrrU�szPdb.messagecCstd||jd�dS)Nz***r�r�r�rrrr��sz	Pdb.errorcCs�|���d�rgSz|�||||�}Wntk
r>g}YnXt�|d�}|D]H}tj�|�rr|�|d�qRtj�	|�rR|�
��d�rR|�|d�qR|S)N)�:�,�*�/)�.pyz.pywr�)rk�endswith�_complete_expression�	Exception�globrHrI�isdirr��isfile�lower)r1�textr�begidx�endidx�ret�globs�fnrrr�_complete_location�s
zPdb._complete_locationcs�fdd�ttjj�D�S)Ncs.g|]&\}}|dk	rt|����rt|��qSr/)r��
startswith)�.0r,�bp�r�rr�
<listcomp>�s�z*Pdb._complete_bpnumber.<locals>.<listcomp>)rr6�
Breakpoint�
bpbynumber�r1r�rr�r�rr�r�_complete_bpnumber�szPdb._complete_bpnumberc	s�|js
gS|jj|j�}d�kr���d��z,|�d}�dd�D]}t||�}qDWnttfk
rrgYSXd��dd��d���fdd�t|�D�S�fdd�|�	�D�SdS)N�.rrr|cs"g|]}|��d�r�|�qS)r|�r��r��n)�dottedr�rrr��sz,Pdb._complete_expression.<locals>.<listcomp>csg|]}|���r|�qSrr�r�r�rrr�s
)
r^r"rdr�rv�KeyErrorr�r��dir�keys)r1r�rr�r��nsr$�partr)r�r�r�rr��s

zPdb._complete_expressioncCs,|sttjj�d}n&zt|�}Wn|�d�YdSX||_||jkrj|j||j||j	|f}nd}g|j|<d|j|<d|j	|<|j
}d|_
d|_zzz|��Wnht
k
�r|r�|d|j|<|d|j|<|d|j	|<n|j|=|j|=|j	|=|�d�YnXW5d|_||_
XdS)	Nrz.Usage: commands [bnum]
        ...
        endTFz(com) rr�z1command definition aborted, old commands restored)�lenr6r�r��intr�rPrLrMrNr=rOr�rT)r1r�ZbnumZold_command_defsZprompt_backrrr�do_commandssB%

�


zPdb.do_commandsrc
CsB|s8|jr4|�d�tjjD]}|r|�|���qdSd}d}d}|�d�}|dkrz||dd���}|d|���}|�	d�}d}	|dk�r|d|���}|�
|�}
|
s�|�d|�dS|
}||dd���}zt|�}Wn&t
k
�r|�d|�YdSXn�zt|�}Wn�t
k
�r�zt||jj|j�}Wn|}YnXz.t|d��rj|j}|j}|j}	|j}|j}WnD|�|�\}
}}|
�s�|�d	|�YYdS|
}	t|�}YnXYnX|�s�|��}|�||�}|�r>|�|||||	�}|�r|�|�n*|�||�d
}|�d|j|j|jf�dS)Nz!Num Type         Disp Enb   Wherer�rrr�z%r not found from sys.pathzBad lineno: %s�__func__zJThe specified object %r is not a function or was not found along sys.path.r|zBreakpoint %d at %s:%d) �breaksrUr6r�r�Zbpformatr�r�r��rfind�lookupmoduler�r�r��evalr^r"rd�hasattrr��__code__�co_name�co_firstlinenorq�lineinfo�defaultFile�	checklineZ	set_break�
get_breaks�numberr�r)r1r�Z	temporaryr�rr�condZcomma�colonrrfr�r+�okZlnr�errrrr�do_breakWs�





�

��zPdb.do_breakcCs"|jjj}|dkr|jr|j}|S)Nz<string>)r^rarqr@)r1rrrrr��s
zPdb.defaultFilecCs|�|d�dSr )r��r1r�rrr�	do_tbreak�sz
Pdb.do_tbreakc
Cs�d}|�d�}t|�dkr(|d��}nt|�dkrB|d��}n|S|dkrR|S|�d�}|ddkr~|d=t|�dkr~|S|��}t|�dkr�|d}n|�|d�}|r�|}|d}t||�}	|	p�|S)	N)NNN�'rr�r5r�r1)r�r�rkr�r�r)
r1Z
identifierZfailedZidstring�id�parts�fname�itemrfZanswerrrrr��s.



zPdb.lineinfocCs�t|d�r|jjnd}t�|||�}|s6|�d�dS|��}|rn|ddksn|dd�dksn|dd�dkr||�d�dS|S)	Nr^zEnd of filerrir�z"""z'''zBlank or comment)r�r^r"�	linecache�getlinerUrkr�)r1rrr�rrrrr��s
��
z
Pdb.checklinecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)Nz
Enabled %s)r��get_bpbynumberr�r��enablerU�r1r�r�r,r�r�rrr�	do_enable�sz
Pdb.do_enablecCsh|��}|D]V}z|�|�}Wn,tk
rJ}z|�|�W5d}~XYqX|��|�d|�qdS)NzDisabled %s)r�r�r�r��disablerUr�rrr�
do_disableszPdb.do_disablec
Cs�|�dd�}z|d}Wntk
r0d}YnXz|�|d���}WnHtk
rf|�d�YnXtk
r�}z|�|�W5d}~XYn.X||_|s�|�d|j�n|�d|j�dS)Nr�rr�Breakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.)	r��
IndexErrorr�rkr�r�r�rUr�)r1r�r�r�r�r�rrr�do_condition$s
zPdb.do_conditionc
Cs�|��}zt|d���}Wnd}YnXz|�|d���}WnHtk
rb|�d�Ynvtk
r�}z|�|�W5d}~XYnLX||_|dkr�|dkr�d|}nd}|�d||j	f�n|�d|j	�dS)Nrrrz%d crossingsz
1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.)
r�r�rkr�rr�r��ignorerUr�)r1r�r��countr�r�Zcountstrrrr�	do_ignore?s,	

��z
Pdb.do_ignorec
Cs�|stztd�}Wntk
r(d}YnX|����}|dkrpdd�tjjD�}|��|D]}|�d|�q\dSd|k�r|�	d�}|d|�}||dd�}zt
|�}Wntk
r�d	|}YnX|�||�}|�
||�}|r�|�|�n|D]}|�d|�q�dS|��}	|	D]\}z|�|�}Wn.tk
�r^}z|�|�W5d}~XYnX|�|�|�d|��qdS)
NzClear all breaks? �no)�yZyescSsg|]}|r|�qSrr)r�r�rrrr�psz Pdb.do_clear.<locals>.<listcomp>z
Deleted %sr�rzInvalid line number (%s))�input�EOFErrorrkr�r6r�r�Zclear_all_breaksrUr�r�r�r�Zclear_breakr�r�r�Zclear_bpbynumber)
r1r�ZreplyZbplistr�r,rrr�Z
numberlistrrr�do_clearbsF



zPdb.do_clearcCs|��dSr/)�print_stack_tracer�rrr�do_where�szPdb.do_wherecCs>||_|j|jd|_|jj|_|�|j|j�d|_dSr')r]r\r^r#rdrxr)r1r�rrr�
_select_frame�s

zPdb._select_framecCsz|jdkr|�d�dSzt|p"d�}Wn$tk
rL|�d|�YdSX|dkr\d}ntd|j|�}|�|�dS)NrzOldest framer�Invalid frame count (%s))r]r�r�r��maxr�r1r�rZnewframerrr�do_up�s

z	Pdb.do_upcCs�|jdt|j�kr"|�d�dSzt|p,d�}Wn$tk
rV|�d|�YdSX|dkrpt|j�d}ntt|j�d|j|�}|�|�dS)NrzNewest framerr)r]r�r\r�r�r��minrrrrr�do_down�s
zPdb.do_downcCsh|rRzt|�}Wn$tk
r4|�d|�YdSX||jjkrV|�d�dSnd}|�|j|�dS)N�Error in argument: %rz7"until" line number is smaller than current line numberr)r�r�r�r^rrZ	set_until)r1r�rrrr�do_until�s
zPdb.do_untilcCs|��dSr )rVr�rrr�do_step�szPdb.do_stepcCs|�|j�dSr )Zset_nextr^r�rrr�do_next�szPdb.do_nextcCs<|r4ddl}tjdd�}|�|�t_|tjdd�<t�dS)Nrr)�shlexr;�argvr�r)r1r�rZargv0rrr�do_run�sz
Pdb.do_runcCs|�|j�dSr )Z
set_returnr^r�rrr�	do_returnsz
Pdb.do_returncCs>|js2zt�tj|j�t_Wntk
r0YnX|��dSr )rFr�r�rYr
r�r�Zset_continuer�rrr�do_continues�zPdb.do_continuec
Cs�|jdt|j�kr"|�d�dSzt|�}Wntk
rL|�d�YnnXz:||j_|j|jd|f|j|j<|�|j|j�Wn0tk
r�}z|�d|�W5d}~XYnXdS)Nrz)You can only jump within the bottom framez)The 'jump' command requires a line numberrzJump failed: %s)	r]r�r\r�r�r�r^rrrx)r1r��errr�do_jump%s
zPdb.do_jumpcCs�t�d�|jj}|j}t|j|j|j�}d|j	�
�|_	|�d�zt�|j
|||f�Wn<tk
r�t��dd�}|�tj|�d�
��YnX|�d�t�|j�|j|_dS)Nz(%s) zENTERING RECURSIVE DEBUGGERr�r|zLEAVING RECURSIVE DEBUGGER)r;�settracer^r"rdr
rQrRrSr=rkrU�call_tracingrr�r�r�r~rZtrace_dispatchrw)r1r�r�r��pr�rrr�do_debugBs


zPdb.do_debugcCsd|_|��dS)NTr)�_user_requested_quit�set_quitr�rrr�do_quitYszPdb.do_quitcCs|�d�d|_|��dS)Nr5Tr)rUr&r'r�rrr�do_EOFds
z
Pdb.do_EOFcCs�|jj}|j}|j|j}|jtj@r.|d}|jtj@rB|d}t	|�D]>}|j
|}||krx|�d|||f�qJ|�d|f�qJdS)Nrz%s = %rz%s = *** undefined ***)r^rard�co_argcount�co_kwonlyargcount�co_flagsr!Z
CO_VARARGSZCO_VARKEYWORDS�range�co_varnamesrU)r1r��co�dictr�r,�namerrr�do_argsms
zPdb.do_argscCs.d|jkr |�t|jd��n
|�d�dS)NrzzNot yet returned!)rdrUr�r�r�rrr�	do_retval~s
z
Pdb.do_retvalcCsPzt||jj|j�WSt��dd�}|�tj|�d�	���YnXdS)Nr�r|)
r�r^r"rdr;r�r�r~rrk)r1r�r�rrr�_getval�szPdb._getvalcCsrz2|dkrt||jj|j�WSt||j|j�WSWn:t��dd�}tj|�d�	�}t
d|�YSXdS)Nr�r|z** raised %s **)r�r^r"rdr#r;r�r~rrkr.)r1r�rXr�r�rrrr��szPdb._getval_exceptcCs*z|�t|�|���WnYnXdSr/)rUr�r4r�rrr�do_p�szPdb.do_pcCs,z|�t�|�|���WnYnXdSr/)rU�pprintZpformatr4r�rrr�do_pp�sz	Pdb.do_ppcCsfd|_d}|r�|dkr�z^d|krX|�d�\}}t|���}t|���}||krr||}nt|���}td|d�}Wq�tk
r�|�d|�YdSXn0|jdks�|dkr�td|jj	d�}n
|jd}|dkr�|d}|jj
j}|�|�}zZt
�||jj�}|�||d|�|||j�t|t|��|_t|�|k�rH|�d�Wntk
�r`YnXdS)	Nr(r�r�r�r�
z[EOF])rwr�r�rkrr�r�rr^rrrarq�get_file_breaksr��getlinesr"�_print_linesrr�rUrT)r1r�Zlast�firstr�	breaklistr%rrr�do_list�s@




�zPdb.do_listc
Csp|jjj}|�|�}zt|j�\}}Wn2tk
rX}z|�|�WY�dSd}~XYnX|�||||j�dSr/)r^rarqr:r&rr�r<)r1r�rr>r%rr�rrr�do_longlist�s


zPdb.do_longlistc
Csvz|�|�}WnYdSXzt|�\}}Wn6ttfk
rd}z|�|�WY�dSd}~XYnX|�||�dSr/)r4r&r�	TypeErrorr�r<)r1r�r$r%rr�rrr�	do_source�s
z
Pdb.do_sourcerc
Cs�|r|j}|j�|d�}nd}}t||�D]|\}}t|��d�}	t|	�dkrV|	d7}	||krh|	d7}	n|	d7}	||kr�|	d7}	n||kr�|	d7}	|�|	d|���q,dS)	Nr|r��r��Bz->z>>�	)	rrrBr�rr��rjustr�rUr�)
r1r%rr�rXZcurrent_linenoZ
exc_linenorr�srrrr<s 

zPdb._print_linescCs�z|�|�}WnYdSXd}z
|j}Wntk
r@YnX|rZ|�d|j�dSz|jj}Wntk
rzYnX|r�|�d|j�dS|jtkr�|�d|j|j	f�dS|�t|��dS)NzFunction %sz	Method %szClass %s.%s)
r4r�r�rUr�r��	__class__�typerr)r1r��valuer+rrr�	do_whatiss.

z
Pdb.do_whatiscCsl|s8|�d�|j�|ji���D]}|�d|�q"n0|�|�}||j�|ji�|<|�d||f�dS)NzCurrently displaying:z%s: %rzdisplay %s: %r)rUr?r�r^r�r��
setdefault)r1r�r��valrrr�
do_display;s

zPdb.do_displaycCsT|r@z|j�|ji�|=WqPtk
r<|�d|�YqPXn|j�|jd�dS)Nznot displaying %s)r?r�r^r�r�rjr�rrr�do_undisplayNszPdb.do_undisplaycs�fdd�|j�|ji�D�S)Ncsg|]}|���r|�qSrr�)r�r r�rrr�^s
�z*Pdb.complete_undisplay.<locals>.<listcomp>)r?r�r^r�rr�r�complete_undisplay]szPdb.complete_undisplaycCs |jj|j�}tjd|d�dS)Nz
*interactive*)�local)r^r"rdr+�interact)r1r�r�rrr�do_interactaszPdb.do_interactcCs�|��}t|�dkrHt|j���}|D]}|�d||j|f�q&dS|d|jkr�t|�dkr�|�d|d|j|df�nd�|dd��|j|d<dS)Nrz%s = %srr�)r�r��sortedr>r�rUr�)r1r�r�r�r�rrr�do_aliasjs"zPdb.do_aliascCs6|��}t|�dkrdS|d|jkr2|j|d=dSr')r�r�r>)r1r�r�rrr�
do_unalias�s
zPdb.do_unaliascs�fdd�|jD�S)Ncsg|]}|���r|�qSrr�)r��ar�rrr��s
z(Pdb.complete_unalias.<locals>.<listcomp>)r>r�rr�r�complete_unalias�szPdb.complete_unaliasrrrrr(r!cCs4z|jD]}|�|�qWntk
r.YnXdSr/)r\rxrT)r1�frame_linenorrrr�s

zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|�||�||��dS)Nz> z  )r^rUZformat_stack_entry)r1rYZ
prompt_prefixrXrr�rrrrx�s

�zPdb.print_stack_entrycCs�|stj�||�Sz@zt|d|�}|�WWStk
rNt|d|�}YnXWn"tk
rt|�d|�Yn0Xtjjdkr�|�d|�dS|�	|j
���dS)NZhelp_r�zNo help for %rr�zJNo help for %r; please do not run Python with -OO if you need command help)r9r:�do_helprvr�r�r;�flags�optimizerU�__doc__r�)r1r�ZtopicZcommandrrrrZ�s 
�zPdb.do_helpcCs|�|jjpd���dS)Nr5)rU�	help_execr]rkr0rrrr^�s
z
Pdb.help_execcCs
t�dSr/)rr0rrr�help_pdb�szPdb.help_pdbcCs�tj�|�rtj�|�r|Stj�tjd|�}tj�|�rP|�|�|jkrP|Stj�|�\}}|dkrp|d}tj�|�r�|StjD]>}tj�	|�r�t�
|�}q�tj�||�}tj�|�r�|Sq�dS)Nrr5r�)rHrI�isabs�existsr�r;rpr@�splitext�islink�readlink)r1rrf�root�ext�dirname�fullnamerrrr��s"

zPdb.lookupmodulec	Csrd|_d|_ddl}|�|�\}}}|�|j�|_ddl}|j�	�|j�
d|j|j|j|t
d��|�|�dS)NTFr�__main__)r�__file__�__package__�
__loader__�__spec__�__builtins__)rAr&�runpy�_get_module_detailsrprqr@ri�__dict__r_�update�parent�loaderrnr)r1�module_namero�mod_name�mod_specr+rirrr�
_runmodule�s 
�zPdb._runmodulec	Cstddl}|j��|j�d|td��d|_|�|�|_d|_t	�
|��}d|��|jf}W5QRX|�|�dS)Nrri)rrjrnTFzexec(compile(%r, %r, 'exec')))
rirqr_rrrnrArpr@r&�io�	open_code�readr)r1rrir�	statementrrr�
_runscripts
�
�zPdb._runscript)r3NNNFT)r)N)rN)wrrrr�r8rYrZr[rhrerortrsr{r�ryr�rnr�r�r�rlr�rUr�r�r�r�r�Zcomplete_commandsr�r�Zdo_bZcomplete_breakZ
complete_br�Zcomplete_tbreakr�r�rZcomplete_enablerZcomplete_disablerZcomplete_conditionrZcomplete_ignorer
Zdo_clZcomplete_clearZcomplete_clrZdo_wZdo_btrrZdo_urZdo_drZdo_untrZdo_srZdo_nrZ
do_restartrZdo_rrZdo_cZdo_contr!Zdo_jr%Zcomplete_debugr(Zdo_qZdo_exitr)r2Zdo_ar3Zdo_rvr4r�r5r7Zcomplete_printZ
complete_pZcomplete_ppr?Zdo_lr@Zdo_llrBZcomplete_sourcer<rKZcomplete_whatisrNZcomplete_displayrOrPrSrUrVrXr�r�line_prefixrxrZZdo_hr^r_r�rxr}rrrrr
�s��
/	


M
]!!.	
		1
!	#	��whereZdownZup�breakZtbreakr_rr�rZ	conditionrL�stepr�ZuntilZjump�returnZretval�continuer(Zlonglistr�r$�ppZwhatis�sourceZdisplayZ	undisplayrRr�Zunalias�debug�quitr�z

cCst��|||�dSr/)r
r�r|r�r�rrrr;scCst��|||�Sr/)r
r)Z
expressionr�r�rrrr>scCst|||�dSr/)rr�rrrrAscOst�j||�Sr/)r
r
)r��kwdsrrrr
Es)�headercCs,t�}|dk	r|�|�|�t��j�dSr/)r
rUrr;�	_getframe�f_back)r��pdbrrrrHs
cCsB|dkrt��d}|dkr$td��t�}|��|�d|�dS)Nr�zAA valid traceback must be passed if no exception is being handled)r;r�r�r
rZrn)�tr$rrrrPscCsttj�dSr/)rr;�last_tracebackrrrrr	^szimport x; x.main()cCstt�dSr/)r�TESTCMDrrrr�testfsr�cCsddl}|�t�dSr')�pydocZpagerr])r�rrrrjsausage: pdb.py [-c command] ... [-m module | pyfile] [arg] ...

Debug the Python program given by pyfile. Alternatively,
an executable module or package to debug can be specified using
the -m switch.

Initial commands are read from .pdbrc files in your home directory
and in the current directory, if they exist.  Commands supplied with
-c are executed after commands from .pdbrc files.

To let the script run until an exception occurs, use "-c continue".
To let the script run up to a given line X in the debugged file, use
"-c 'until X'".c
Csddl}|�tjdd�dddg�\}}|s>tt�t�d�g}d}|D]B\}}|dkrltt�t��qJ|d	kr�|�|�qJ|d
krJd}qJ|d}|s�tj�	|�s�td|d
�t�d�|tjdd�<|s�tj�
|�tjd<t�}|j�
|�z6|�r|�|�n
|�|�|j�rW�qtd�Wq�tk
�r\td|d�tdd�|��Yq�tk
�r�tddd�tt��d�Yq�tk
�r�t��t�d�Yq�t��td�td�t��d}	|�d|	�td|d�Yq�Xq�dS)Nrrzmhc:rzcommand=r�F)z-hz--help)z-cz	--command)z-mTzError:zdoes not existz*The program finished and will be restartedZ
Restartingzwith arguments:rEr�z/The program exited via sys.exit(). Exit status:)r�z2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)�getoptr;rr��_usage�exitr�rHrIrargr
rGrKrxr}r&rr��
SystemExitr��SyntaxErrorr~�	print_excrn)
r�Zoptsr�rLZ
run_as_module�optZoptargr@r�r�rrr�main}sb 



�r�ri)NN)NN)N).rHryrr;r9r6r)r+r�r6r�r!r~r�r�r�__all__rr&r-r�r.r~r7r:r
r]Z_help_orderZ_commandrvrkr^rrrr
rrr	r�r�rr�r�rr�rrrr�<module>Fs��
		*
� 


C