^Rc@sdZddlZddlZddlZddlZdddgZdefdYZdfdYZdZ dfd YZ d Z d Z 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 dZ d Z d Z d Zd 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. cCs:|rt|nd|_i|_i|_d|_dS(N(tsettNonetskiptbreakstfncachetframe_returning(tselfR((s/usr/lib/python2.7/bdb.pyt__init__s  cCso|d|dd!dkr|S|jj|}|sktjj|}tjj|}||j|(R tgettostpathtabspathtnormcase(R tfilenametcanonic((s/usr/lib/python2.7/bdb.pyRscCs3ddl}|jd|_|jdddS(Ni(t linecachet checkcacheRtbotframet _set_stopinfo(R R((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_callt c_exceptiontc_returns*bdb.Bdb.dispatch: unknown debugging event:(tquittingt dispatch_linet dispatch_calltdispatch_returntdispatch_exceptionttrace_dispatchtrepr(R tframeteventtarg((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((R R*((s/usr/lib/python2.7/bdb.pyR$As   cCsm|jdkr"|j|_|jS|j|p=|j|sDdS|j|||jrftn|jS(N( RRtf_backR(R-tbreak_anywheret user_callR#R(R R*R,((s/usr/lib/python2.7/bdb.pyR%Gs  cCsd|j|s||jkr]z||_|j||Wdd|_X|jr]tq]n|jS(N(R-t returnframeR t user_returnRR#RR((R R*R,((s/usr/lib/python2.7/bdb.pyR&Ts   cCs;|j|r4|j|||jr4tq4n|jS(N(R-tuser_exceptionR#RR((R R*R,((s/usr/lib/python2.7/bdb.pyR'^s  cCs.x'|jD]}tj||r tSq WtS(N(RtfnmatchtTruetFalse(R t module_nametpattern((s/usr/lib/python2.7/bdb.pytis_skipped_modulehscCs|jr(|j|jjdr(tS||jkrZ|jdkrJtS|j|jkSx;|dk r||jk r||j krt S|j }q]WtS(NRi( RR;t f_globalsRR8t stopframet stoplinenotf_linenoRRR7R0(R R*((s/usr/lib/python2.7/bdb.pyR-ns  cCs|j|jj}||jkr(tS|j}||j|krj|jj}||j|krjtSnt|||\}}|r|j|_ |r|j r|j t |jnt StSdS(N(Rtf_codet co_filenameR R8R?tco_firstlinenot effectivetnumbert currentbpt temporarytdo_cleartstrR7(R R*Rtlinenotbptflag((s/usr/lib/python2.7/bdb.pyR.~s   cCs tddS(Ns)subclass of bdb must implement do_clear()(tNotImplementedError(R R,((s/usr/lib/python2.7/bdb.pyRGscCs|j|jj|jkS(N(RR@RAR (R R*((s/usr/lib/python2.7/bdb.pyR1scCsdS(snThis method is called when there is the remote possibility that we ever need to stop in this function.N((R R*t argument_list((s/usr/lib/python2.7/bdb.pyR2scCsdS(s9This method is called when we stop or break at this line.N((R R*((s/usr/lib/python2.7/bdb.pyR/scCsdS(s5This method is called when a return trap is set here.N((R R*t return_value((s/usr/lib/python2.7/bdb.pyR4scCs|\}}}dS(N((R R*texc_infotexc_typet exc_valuet exc_traceback((s/usr/lib/python2.7/bdb.pyR5sicCs(||_||_d|_||_dS(Ni(R=R3R#R>(R R=R3R>((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?(R R*((s/usr/lib/python2.7/bdb.pyt set_untilscCsK|jr7|jj}|r7|j r7|j|_q7n|jdddS(sStop after one line of code.N(R R0tf_traceR(RR(R t caller_frame((s/usr/lib/python2.7/bdb.pytset_steps   cCs|j|ddS(s2Stop on the next line in or below the given frame.N(RR(R R*((s/usr/lib/python2.7/bdb.pytset_nextscCs|j|j|dS(s)Stop when returning from the given frame.N(RR0(R R*((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 _getframeR0RR(RTRRVtsettrace(R R*((s/usr/lib/python2.7/bdb.pyt set_traces       cCsm|j|jdd|jsitjdtjj}x+|re||jk re|`|j}q>WndS(Ni( RRRR RYR[RZR0RT(R R*((s/usr/lib/python2.7/bdb.pyt set_continues  cCs/|j|_d|_d|_tjddS(Ni(RR=RR3R#RYR[(R ((s/usr/lib/python2.7/bdb.pytset_quits   c Cs|j|}ddl}|j||}|sAd||fS||jkr`g|j|t__args__s()t __return__s->( RR)RR@RAtco_nametf_localsRR_R<tstrip( R t frame_linenotlprefixRR)R*RIRtstargstrvR((s/usr/lib/python2.7/bdb.pytformat_stack_entryis*      cBs|dkr$ddl}|j}n|dkr9|}n|jej|je|ej sr|d}nz&y|||UWne k rnXWdd|_ ejdXdS(Nis i( Rt__main__t__dict__RRYR[R(t isinstancettypestCodeTypeRR#(R tcmdtglobalstlocalsR((s/usr/lib/python2.7/bdb.pytruns          cCs|dkr$ddl}|j}n|dkr9|}n|jtj|jt|tj sr|d}nz,yt |||SWnt k rnXWdd|_ tjdXdS(Nis i( RRRRRYR[R(RRRtevalRR#(R texprRRR((s/usr/lib/python2.7/bdb.pytrunevals          cCs|j|||dS(N(R(R RRR((s/usr/lib/python2.7/bdb.pytrunctxscOsi|jtj|jd}z+y|||}Wntk rInXWdd|_tjdX|S(Ni(RRYR[R(RRR#(R tfuncRtkwdstres((s/usr/lib/python2.7/bdb.pytruncalls   N(-RRRRR RRR(R$R%R&R'R;R-R.RGR1R2R/R4R5RRSRVRWRXR\R]R^RdRgRiRnRpRqRrRsRtRuRRRRRR(((s/usr/lib/python2.7/bdb.pyRsV                             cCstjdS(N(RR\(((s/usr/lib/python2.7/bdb.pyR\scBs\eZdZdZiZdgZddddZdZdZ dZ ddZ RS( 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 j dt _ |j j|||f|jkr|j||fj|n|g|j||fs      T  5