mς &U²Ic@sdZdkZdkZdkZdkZdZdadZhZhZ hZ hZ d„Z d„Z dfd„ƒYZd fd „ƒYZd „Zd fd „ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZd„Zd„Zd„Zd„ZdS(sΞSupport for remote Python debugging. Some ASCII art to describe the structure: IN PYTHON SUBPROCESS # IN IDLE PROCESS # # oid='gui_adapter' +----------+ # +------------+ +-----+ | GUIProxy |--remote#call-->| GUIAdapter |--calls-->| GUI | +-----+--calls-->+----------+ # +------------+ +-----+ | Idb | # / +-----+<-calls--+------------+ # +----------+<--calls-/ | IdbAdapter |<--remote#call--| IdbProxy | +------------+ # +----------+ oid='idb_adapter' # The purpose of the Proxy and Adapter classes is to translate certain arguments and return values that cannot be transported through the RPC barrier, in particular frame and traceback objects. Nit idb_adaptert gui_adaptercCst|ƒ}|t|<|S(N(tidtframetfidt frametable(RR((t3/data/zmath/lib/python2.4/idlelib/RemoteDebugger.pyt wrap_frame*s  cCsn|djodSnV|d}t|tiƒpt‚t|ƒ}|t |<|d|d|f}|SdS(s0replace info[2], a traceback instance, by its IDiiiN( tinfotNonet tracebackt isinstancettypest TracebackTypetAssertionErrorRt traceback_idttracebacktablet modified_info(RR RR((Rt wrap_info/s    tGUIProxycBstZd„Zdd„ZRS(NcCs||_||_dS(N(tconntselft gui_adap_oidtoid(RRR((Rt__init__=s cCs5|ii|id|t|ƒt|ƒfhƒdS(Nt interaction( RRt remotecallRtmessageRRRR(RRRR((RRAs(t__name__t __module__RR R(((RR;s t IdbAdaptercBs³tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Zd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCs ||_dS(N(tidbR(RR((RRJscCs|iiƒdS(N(RRtset_step(R((RR OscCs|iiƒdS(N(RRtset_quit(R((RR!RscCs|iiƒdS(N(RRt set_continue(R((RR"UscCst|}|ii|ƒdS(N(RRRRRtset_next(RRR((RR#Xs cCst|}|ii|ƒdS(N(RRRRRt set_return(RRR((RR$\s c Csƒt|}|djo d}n t|}|ii ||ƒ\}}g}|D]\}}|t|ƒ|fqQ~}||fS(N(RRRttbidR ttbRRRt get_stacktstacktit_[1]tkR( RRR%R)R(R*R&RR+((RR'`s    3cCs#dk}|ii||iƒdS(N(t__main__RRtruntcmdt__dict__(RR.R,((RR-ms cCs|ii||ƒ}|S(N(RRt set_breaktfilenametlinenotmsg(RR1R2R3((RR0qscCs|ii||ƒ}|S(N(RRt clear_breakR1R2R3(RR1R2R3((RR4uscCs|ii|ƒ}|S(N(RRtclear_all_file_breaksR1R3(RR1R3((RR5yscCst|}t||ƒS(N(RRRtgetattrtname(RRR7R((Rt frame_attrs cCs-t|}|i}t|ƒ}|t|<|S(N(RRRt f_globalstdictRtdidt dicttable(RRR;R:R((Rt frame_globalsƒs     cCs-t|}|i}t|ƒ}|t|<|S(N(RRRtf_localsR:RR;R<(RRR;R:R((Rt frame_localsŠs     cCs-t|}|i}t|ƒ}|t|<|S(N(RRRtf_codetcodeRtcidt codetable(RRRARBR((Rt frame_code‘s     cCst|}|iS(N(RCRBRAtco_name(RRBRA((Rt code_namešs cCst|}|iS(N(RCRBRAt co_filename(RRBRA((Rt code_filenamežs cCst|}|iƒS(N(R<R;R:tkeys(RR;R:((Rt dict_keys€s cCs$t|}||}t|ƒ}|S(N(R<R;R:tkeytvaluetrepr(RR;RKRLR:((Rt dict_item¨s   (RRRR R!R"R#R$R'R-R0R4R5R8R=R?RDRFRHRJRN(((RRHs&                cCs>t||ƒ}ti|ƒ}t|ƒ}|i t |ƒt S(s|Start the debugger and its RPC link in the Python subprocess Start the subprocess side of the split debugger and set up that side of the RPC link by instantiating the GUIProxy, Idb debugger, and IdbAdapter objects and linking them together. Register the IdbAdapter with the RPCServer to handle RPC requests from the split debugger GUI via the IdbProxy. N( Rt rpchandlerRt gui_proxytDebuggertIdbRRtidb_adaptregistert idb_adap_oid(RORRSRRP((Rtstart_debugger±s  t FrameProxycBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCs(||_||_d|_h|_dS(NR(RRt_connRt_fidt_oidt _dictcache(RRR((RRΙs   cCs”|d djo t|‚n|djo|iƒSn|djo|iƒSn|djo|iƒSn|ii|id|i |fhƒS(Nit_R@R9R>R8( R7tAttributeErrorRt _get_f_codet_get_f_globalst _get_f_localsRXRRZRY(RR7((Rt __getattr__Οs    cCs:|ii|id|ifhƒ}t|i|i|ƒS(NRD(RRXRRZRYRBt CodeProxy(RRB((RR^Ϋs$cCs1|ii|id|ifhƒ}|i|ƒS(NR=(RRXRRZRYR;t_get_dict_proxy(RR;((RR_ίscCs1|ii|id|ifhƒ}|i|ƒS(NR?(RRXRRZRYR;Rc(RR;((RR`δscCsK|ii|ƒo|i|Snt|i|i|ƒ}||i|<|S(N(RR[thas_keyR;t DictProxyRXRZtdp(RR;Rf((RRcιs  (RRRRaR^R_R`Rc(((RRWΗs     RbcBstZd„Zd„ZRS(NcCs||_||_||_dS(N(RRRXRRZRBt_cid(RRRRB((RRσs  cCsj|djo&|ii|id|ifhƒSn|djo&|ii|id|ifhƒSndS(NRERFRGRH(R7RRXRRZRg(RR7((RRaψs   (RRRRa(((RRbρs RecBs,tZd„Zd„Zd„Zd„ZRS(NcCs||_||_||_dS(N(RRRXRRZR;t_did(RRRR;((RRs  cCs"|ii|id|ifhƒS(NRJ(RRXRRZRh(R((RRIscCs%|ii|id|i|fhƒS(NRN(RRXRRZRhRK(RRK((Rt __getitem__ scCs t|‚dS(N(R]R7(RR7((RRas(RRRRIRiRa(((RRes   t GUIAdaptercBstZd„Zd„ZRS(NcCs||_||_dS(N(RRtgui(RRRk((RRs cCs,t|i|ƒ}|ii|||ƒdS(N( RWRRRRRkRRR(RRRRR((RRs(RRRR(((RRjs tIdbProxycBsttZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS( NcCs||_||_||_dS(N(RRRtshell(RRRmR((RR"s  cOs"|ii|i|||ƒ}|S(N(RRRRt methodnametargstkwargsRL(RRnRoRpRL((Rtcall'scCs4|ii|id|fhƒ}||ii_dS(NR-( RRt asyncqueueRR.tseqRmtinterpt active_seq(RR.tlocalsRs((RR--s!cCsa|id|i|ƒ\}}g}|D]%\}}|t |i |ƒ|fq)~}||fS(NR'( RRqRRYR%R(R)R*RR+RWR(RRR%R)R(R*RR+((RR'2s9cCs|idƒdS(NR"(RRq(R((RR"8scCs|idƒdS(NR (RRq(R((RR ;scCs|id|iƒdS(NR#(RRqRRY(RR((RR#>scCs|id|iƒdS(NR$(RRqRRY(RR((RR$AscCs|idƒdS(NR!(RRq(R((RR!DscCs|id||ƒ}|S(NR0(RRqR1R2R3(RR1R2R3((RR0GscCs|id||ƒ}|S(NR4(RRqR1R2R3(RR1R2R3((RR4KscCs|id|ƒ}|S(NR5(RRqR1R3(RR1R3((RR5Os(RRRRqR-R'R"R R#R$R!R0R4R5(((RRl s           cCsb|iddtfhƒat||tƒ}ti||ƒ}t ||ƒ}|i t|ƒ|S(s]Start the subprocess debugger, initialize the debugger GUI and RPC link Request the RPCServer start the Python subprocess debugger and link. Set up the Idle side of the split debugger by instantiating the IdbProxy, debugger GUI, and debugger GUIAdapter objects and linking them together. Register the GUIAdapter with the RPCClient to handle debugger GUI interaction requests coming from the subprocess debugger via the GUIProxy. The IdbAdapter will pass execution and environment requests coming from the Idle debugger GUI to the subprocess debugger via the IdbProxy. texectstart_the_debuggerN( trpccltRRRURltpyshellt idb_proxyRQRkRjtgui_adapRT(RyRzR|RkR{((Rtstart_remote_debuggerSs  cCst|ƒ|itƒdS(s]Shut down subprocess debugger and Idle side of debugger RPC link Request that the RPCServer shut down the subprocess debugger and link. Unregister the GUIAdapter, which will cause a GC on the Idle process debugger and RPC link objects. (The second reference to the debugger GUI is deleted in PyShell.close_remote_debugger().) N(tclose_subprocess_debuggerRyt unregisterR(Ry((Rtclose_remote_debuggerks cCs|iddtfhƒdS(NRwtstop_the_debugger(RyRRU(Ry((RR~wscCs6|iddtfhƒ}|tjp td‚dS(NRwRxs Idb restarted with different oid(RyRRtidb_adap_oid_retRUR(RyR‚((Rtrestart_subprocess_debuggerzs (t__doc__tsysR trpcRQt debuggingRURRR<RCRRRRRRVRWRbReRjRlR}R€R~Rƒ(RbR‡R<RRjR†RRlRRVRR}R…RWR RRR€RQReRRCR~Rƒ((Rt?s2       i * 3