�`^c@s�dZddlZddlZddlZddlZdddgZdefd��YZdfd��YZd�Z dfd ��YZ
d
�Zd�Zdefd
��YZ
d�Zd�Zd�ZdS(sDebugger basicsi�NtBdbQuittBdbt
BreakpointcBseZdZRS(sException to give up completely(t__name__t
__module__t__doc__(((s/sys/lib/python2.7/bdb.pyR
scBs�eZdZd,d�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd,d�Zd�Zd�Zdd,d,d�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&d'�Z(d,d,d(�Z)d,d,d)�Z*d*�Z+d+�Z,RS(-s�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.
cCs:|rt|�nd|_i|_i|_d|_dS(N(tsettNonetskiptbreakstfncachetframe_returning(tselfR((s/sys/lib/python2.7/bdb.pyt__init__s cCso|d|dd!dkr|S|jj|�}|sktjj|�}tjj|�}||j|<n|S(Nt<ii�t>(R
tgettostpathtabspathtnormcase(Rtfilenametcanonic((s/sys/lib/python2.7/bdb.pyRscCs3ddl}|j�d|_|jdd�dS(Ni�(t linecachet
checkcacheRtbotframet
_set_stopinfo(RR((s/sys/lib/python2.7/bdb.pytreset's
cCs�|jr
dS|dkr&|j|�S|dkrB|j||�S|dkr^|j||�S|dkrz|j||�S|dkr�|jS|dkr�|jS|dkr�|jSdGt|�GH|jS( Ntlinetcalltreturnt exceptiontc_calltc_exceptiontc_returns*bdb.Bdb.dispatch: unknown debugging event:(tquittingt
dispatch_linet
dispatch_calltdispatch_returntdispatch_exceptionttrace_dispatchtrepr(Rtframeteventtarg((s/sys/lib/python2.7/bdb.pyR(-s$
cCsG|j|�s|j|�r@|j|�|jr@t�q@n|jS(N(t stop_heret
break_heret user_lineR#RR((RR*((s/sys/lib/python2.7/bdb.pyR$As
cCsm|jdkr"|j|_|jS|j|�p=|j|�sDdS|j||�|jrft�n|jS(N( RRtf_backR(R-tbreak_anywheret user_callR#R(RR*R,((s/sys/lib/python2.7/bdb.pyR%Gs cCsd|j|�s||jkr]z||_|j||�Wdd|_X|jr]t�q]n|jS(N(R-treturnframeRtuser_returnRR#RR((RR*R,((s/sys/lib/python2.7/bdb.pyR&Ts
cCs;|j|�r4|j||�|jr4t�q4n|jS(N(R-tuser_exceptionR#RR((RR*R,((s/sys/lib/python2.7/bdb.pyR'^s
cCs.x'|jD]}tj||�r
tSq
WtS(N(RtfnmatchtTruetFalse(Rtmodule_nametpattern((s/sys/lib/python2.7/bdb.pytis_skipped_modulehscCs�|jr(|j|jjd��r(tS||jkrZ|jdkrJtS|j|jkSx;|dk r�||jk r�||j kr�t
S|j}q]WtS(NRi�(RR;t f_globalsRR8t stopframet
stoplinenotf_linenoRRR7R0(RR*((s/sys/lib/python2.7/bdb.pyR-ns
cCs�|j|jj�}||jkr(tS|j}||j|krj|jj}||j|krjtSnt|||�\}}|r�|j|_ |r�|j
r�|jt|j��nt
StSdS(N(Rtf_codetco_filenameR R8R?tco_firstlinenot effectivetnumbert currentbpt temporarytdo_cleartstrR7(RR*Rtlinenotbptflag((s/sys/lib/python2.7/bdb.pyR.~s cCs
td�dS(Ns)subclass of bdb must implement do_clear()(tNotImplementedError(RR,((s/sys/lib/python2.7/bdb.pyRG�scCs|j|jj�|jkS(N(RR@RAR (RR*((s/sys/lib/python2.7/bdb.pyR1�scCsdS(snThis method is called when there is the remote possibility
that we ever need to stop in this function.N((RR*t
argument_list((s/sys/lib/python2.7/bdb.pyR2�scCsdS(s9This method is called when we stop or break at this line.N((RR*((s/sys/lib/python2.7/bdb.pyR/�scCsdS(s5This method is called when a return trap is set here.N((RR*treturn_value((s/sys/lib/python2.7/bdb.pyR4�scCs|\}}}dS(N((RR*texc_infotexc_typet exc_valuet
exc_traceback((s/sys/lib/python2.7/bdb.pyR5�sicCs(||_||_d|_||_dS(Ni(R=R3R#R>(RR=R3R>((s/sys/lib/python2.7/bdb.pyR�s cCs|j|||jd�dS(sxStop when the line with the line no greater than the current one is
reached or when returning from current frameiN(RR?(RR*((s/sys/lib/python2.7/bdb.pyt set_until�scCsK|jr7|jj}|r7|jr7|j|_q7n|jdd�dS(sStop after one line of code.N(RR0tf_traceR(RR(Rtcaller_frame((s/sys/lib/python2.7/bdb.pytset_step�s
cCs|j|d�dS(s2Stop on the next line in or below the given frame.N(RR(RR*((s/sys/lib/python2.7/bdb.pytset_next�scCs|j|j|�dS(s)Stop when returning from the given frame.N(RR0(RR*((s/sys/lib/python2.7/bdb.pyt
set_return�scCsq|dkrtj�j}n|j�x(|rR|j|_||_|j}q+W|j�tj |j�dS(spStart debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
N(
Rtsyst _getframeR0RR(RTRRVtsettrace(RR*((s/sys/lib/python2.7/bdb.pyt set_trace�s
cCsm|j|jdd�|jsitjd�tj�j}x+|re||jk re|`|j}q>WndS(Ni�( RRRR RYR[RZR0RT(RR*((s/sys/lib/python2.7/bdb.pytset_continue�s
cCs/|j|_d|_d|_tjd�dS(Ni(RR=RR3R#RYR[(R((s/sys/lib/python2.7/bdb.pytset_quit�s c
Cs�|j|�}ddl}|j||�}|sAd||fS||jkr`g|j|<n|j|}||kr�|j|�nt|||||�} dS(Ni�sLine %s:%d does not exist(RRtgetlineR tappendR(
RRRIRFtcondtfuncnameRRtlistRJ((s/sys/lib/python2.7/bdb.pyt set_break�s
cCsJ||ftjkr,|j|j|�n|j|sF|j|=ndS(N(RtbplistR tremove(RRRI((s/sys/lib/python2.7/bdb.pyt
_prune_breaks
s
cCs�|j|�}||jkr&d|S||j|krGd||fSx&tj||fD]}|j�q\W|j||�dS(NsThere are no breakpoints in %ssThere is no breakpoint at %s:%d(RR RRetdeleteMeRg(RRRIRJ((s/sys/lib/python2.7/bdb.pytclear_breakscCs{yt|�}Wnd|SXytj|}Wntk
rHd|SX|sWd|S|j�|j|j|j�dS(Ns"Non-numeric breakpoint number (%s)s#Breakpoint number (%d) out of rangesBreakpoint (%d) already deleted(tintRt
bpbynumbert
IndexErrorRhRgtfileR(RR,RDRJ((s/sys/lib/python2.7/bdb.pytclear_bpbynumbers
cCsz|j|�}||jkr&d|SxC|j|D]4}tj||f}x|D]}|j�qTWq4W|j|=dS(NsThere are no breakpoints in %s(RR RReRh(RRRtblistRJ((s/sys/lib/python2.7/bdb.pytclear_all_file_breaks+s
cCsA|js
dSx$tjD]}|r|j�qqWi|_dS(NsThere are no breakpoints(R RRkRh(RRJ((s/sys/lib/python2.7/bdb.pytclear_all_breaks5s cCs/|j|�}||jko.||j|kS(N(RR (RRRI((s/sys/lib/python2.7/bdb.pyt get_break=scCsH|j|�}||jkrD||j|krDtj||fpGgS(N(RR RRe(RRRI((s/sys/lib/python2.7/bdb.pyt
get_breaksBscCs1|j|�}||jkr)|j|SgSdS(N(RR (RR((s/sys/lib/python2.7/bdb.pytget_file_breaksHscCs|jS(N(R (R((s/sys/lib/python2.7/bdb.pytget_all_breaksOscCs�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�dt |�d�}n||fS(Nii(ttb_framettb_nextRR`R?RR0treversetmaxtlent tb_lineno(Rtftttstackti((s/sys/lib/python2.7/bdb.pyt get_stackUs
s: cCsTddl}ddl}|\}}|j|jj�}d||f}tjdkrkd||f}n|jjr�||jj}n
|d}d|jkr�|jd} nd} | r�||j| �}n
|d}d|jkr|jd}
|d }||j|
�}n|j
|||j�}|rP|||j�}n|S(
Ni�s%s(%r)tplan9s%s:%r s<lambda>t__args__s()t
__return__s->(
RR)RR@RARYtplatformtco_nametf_localsRR_R<tstrip(Rtframe_linenotlprefixRR)R*RIRtstargstrvR((s/sys/lib/python2.7/bdb.pytformat_stack_entryis.
cBs�|dkr$ddl}|j}n|dkr9|}n|j�ej|j�e|ej �sr|d}nz&y|||UWne
k
r�nXWdd|_ejd�XdS(Ni�s
i(Rt__main__t__dict__RRYR[R(t
isinstancettypestCodeTypeRR#(RtcmdtglobalstlocalsR�((s/sys/lib/python2.7/bdb.pytrun�s
cCs�|dkr$ddl}|j}n|dkr9|}n|j�tj|j�t|tj �sr|d}nz,yt
|||�SWntk
r�nXWdd|_tjd�XdS(Ni�s
i(
RR�R�RRYR[R(R�R�R�tevalRR#(RtexprR�R�R�((s/sys/lib/python2.7/bdb.pytruneval�s
cCs|j|||�dS(N(R�(RR�R�R�((s/sys/lib/python2.7/bdb.pytrunctx�scOsi|j�tj|j�d}z+y|||�}Wntk
rInXWdd|_tjd�X|S(Ni(RRYR[R(RRR#(RtfuncR�tkwdstres((s/sys/lib/python2.7/bdb.pytruncall�s
N(-RRRRR
RRR(R$R%R&R'R;R-R.RGR1R2R/R4R5RRSRVRWRXR\R]R^RdRgRiRnRpRqRrRsRtRuR�R�R�R�R�R�(((s/sys/lib/python2.7/bdb.pyRsV
cCst�j�dS(N(RR\(((s/sys/lib/python2.7/bdb.pyR\�scBs\eZdZdZiZdgZdddd�Zd�Zd�Z d�Z
dd�ZRS( s�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.
iicCs�||_d|_||_||_||_||_d|_d|_d|_ t
j|_t
jdt
_|j
j|�||f|jkr�|j||fj|�n|g|j||f<dS(Nii(RbRtfunc_first_executable_lineRmRRFRatenabledtignorethitsRtnextRDRkR`Re(RRmRRFRaRb((s/sys/lib/python2.7/bdb.pyR
�s cCsT|j|jf}d|j|j<|j|j|�|j|sP|j|=ndS(N(RmRRRkRDReRf(Rtindex((s/sys/lib/python2.7/bdb.pyRh�s
cCs
d|_dS(Ni(R�(R((s/sys/lib/python2.7/bdb.pytenable�scCs
d|_dS(Ni(R�(R((s/sys/lib/python2.7/bdb.pytdisable�scCs�|dkrtj}n|jr*d}nd}|jrF|d}n
|d}|d|j||j|jfIJ|jr�|d|jfIJn|j r�|d|j IJn|j
r�j
dkr�d }nd
}|d|j
|fIJndS(Nsdel skeep syes sno s%-4dbreakpoint %s at %s:%ds stop only if %ss ignore next %d hitsiR�ts! breakpoint already hit %d time%s(RRYtstdoutRFR�RDRmRRaR�R�(Rtouttdisptss((s/sys/lib/python2.7/bdb.pytbpprint�s(
N(RRRR�ReRRkR
RhR�R�R�(((s/sys/lib/python2.7/bdb.pyR�s
cCsn|js#|j|jkrtStS|jj|jkr<tS|jsT|j|_n|j|jkrjtStS(s;Check whether we should break here because of `b.funcname`.(RbRR?R8R7R@R�R�(tbR*((s/sys/lib/python2.7/bdb.pyt
checkfuncnames cCstj||f}xtdt|��D]�||}|jdkrNq)nt||�scq)n|jd|_|js�|jdkr�|jd|_q)q|dfSq)yTt |j|j
|j�}|r|jdkr�jd|_q|dfSnWq)|dfSXq)WdS(s�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.
iiN(NN(
RRetrangeRzR�R�R�RaR�R�R<R�R(RmRR*t possiblesRR�tval((s/sys/lib/python2.7/bdb.pyRC3s.
tTdbcBs,eZd�Zd�Zd�Zd�ZRS(cCs,|jj}|sd}ndG|G|GHdS(Ns???s+++ call(R@R�(RR*R�tname((s/sys/lib/python2.7/bdb.pyR2is cCs}ddl}|jj}|s'd}n|j|jj�}|j||j|j�}dG|G|jG|GdG|j�GHdS(Ni�s???s+++t:( RR@R�RRAR_R?R<R�(RR*RR�tfnR((s/sys/lib/python2.7/bdb.pyR/ms cCs
dG|GHdS(Ns
+++ return((RR*tretval((s/sys/lib/python2.7/bdb.pyR4tscCsdG|GH|j�dS(Ns
+++ exception(R](RR*t exc_stuff((s/sys/lib/python2.7/bdb.pyR5vs (RRR2R/R4R5(((s/sys/lib/python2.7/bdb.pyR�hs cCs*dG|GdGHt|d�}dG|GHdS(Nsfoo(t)i
sbar returned(tbar(tntx((s/sys/lib/python2.7/bdb.pytfoozs
cCsdG|GdGH|dS(Nsbar(R�i((ta((s/sys/lib/python2.7/bdb.pyR�s
cCst�}|jd�dS(Nsimport bdb; bdb.foo(10)(R�R�(R}((s/sys/lib/python2.7/bdb.pyttest�s (RR6RYRR�t__all__t ExceptionRRR\RR�RCR�R�R�R�(((s/sys/lib/python2.7/bdb.pyt<module>s �T 5
|