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  cCsT|djodSn<|d}t|ƒ}|t|<|d|d|f}|SdS(s0replace info[2], a traceback instance, by its IDiiiN(tinfotNonet tracebackRt traceback_idttracebacktablet modified_info(RR R R ((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((RROscCs|iiƒdS(N(RRtset_quit(R((RRRscCs|iiƒdS(N(RRt set_continue(R((RRUscCst|}|ii|ƒdS(N(RRRRRtset_next(RRR((RRXs 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 ttbR RRt 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(RR-R.R/((RR,qscCs|ii||ƒ}|S(N(RRt clear_breakR-R.R/(RR-R.R/((RR0uscCs|ii|ƒ}|S(N(RRtclear_all_file_breaksR-R/(RR-R/((RR1yscCst|}t||ƒS(N(RRRtgetattrtname(RRR3R((Rt frame_attrs cCs-t|}|i}t|ƒ}|t|<|S(N(RRRt f_globalstdictRtdidt dicttable(RRR7R6R((Rt frame_globalsƒs     cCs-t|}|i}t|ƒ}|t|<|S(N(RRRtf_localsR6RR7R8(RRR7R6R((Rt frame_localsŠs     cCs-t|}|i}t|ƒ}|t|<|S(N(RRRtf_codetcodeRtcidt codetable(RRR=R>R((Rt frame_code‘s     cCst|}|iS(N(R?R>R=tco_name(RR>R=((Rt code_namešs cCst|}|iS(N(R?R>R=t co_filename(RR>R=((Rt code_filenamežs cCst|}|iƒS(N(R8R7R6tkeys(RR7R6((Rt dict_keys€s cCs$t|}||}t|ƒ}|S(N(R8R7R6tkeytvaluetrepr(RR7RGRHR6((Rt dict_item¨s   (RRRRRRRR R#R)R,R0R1R4R9R;R@RBRDRFRJ(((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(RKRRORRL((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<R5R:R4( R3tAttributeErrorRt _get_f_codet_get_f_globalst _get_f_localsRTRRVRU(RR3((Rt __getattr__Οs    cCs:|ii|id|ifhƒ}t|i|i|ƒS(NR@(RRTRRVRUR>t CodeProxy(RR>((RRZΫs$cCs1|ii|id|ifhƒ}|i|ƒS(NR9(RRTRRVRUR7t_get_dict_proxy(RR7((RR[ίscCs1|ii|id|ifhƒ}|i|ƒS(NR;(RRTRRVRUR7R_(RR7((RR\δscCsK|ii|ƒo|i|Snt|i|i|ƒ}||i|<|S(N(RRWthas_keyR7t DictProxyRTRVtdp(RR7Rb((RR_ιs  (RRRR]RZR[R\R_(((RRSΗs     R^cBstZd„Zd„ZRS(NcCs||_||_||_dS(N(RRRTRRVR>t_cid(RRRR>((RRσs  cCsj|djo&|ii|id|ifhƒSn|djo&|ii|id|ifhƒSndS(NRARBRCRD(R3RRTRRVRc(RR3((RR]ψs   (RRRR](((RR^ρs RacBs,tZd„Zd„Zd„Zd„ZRS(NcCs||_||_||_dS(N(RRRTRRVR7t_did(RRRR7((RRs  cCs"|ii|id|ifhƒS(NRF(RRTRRVRd(R((RREscCs%|ii|id|i|fhƒS(NRJ(RRTRRVRdRG(RRG((Rt __getitem__ scCs t|‚dS(N(RYR3(RR3((RR]s(RRRREReR](((RRas   t GUIAdaptercBstZd„Zd„ZRS(NcCs||_||_dS(N(RRtgui(RRRg((RRs cCs,t|i|ƒ}|ii|||ƒdS(N( RSRRRRRgRRR (RRRR R((RRs(RRRR(((RRfs tIdbProxycBsttZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS( NcCs||_||_||_dS(N(RRRtshell(RRRiR((RR"s  cOs"|ii|i|||ƒ}|S(N(RRRRt methodnametargstkwargsRH(RRjRkRlRH((Rtcall'scCs4|ii|id|fhƒ}||ii_dS(NR)( RRt asyncqueueRR*tseqRitinterpt active_seq(RR*tlocalsRo((RR)-s!cCsa|id|i|ƒ\}}g}|D]%\}}|t |i |ƒ|fq)~}||fS(NR#( RRmRRUR!R$R%R&RR'RSR(RRR!R%R$R&RR'((RR#2s9cCs|idƒdS(NR(RRm(R((RR8scCs|idƒdS(NR(RRm(R((RR;scCs|id|iƒdS(NR(RRmRRU(RR((RR>scCs|id|iƒdS(NR (RRmRRU(RR((RR AscCs|idƒdS(NR(RRm(R((RRDscCs|id||ƒ}|S(NR,(RRmR-R.R/(RR-R.R/((RR,GscCs|id||ƒ}|S(NR0(RRmR-R.R/(RR-R.R/((RR0KscCs|id|ƒ}|S(NR1(RRmR-R/(RR-R/((RR1Os(RRRRmR)R#RRRR RR,R0R1(((RRh 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( trpccltRRRQRhtpyshellt idb_proxyRMRgRftgui_adapRP(RuRvRxRgRw((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_debuggerRut unregisterR(Ru((Rtclose_remote_debuggerks cCs|iddtfhƒdS(NRststop_the_debugger(RuRRQ(Ru((RRzwscCs|iddtfhƒ}dS(NRsRt(RuRRtidb_adap_oid_ret(RuR~((Rtrestart_subprocess_debuggerzs (t__doc__tsysttypestrpcRMt debuggingRQRRR8R?R RRRRRRRSR^RaRfRhRyR|RzR(R^R„R8RRfRƒRRhRRRRRyRRSR‚RR R|RMRaRR?RzR((Rt?s2       i * 3