Lc@sdZddkZddkZddkZdddgZdefdYZdfdYZdZdfd YZ d Z d Z d efd YZ dZ dZdZdS(sDebugger basicsiNtBdbQuittBdbt BreakpointcBseZdZRS(sException to give up completely(t__name__t __module__t__doc__(((s/usr/lib64/python2.6/bdb.pyR scBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZddZdZdZdZdZd*dZdZdZdd*d*dZdZdZdZdZ dZ!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. cCsh|_h|_dS(N(tbreakstfncache(tself((s/usr/lib64/python2.6/bdb.pyt__init__s cCss|d|dd!djo|S|ii|}|p5tii|}tii|}||i|(Rtgettostpathtabspathtnormcase(Rtfilenametcanonic((s/usr/lib64/python2.6/bdb.pyRscCs3ddk}|id|_|idddS(Ni(t linecachet checkcachetNonetbotframet _set_stopinfo(RR((s/usr/lib64/python2.6/bdb.pytreset$s   cCs|iodS|djo|i|S|djo|i||S|djo|i||S|djo|i||S|djo|iS|djo|iS|djo|iSdGt|GH|iS( Ntlinetcalltreturnt exceptiontc_callt c_exceptiontc_returns*bdb.Bdb.dispatch: unknown debugging event:(tquittingt dispatch_linet dispatch_calltdispatch_returntdispatch_exceptionttrace_dispatchtrepr(Rtframeteventtarg((s/usr/lib64/python2.6/bdb.pyR%*s$        cCsL|i|p|i|o%|i||io tqEn|iS(N(t stop_heret break_heret user_lineR RR%(RR'((s/usr/lib64/python2.6/bdb.pyR!>s    cCst|idjo|i|_|iS|i|p |i|pdS|i|||io tn|iS(N( RRtf_backR%R*tbreak_anywheret user_callR R(RR'R)((s/usr/lib64/python2.6/bdb.pyR"Ds   cCsO|i|p||ijo(|i|||io tqHn|iS(N(R*t returnframet user_returnR RR%(RR'R)((s/usr/lib64/python2.6/bdb.pyR#Qs   cCs?|i|o(|i|||io tq8n|iS(N(R*tuser_exceptionR RR%(RR'R)((s/usr/lib64/python2.6/bdb.pyR$Ws  cCs}||ijo&|idjotS|i|ijSx@|dj o2||ij o"||ijotS|i}q9WtS(Ni(t stopframet stoplinenotFalsetf_linenoRRtTrueR-(RR'((s/usr/lib64/python2.6/bdb.pyR*ascCs|i|ii}||ijotS|i}||i|jo)|ii}||i|jotSnt|||\}}|o<|i|_ |o$|i o|i t |int StSdS(N(Rtf_codet co_filenameRR5R6tco_firstlinenot effectivetnumbert currentbpt temporarytdo_cleartstrR7(RR'Rtlinenotbptflag((s/usr/lib64/python2.6/bdb.pyR+ns    cCs tddS(Ns)subclass of bdb must implement do_clear()(tNotImplementedError(RR)((s/usr/lib64/python2.6/bdb.pyR?scCs|i|ii|ijS(N(RR8R9R(RR'((s/usr/lib64/python2.6/bdb.pyR.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/usr/lib64/python2.6/bdb.pyR/scCsdS(s9This method is called when we stop or break at this line.N((RR'((s/usr/lib64/python2.6/bdb.pyR,scCsdS(s5This method is called when a return trap is set here.N((RR't return_value((s/usr/lib64/python2.6/bdb.pyR1scCs|\}}}dS(N((RR'texc_infotexc_typet exc_valuet exc_traceback((s/usr/lib64/python2.6/bdb.pyR2sicCs(||_||_d|_||_dS(Ni(R3R0R R4(RR3R0R4((s/usr/lib64/python2.6/bdb.pyRs   cCs|i|||iddS(sxStop when the line with the line no greater than the current one is reached or when returning from current frameiN(RR6(RR'((s/usr/lib64/python2.6/bdb.pyt set_untilscCs|idddS(sStop after one line of code.N(RR(R((s/usr/lib64/python2.6/bdb.pytset_stepscCs|i|ddS(s2Stop on the next line in or below the given frame.N(RR(RR'((s/usr/lib64/python2.6/bdb.pytset_nextscCs|i|i|dS(s)Stop when returning from the given frame.N(RR-(RR'((s/usr/lib64/python2.6/bdb.pyt set_returnscCsu|djotii}n|ix*|o"|i|_||_|i}q-W|iti |idS(spStart debugging from `frame`. If frame is not specified, debugging starts from caller's frame. N( Rtsyst _getframeR-RR%tf_traceRRLtsettrace(RR'((s/usr/lib64/python2.6/bdb.pyt set_traces     cCsr|i|idd|ipNtidtii}x/|o#||ij o|`|i}q?WndS(Ni( RRRRRORRRPR-RQ(RR'((s/usr/lib64/python2.6/bdb.pyt set_continues  cCs/|i|_d|_d|_tiddS(Ni(RR3RR0R RORR(R((s/usr/lib64/python2.6/bdb.pytset_quits   c Cs|i|}ddk}|i||}|pd||fS||ijog|i|tcondtfuncnameRRtlistRB((s/usr/lib64/python2.6/bdb.pyt set_breaks    cCs|i|}||ijo d|S||i|jod||fSx&ti||fD]}|iq`Wtii||fp|i|i|n|i|p|i|=ndS(NsThere are no breakpoints in %ssThere is no breakpoint at %s:%d(RRRtbplisttdeleteMethas_keytremove(RRRARB((s/usr/lib64/python2.6/bdb.pyt clear_breaks  c Csuyt|}Wn d|SXyti|}Wntj o d|SX|p d|S|i|i|idS(Ns"Non-numeric breakpoint number (%s)s#Breakpoint number (%d) out of rangesBreakpoint (%d) already deleted(tintRt bpbynumbert IndexErrorR`tfileR(RR)R<RB((s/usr/lib64/python2.6/bdb.pytclear_bpbynumbers   cCs||i|}||ijo d|SxC|i|D]4}ti||f}x|D]}|iqVWq6W|i|=dS(NsThere are no breakpoints in %s(RRRR\R](RRRtblistRB((s/usr/lib64/python2.6/bdb.pytclear_all_file_breakss cCsE|ipdSx&tiD]}|o|iqqWh|_dS(NsThere are no breakpoints(RRRbR](RRB((s/usr/lib64/python2.6/bdb.pytclear_all_breakss  cCs0|i|}||ijo||i|jS(N(RR(RRRA((s/usr/lib64/python2.6/bdb.pyt get_break!scCsK|i|}||ijo(||i|joti||fpgS(N(RRRR\(RRRA((s/usr/lib64/python2.6/bdb.pyt get_breaks&scCs3|i|}||ijo |i|SgSdS(N(RR(RR((s/usr/lib64/python2.6/bdb.pytget_file_breaks,s cCs|iS(N(R(R((s/usr/lib64/python2.6/bdb.pytget_all_breaks3scCsg}|o|i|jo |i}nxF|dj o8|i||if||ijoPn|i}q-W|itdt |d}x4|dj o&|i|i|i f|i}qW|djotdt |d}n||fS(Nii( ttb_framettb_nextRRWR6RR-treversetmaxtlent tb_lineno(Rtftttstackti((s/usr/lib64/python2.6/bdb.pyt get_stack9s$     s: c Cs<ddk}ddk}|\}}|i|ii}d||f}|iio||ii}n |d}d|ijo|id} nd} | o||i| }n |d}d|ijo.|id} |d}||i| }n|i|||i } | o||| i }n|S(Nis%s(%r)st__args__s()t __return__s->( RR&RR8R9tco_nametf_localsRRVt f_globalststrip( Rt frame_linenotlprefixRR&R'RARtstargstrvR((s/usr/lib64/python2.6/bdb.pytformat_stack_entryMs*      c Bs|djoddk}|i}n|djo |}n|iei|ie|ei p|d}nz(y|||UWne j onXWdd|_ eidXdS(Nis i( Rt__main__t__dict__RRORRR%t isinstancettypestCodeTypeRR (RtcmdtglobalstlocalsR((s/usr/lib64/python2.6/bdb.pytrunis         c Cs|djoddk}|i}n|djo |}n|iti|it|ti p|d}nz.yt |||SWnt j onXWdd|_ tidXdS(Nis i( RRRRRORRR%RRRtevalRR (RtexprRRR((s/usr/lib64/python2.6/bdb.pytruneval{s         cCs|i|||dS(N(R(RRRR((s/usr/lib64/python2.6/bdb.pytrunctxsc Osk|iti|id}z-y|||}Wntj onXWdd|_tidX|S(Ni(RRORRR%RRR (RtfuncRtkwdstres((s/usr/lib64/python2.6/bdb.pytruncalls   N(+RRRR RRR%R!R"R#R$R*R+R?R.R/R,R1R2RRKRLRMRNRRSRTRUR[R`ReRgRhRiRjRkRlRwRRRRR(((s/usr/lib64/python2.6/bdb.pyR sR                            cCstidS(N(RRS(((s/usr/lib64/python2.6/bdb.pyRSscBs\eZdZdZhZdgZddddZdZdZ 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 i |_ t i dt _ |i i||ii||fo|i||fi|n|g|i||fRXtenabledtignorethitsRtnextR<RbRWR\R^(RRdRR>RXRY((s/usr/lib64/python2.6/bdb.pyR s          cCsV|i|if}d|i|i<|i|i||i|p|i|=ndS(N(RdRRRbR<R\R_(Rtindex((s/usr/lib64/python2.6/bdb.pyR]s cCs d|_dS(Ni(R(R((s/usr/lib64/python2.6/bdb.pytenablescCs d|_dS(Ni(R(R((s/usr/lib64/python2.6/bdb.pytdisablescCs|djo ti}n|io d}nd}|io|d}n |d}|d|i||i|ifIJ|io|d|ifIJn|i o|d|i IJn|i o;|i djo d }nd }|d |i |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( RROtstdoutR>RR<RdRRXRR(Rtouttdisptss((s/usr/lib64/python2.6/bdb.pytbpprints(          N( RRRRR\RRbR R]RRR(((s/usr/lib64/python2.6/bdb.pyRs     cCsx|ip|i|ijotStS|ii|ijotS|ip|i|_n|i|ijotStS(s;Check whether we should break here because of `b.funcname`.(RYRR6R5R7R8RzR(tbR'((s/usr/lib64/python2.6/bdb.pyt checkfuncnames  cCs'ti||f}x tdt|D]}||}|idjoq)nt||pq)n|id|_|ip5|idjo|id|_q)q|dfSq)yXt |i|i |i }|o2|idjo|id|_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( RR\trangeRqRRRRXRRR|R{R(RdRR't possiblesRvRtval((s/usr/lib64/python2.6/bdb.pyR;s0   tTdbcBs,eZdZdZdZdZRS(cCs.|ii}|p d}ndG|G|GHdS(Ns???s+++ call(R8Rz(RR'Rtname((s/usr/lib64/python2.6/bdb.pyR/Ks  cCsddk}|ii}|p d}n|i|ii}|i||i|i}dG|G|iG|GdG|iGHdS(Nis???s+++t:( RR8RzRR9RVR6R|R}(RR'RRtfnR((s/usr/lib64/python2.6/bdb.pyR,Os   cCs dG|GHdS(Ns +++ return((RR'tretval((s/usr/lib64/python2.6/bdb.pyR1VscCsdG|GH|idS(Ns +++ exception(RT(RR't exc_stuff((s/usr/lib64/python2.6/bdb.pyR2Xs (RRR/R,R1R2(((s/usr/lib64/python2.6/bdb.pyRJs   cCs*dG|GdGHt|d}dG|GHdS(Nsfoo(t)i s bar returned(tbar(tntx((s/usr/lib64/python2.6/bdb.pytfoo\s cCsdG|GdGH|dS(Nsbar(Ri((ta((s/usr/lib64/python2.6/bdb.pyRas cCst}|iddS(Nsimport bdb; bdb.foo(10)(RR(Rt((s/usr/lib64/python2.6/bdb.pyttestes (RROR Rt__all__t ExceptionRRRSRRR;RRRR(((s/usr/lib64/python2.6/bdb.pyts    T  5