ó Ö@Qc@s¨ddlZddlZddlZddlZddlZddlZddlZdZdZdZ dZ dZ dZ dd d „ƒYZ d ejfd „ƒYZdS( i˙˙˙˙Niiiiigŕ?tPersistentBreakpointcBs2eZddd„Zd„Zd„Zd„ZRS(cCs:||_||_||_||_d|_t|_dS(N(townertfiletlinetcondtNonetfuncnametFalsetactive(tselfRRRRR((s..\grt_python_debugger.pyt__init__$s      cCs-||_|jr)|jƒ|jƒndS(N(RRt deactivatetactivate(R R((s..\grt_python_debugger.pyt set_condition,s   cCsU|jj|jj|jƒ|jd|jƒ}|dkrHt|_n t |_|S(NR( Rt set_breaktcanonicRRRRtTrueRR(R tf((s..\grt_python_debugger.pyR 3s 0   cCs)|jj|jj|jƒ|jƒdS(N(Rt clear_breakRRR(R ((s..\grt_python_debugger.pyR <sN(t__name__t __module__RR R R R (((s..\grt_python_debugger.pyR#s  t PyDebuggercBs4eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z e d „Z d „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d „Z#RS(!cCsetjj|ƒ||_d|_d|_d|_t|_ g|_ d|_ t|_ t|_ dS(Ni(tbdbtBdbR tuiRt main_filet current_stackttop_stack_indexRtstarted_steppingtpersistent_breakpointstlast_heartbeatt is_steppingt pause_pending(R R((s..\grt_python_debugger.pyR Bs        cCs:x3|jD](}|j|kr |j|kr |Sq WdS(N(RRRR(R RRtpb((s..\grt_python_debugger.pytfind_pbreakpointPscCsH|jƒx7|jD],}|jƒ}|r|jd|ƒqqWdS(Ns Error activating breakpoint: %s (tclear_all_breaksRR tui_print(R R!ts((s..\grt_python_debugger.pytenable_breakpointsWs   c Csîddl}ddl}|jƒxĹt|dƒD]ł\}}t}|jjru|jj}|dkr{t}q{nd}|jj|jj }|rÄ|rˇ|ddj |ƒ}qÄ|d}n|j ||j |jj ƒ|ƒq3WdS(Ni˙˙˙˙isss(%s)s, s()(t linecachetreprtui_clear_stacktreversedRtf_codetco_nameRt co_varnamest co_argcounttjoint ui_add_stackRt co_filename( R tstackR'R(tframeRt show_argstlocationtargs((s..\grt_python_debugger.pyt show_stack_s      cCs|j|jtƒdS(N(thandle_program_stopttb_frametSTOP_REASON_EXCEPTION(R ttb((s..\grt_python_debugger.pytuncaught_exceptionuscCs÷|jj}|j}|j|dƒ\|_|_t|jƒdkrV|jƒdS|j|jd|_ |j |jƒ|j |jƒ|j |||ƒ}|sąd}nt |d|ƒ}|tkrě|dkrě|dtƒn|ƒdS(Niitaborttwdb_tcontinuetquiet(R+R1tf_linenot get_stackRRRtlentset_stept current_frameR7twdb_refresh_variablestui_program_stoppedtgetattrtSTOP_REASON_HEARTBEATR(R R3treasontfilenameRtnext_command_namet next_command((s..\grt_python_debugger.pyR8ys     cCsmt|_|r(t|_|jdƒnt|_|jdƒy|jƒWn<tk rŠ}|jd|ƒ|jtjƒdƒdSX|j |ƒ|_ y|j d|j ƒWną|jd|ƒt j ƒ\}}}tj|ƒ}|jdjtj|dƒƒƒ|jdjtj||ƒƒdƒx|jdk rW|j}q<W|j|ƒnXdS( Ns> step s> run s!Error activating breakpoints: %s s sexecfile(r"%s")s'Uncaught exception while executing %s: ti(RR RRR$R&t Exceptiont tracebackt format_excRRtruntsystexc_infot extract_tbR/t format_listtformat_exception_onlyttb_nextRR<(R RKtsteppingtexctetvttR2((s..\grt_python_debugger.pytwdb_run—s0    #& cCs6|jdƒ|jƒd|_d|_d|_dS(Ns> stop (R$tset_quitRRERR(R ((s..\grt_python_debugger.pytwdb_stop¸s     cCs6|jdƒ|jƒd|_d|_d|_dS(Ns> abort (R$R_RRERR(R ((s..\grt_python_debugger.pyt wdb_abortŔs     cCs$|jdƒ|jƒt|_dS(Ns> pause (R$RDRR (R ((s..\grt_python_debugger.pyt wdb_pauseÇs  cCsH|s|jdƒn|jƒd|_d|_d|_t|_dS(Ns > continue (R$RDRRERRRR(R R@((s..\grt_python_debugger.pyt wdb_continueĚs    cCsE|jdƒ|j|jƒd|_d|_d|_t|_dS(Ns> step (R$tset_nextRERRRRR(R ((s..\grt_python_debugger.pytwdb_step×s     cCs?|jdƒ|jƒd|_d|_d|_t|_dS(Ns > step into (R$RDRRERRRR(R ((s..\grt_python_debugger.pyt wdb_step_intoŕs      cCsE|jdƒ|j|jƒd|_d|_d|_t|_dS(Ns > step out (R$t set_returnRERRRRR(R ((s..\grt_python_debugger.pyt wdb_step_outés     cCsD|jƒx3|jD](}|j|j|j|j|jƒqWdS(N(tui_clear_breakpointsRtui_add_breakpointRRRR(R R!((s..\grt_python_debugger.pytwdb_refresh_breakpointsńs cCs=|dkr9|t|jƒkr9|j|j|ƒtStS(Ni(RCRR RR(R tbp_indexR((s..\grt_python_debugger.pytwdb_set_bp_condition÷s!cCsŐ|js|jƒdS|dkr,d}n|j|d}|jƒt}||jks|dkrˆd|d|jkrˆt}n|s|jddƒxe|jj|jj D]M}||j krî|jd|t |j |ƒƒqľ|jd|dƒqľW|jddƒx¸|jj|jjD]M}||j krf|jd|t |j |ƒƒq-|jd|dƒq-WnP|jd dƒx=t |j j ƒƒD]&\}}|jd|t |ƒƒq§WdS( Niii˙˙˙˙it ArgumentsRNs tLocalstGlobals(Rtui_clear_variablesRRRtui_add_variableR+R-R.tf_localsR(tsortedt f_globalstitems(R t frame_indexR3ttopleveltvarnametvalue((s..\grt_python_debugger.pyRFţs0     2 $$"cCs–|j||ƒ}|r@|jj|ƒ|jƒ|jƒtSt|||ƒ}|jj|ƒ|jƒ|j |j |j |j |j ƒtSdS(N(R"RtremoveR RkRRtappendR RjRRRRR(R RRR!((s..\grt_python_debugger.pytwdb_toggle_breakpoint"s   "cCs˘x‘|jD]†}|j|kr%q n|j|ksO|dkr |j|kr |jr~|jƒ|j|7_|jƒq|j|7_q q W|jƒdS(Ni(RRRRR R Rk(R RRtdeltatbp((s..\grt_python_debugger.pytwdb_update_breakpoint1s*   cCsŃtjj|j|ƒƒd}xŤtjjƒD]š}t|ddƒ}|r/tjj|ƒd}||krÉ|j d|ƒyt |ƒWn1|j d|ƒddl }|j ƒ‚nXPqÉq/q/WdS(Nit__file__sReloading module %s...sThere was an error reloading %si˙˙˙˙( tostpathtsplitextRRStmodulestvaluesRHRR$treloadRPt print_exc(R RRƒtmoduletmpathRP((s..\grt_python_debugger.pytwdb_reload_module_for_fileAs   cCstj|j|ƒdS(N(twbpdbR$R(R tmsg((s..\grt_python_debugger.pyR$VscCstj|jƒdS(N(RŒRiR(R ((s..\grt_python_debugger.pyRiZscCs tj|j||||ƒdS(N(RŒRjR(R RRRR((s..\grt_python_debugger.pyRj^scCstj|j|||ƒS(N(RŒRGR(R RKRRJ((s..\grt_python_debugger.pyRGbscCstj|jƒdS(N(RŒR)R(R ((s..\grt_python_debugger.pyR)fscCstj|j|||ƒdS(N(RŒR0R(R R5RR((s..\grt_python_debugger.pyR0jscCstj|jƒdS(N(RŒRqR(R ((s..\grt_python_debugger.pyRqnscCstj|j||ƒdS(N(RŒRrR(R tvariableRz((s..\grt_python_debugger.pyRrrscCsdS(sThis method is called from dispatch_call() when there is the possibility that a break might be necessary anywhere inside the called function.N((R R3t argument_list((s..\grt_python_debugger.pyt user_callwscCs§|jrt|_t}n`|jr-t}nN|j|ƒrR|jdƒt}n)tjƒ}||j t krudSt }t|_|j ||ƒtjƒ|_ dS(s_This method is called from dispatch_line() when either stop_here() or break_here() yields True.sBreakpoint hit N( R RtSTOP_REASON_PAUSERtSTOP_REASON_STEPt break_hereR$tSTOP_REASON_BREAKPOINTttimeRtHEARTBEAT_INTERVALRIR8(R R3RJR]((s..\grt_python_debugger.pyt user_line|s         cCsdS(sJThis method is called from dispatch_return() when stop_here() yields True.N((R R3t return_value((s..\grt_python_debugger.pyt user_return—scCsdS(sMThis method is called from dispatch_exception() when stop_here() yields True.N((R R3RT((s..\grt_python_debugger.pytuser_exceptionœscCsdS(sCHandle how a breakpoint must be removed when it is a temporary one.N((R t bp_number((s..\grt_python_debugger.pytdo_clearŁs($RRR R"R&R7R<R8R^R`RaRbRRcReRfRhRkRmRFR}R€R‹R$RiRjRGR)R0RqRrRR—R™RšRœ(((s..\grt_python_debugger.pyRAsB       !       $               ((R‚RSRRŒRPttempfileR•R’R”R:RIR‘R–RRR(((s..\grt_python_debugger.pyts