Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/
Upload File :
Current File : //usr/lib/python2.7/bdb.pyc


|_c@sdZddlZddlZddlZddlZdddgZdefdYZdfdYZdZ	dfd	YZ
d
ZdZdefd
YZ
dZdZdZdS(sDebugger basicsiNtBdbQuittBdbt
BreakpointcBseZdZRS(sException to give up completely(t__name__t
__module__t__doc__(((s/usr/lib/python2.7/bdb.pyR
scBseZdZd,dZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZddZdZdZdZdZd,dZdZdZdd,d,dZdZdZdZ dZ!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(-sGeneric 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.
    cCs1|rt|nd|_i|_i|_dS(N(tsettNonetskiptbreakstfncache(tselfR((s/usr/lib/python2.7/bdb.pyt__init__s	cCso|d|dd!dkr|S|jj|}|sktjj|}tjj|}||j|<n|S(Nt<iit>(R
tgettostpathtabspathtnormcase(Rtfilenametcanonic((s/usr/lib/python2.7/bdb.pyRscCs3ddl}|jd|_|jdddS(Ni(t	linecachet
checkcacheRtbotframet
_set_stopinfo(RR((s/usr/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/usr/lib/python2.7/bdb.pyR',s$	
cCsG|j|s|j|r@|j||jr@tq@n|jS(N(t	stop_heret
break_heret	user_lineR"RR'(RR)((s/usr/lib/python2.7/bdb.pyR#@s

	cCsm|jdkr"|j|_|jS|j|p=|j|sDdS|j|||jrftn|jS(N(	RRtf_backR'R,tbreak_anywheret	user_callR"R(RR)R+((s/usr/lib/python2.7/bdb.pyR$Fs		cCsJ|j|s||jkrC|j|||jrCtqCn|jS(N(R,treturnframetuser_returnR"RR'(RR)R+((s/usr/lib/python2.7/bdb.pyR%Ss
	cCs;|j|r4|j|||jr4tq4n|jS(N(R,tuser_exceptionR"RR'(RR)R+((s/usr/lib/python2.7/bdb.pyR&Ys
	cCs.x'|jD]}tj||r
tSq
WtS(N(RtfnmatchtTruetFalse(Rtmodule_nametpattern((s/usr/lib/python2.7/bdb.pytis_skipped_modulecscCs|jr(|j|jjdr(tS||jkrZ|jdkrJtS|j|jkSx;|dk	r||jk	r||j	krt
S|j}q]WtS(NRi(RR:t	f_globalsRR7t	stopframet
stoplinenotf_linenoRRR6R/(RR)((s/usr/lib/python2.7/bdb.pyR,is	
cCs|j|jj}||jkr(tS|j}||j|krj|jj}||j|krjtSnt|||\}}|r|j|_	|r|j
r|jt|jnt
StSdS(N(Rtf_codetco_filenameR	R7R>tco_firstlinenot	effectivetnumbert	currentbpt	temporarytdo_cleartstrR6(RR)Rtlinenotbptflag((s/usr/lib/python2.7/bdb.pyR-ys	cCs
tddS(Ns)subclass of bdb must implement do_clear()(tNotImplementedError(RR+((s/usr/lib/python2.7/bdb.pyRFscCs|j|jj|jkS(N(RR?R@R	(RR)((s/usr/lib/python2.7/bdb.pyR0scCsdS(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/usr/lib/python2.7/bdb.pyR1scCsdS(s9This method is called when we stop or break at this line.N((RR)((s/usr/lib/python2.7/bdb.pyR.scCsdS(s5This method is called when a return trap is set here.N((RR)treturn_value((s/usr/lib/python2.7/bdb.pyR3scCs|\}}}dS(N((RR)texc_infotexc_typet	exc_valuet
exc_traceback((s/usr/lib/python2.7/bdb.pyR4sicCs(||_||_d|_||_dS(Ni(R<R2R"R=(RR<R2R=((s/usr/lib/python2.7/bdb.pyRs			cCs|j|||jddS(sxStop when the line with the line no greater than the current one is
        reached or when returning from current frameiN(RR>(RR)((s/usr/lib/python2.7/bdb.pyt	set_untilscCs|jdddS(sStop after one line of code.N(RR(R((s/usr/lib/python2.7/bdb.pytset_stepscCs|j|ddS(s2Stop on the next line in or below the given frame.N(RR(RR)((s/usr/lib/python2.7/bdb.pytset_nextscCs|j|j|dS(s)Stop when returning from the given frame.N(RR/(RR)((s/usr/lib/python2.7/bdb.pyt
set_returnscCsq|dkrtjj}n|jx(|rR|j|_||_|j}q+W|jtj	|jdS(spStart debugging from `frame`.

        If frame is not specified, debugging starts from caller's frame.
        N(
Rtsyst	_getframeR/RR'tf_traceRRStsettrace(RR)((s/usr/lib/python2.7/bdb.pyt	set_traces
		

cCsm|j|jdd|jsitjdtjj}x+|re||jk	re|`|j}q>WndS(Ni(	RRRR	RVRYRWR/RX(RR)((s/usr/lib/python2.7/bdb.pytset_continues	
cCs/|j|_d|_d|_tjddS(Ni(RR<RR2R"RVRY(R((s/usr/lib/python2.7/bdb.pytset_quits		c
Cs|j|}ddl}|j||}|sAd||fS||jkr`g|j|<n|j|}||kr|j|nt|||||}	dS(NisLine %s:%d does not exist(RRtgetlineR	tappendR(
RRRHREtcondtfuncnameRRtlistRI((s/usr/lib/python2.7/bdb.pyt	set_breaks
cCsJ||ftjkr,|j|j|n|j|sF|j|=ndS(N(RtbplistR	tremove(RRRH((s/usr/lib/python2.7/bdb.pyt
_prune_breakss
cCs|j|}||jkr&d|S||j|krGd||fSx&tj||fD]}|jq\W|j||dS(NsThere are no breakpoints in %ssThere is no breakpoint at %s:%d(RR	RRctdeleteMeRe(RRRHRI((s/usr/lib/python2.7/bdb.pytclear_breakscCs{yt|}Wnd|SXytj|}Wntk
rHd|SX|sWd|S|j|j|j|jdS(Ns"Non-numeric breakpoint number (%s)s#Breakpoint number (%d) out of rangesBreakpoint (%d) already deleted(tintRt
bpbynumbert
IndexErrorRfRetfileR(RR+RCRI((s/usr/lib/python2.7/bdb.pytclear_bpbynumbers	
	
cCsz|j|}||jkr&d|SxC|j|D]4}tj||f}x|D]}|jqTWq4W|j|=dS(NsThere are no breakpoints in %s(RR	RRcRf(RRRtblistRI((s/usr/lib/python2.7/bdb.pytclear_all_file_breakss
cCsA|js
dSx$tjD]}|r|jqqWi|_dS(NsThere are no breakpoints(R	RRiRf(RRI((s/usr/lib/python2.7/bdb.pytclear_all_breaks(s	cCs/|j|}||jko.||j|kS(N(RR	(RRRH((s/usr/lib/python2.7/bdb.pyt	get_break0scCsH|j|}||jkrD||j|krDtj||fpGgS(N(RR	RRc(RRRH((s/usr/lib/python2.7/bdb.pyt
get_breaks5scCs1|j|}||jkr)|j|SgSdS(N(RR	(RR((s/usr/lib/python2.7/bdb.pytget_file_breaks;scCs|jS(N(R	(R((s/usr/lib/python2.7/bdb.pytget_all_breaksBscCsg}|r'|j|kr'|j}nxB|dk	rk|j||jf||jkr_Pn|j}q*W|jtdt	|d}x2|dk	r|j|j|j
f|j}qW|dkrtdt	|d}n||fS(Nii(ttb_framettb_nextRR^R>RR/treversetmaxtlent	tb_lineno(Rtftttstackti((s/usr/lib/python2.7/bdb.pyt	get_stackHs 


s: cCs2ddl}ddl}|\}}|j|jj}d||f}|jjrh||jj}n
|d}d|jkr|jd}	nd}	|	r||j|	}n
|d}d|jkr|jd}
|d}||j|
}n|j|||j	}|r.|||j
}n|S(Nis%s(%r)s<lambda>t__args__s()t
__return__s->(RR(RR?R@tco_nametf_localsRR]R;tstrip(Rtframe_linenotlprefixRR(R)RHRtstargstrvR((s/usr/lib/python2.7/bdb.pytformat_stack_entry\s*



cBs|dkr$ddl}|j}n|dkr9|}n|jej|je|ej	sr|d}nz&y|||UWne
k
rnXWdd|_ejdXdS(Nis
i(Rt__main__t__dict__RRVRYR't
isinstancettypestCodeTypeRR"(RtcmdtglobalstlocalsR((s/usr/lib/python2.7/bdb.pytrunxs 	


	cCs|dkr$ddl}|j}n|dkr9|}n|jtj|jt|tj	sr|d}nz,yt
|||SWntk
rnXWdd|_tjdXdS(Nis
i(
RRRRRVRYR'RRRtevalRR"(RtexprRRR((s/usr/lib/python2.7/bdb.pytrunevals 	


	cCs|j|||dS(N(R(RRRR((s/usr/lib/python2.7/bdb.pytrunctxscOsi|jtj|jd}z+y|||}Wntk
rInXWdd|_tjdX|S(Ni(RRVRYR'RRR"(RtfuncRtkwdstres((s/usr/lib/python2.7/bdb.pytruncalls

	N(-RRRRRRRR'R#R$R%R&R:R,R-RFR0R1R.R3R4RRRRSRTRURZR[R\RbReRgRlRnRoRpRqRrRsR~RRRRR(((s/usr/lib/python2.7/bdb.pyRsV	
				
		
															
		
		
							cCstjdS(N(RRZ(((s/usr/lib/python2.7/bdb.pyRZscBs\eZdZdZiZdgZddddZdZdZ	dZ
ddZRS(	sBreakpoint 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(R`Rtfunc_first_executable_lineRkRRER_tenabledtignorethitsRtnextRCRiR^Rc(RRkRRER_R`((s/usr/lib/python2.7/bdb.pyRs									cCsT|j|jf}d|j|j<|j|j||j|sP|j|=ndS(N(RkRRRiRCRcRd(Rtindex((s/usr/lib/python2.7/bdb.pyRfs

cCs
d|_dS(Ni(R(R((s/usr/lib/python2.7/bdb.pytenablescCs
d|_dS(Ni(R(R((s/usr/lib/python2.7/bdb.pytdisablescCs|dkrtj}n|jr*d}nd}|jrF|d}n
|d}|d|j||j|jfIJ|jr|d|jfIJn|j	r|d|j	IJn|j
r|j
dkrd	}nd
}|d|j
|fIJndS(Nsdel  skeep syes  sno   s%-4dbreakpoint   %s at %s:%ds	stop only if %ss	ignore next %d hitsiRts!	breakpoint already hit %d time%s(RRVtstdoutRERRCRkRR_RR(Rtouttdisptss((s/usr/lib/python2.7/bdb.pytbpprints(			

				N(RRRRRcRRiRRfRRR(((s/usr/lib/python2.7/bdb.pyRs
				cCsn|js#|j|jkrtStS|jj|jkr<tS|jsT|j|_n|j|jkrjtStS(s;Check whether we should break here because of `b.funcname`.(R`RR>R7R6R?RR(tbR)((s/usr/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(sDetermine 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(
RRctrangeRxRRRR_RRR;RR(RkRR)t	possiblesR}Rtval((s/usr/lib/python2.7/bdb.pyRB$s.
	
tTdbcBs,eZdZdZdZdZRS(cCs,|jj}|sd}ndG|G|GHdS(Ns???s+++ call(R?R(RR)Rtname((s/usr/lib/python2.7/bdb.pyR1Zs	cCs}ddl}|jj}|s'd}n|j|jj}|j||j|j}dG|G|jG|GdG|jGHdS(Nis???s+++t:(	RR?RRR@R]R>R;R(RR)RRtfnR((s/usr/lib/python2.7/bdb.pyR.^s	cCs
dG|GHdS(Ns
+++ return((RR)tretval((s/usr/lib/python2.7/bdb.pyR3escCsdG|GH|jdS(Ns
+++ exception(R[(RR)t	exc_stuff((s/usr/lib/python2.7/bdb.pyR4gs	(RRR1R.R3R4(((s/usr/lib/python2.7/bdb.pyRYs			cCs*dG|GdGHt|d}dG|GHdS(Nsfoo(t)i
sbar returned(tbar(tntx((s/usr/lib/python2.7/bdb.pytfooks
cCsdG|GdGH|dS(Nsbar(Ri((ta((s/usr/lib/python2.7/bdb.pyRps
cCst}|jddS(Nsimport bdb; bdb.foo(10)(RR(R{((s/usr/lib/python2.7/bdb.pyttestts	(RR5RVRRt__all__t	ExceptionRRRZRRRBRRRR(((s/usr/lib/python2.7/bdb.pyt<module>s 	T		5