ž ©ÿfý.c@s9dZddlZddlmZddlmZdZdadZiZiZ iZ iZ dd„Z d d „Z Gd d „d ƒZGd d„dƒZdd„ZGdd„dƒZGdd„dƒZGdd„dƒZGdd„dƒZGdd„dƒZdd„Zdd„Zdd „Zd!d"„ZdS(#uÎ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. iN(urpc(uDebuggeru idb_adapteru gui_adaptercCst|ƒ}|t|<|S(N(uidu frametable(uframeufid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu wrap_frame)s  u wrap_framecCsO|dkrdS|d}t|ƒ}|t|<|d|d|f}|SdS(u0replace info[2], a traceback instance, by its IDiiiN(uNoneuidutracebacktable(uinfou tracebacku traceback_idu modified_info((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu wrap_info.s    u wrap_infocBs/|EeZdZdd„Zddd„ZdS(uGUIProxycCs||_||_dS(N(uconnuoid(uselfuconnu gui_adap_oid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__<s uGUIProxy.__init__cCs5|jj|jd|t|ƒt|ƒfiƒdS(Nu interaction(uconnu remotecalluoidu wrap_frameu wrap_info(uselfumessageuframeuinfo((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu interaction@suGUIProxy.interactionN(u__name__u __module__u __qualname__u__init__uNoneu interaction(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuGUIProxy:s uGUIProxycBs|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)S(*u IdbAdaptercCs ||_dS(N(uidb(uselfuidb((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__IsuIdbAdapter.__init__cCs|jjƒdS(N(uidbuset_step(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuset_stepNsuIdbAdapter.set_stepcCs|jjƒdS(N(uidbuset_quit(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuset_quitQsuIdbAdapter.set_quitcCs|jjƒdS(N(uidbu set_continue(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu set_continueTsuIdbAdapter.set_continuecCst|}|jj|ƒdS(N(u frametableuidbuset_next(uselfufiduframe((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuset_nextWs uIdbAdapter.set_nextcCst|}|jj|ƒdS(N(u frametableuidbu set_return(uselfufiduframe((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu set_return[s uIdbAdapter.set_returncCsat|}|dkrd}n t|}|jj||ƒ\}}dd„|Dƒ}||fS(NcSs(g|]\}}t|ƒ|f‘qS((u wrap_frame(u.0uframeuk((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu fs u(IdbAdapter.get_stack..(u frametableuNoneutracebacktableuidbu get_stack(uselfufidutbiduframeutbustackui((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu get_stack_s    uIdbAdapter.get_stackcCs&ddl}|jj||jƒdS(Ni(u__main__uidburunu__dict__(uselfucmdu__main__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyurunis uIdbAdapter.runcCs|jj||ƒ}|S(N(uidbu set_break(uselfufilenameulinenoumsg((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu set_breakmsuIdbAdapter.set_breakcCs|jj||ƒ}|S(N(uidbu clear_break(uselfufilenameulinenoumsg((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu clear_breakqsuIdbAdapter.clear_breakcCs|jj|ƒ}|S(N(uidbuclear_all_file_breaks(uselfufilenameumsg((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuclear_all_file_breaksusu IdbAdapter.clear_all_file_breakscCst|}t||ƒS(N(u frametableugetattr(uselfufidunameuframe((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu frame_attr{s uIdbAdapter.frame_attrcCs-t|}|j}t|ƒ}|t|<|S(N(u frametableu f_globalsuidu dicttable(uselfufiduframeudictudid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu frame_globalss     uIdbAdapter.frame_globalscCs-t|}|j}t|ƒ}|t|<|S(N(u frametableuf_localsuidu dicttable(uselfufiduframeudictudid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu frame_locals†s     uIdbAdapter.frame_localscCs-t|}|j}t|ƒ}|t|<|S(N(u frametableuf_codeuidu codetable(uselfufiduframeucodeucid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu frame_codes     uIdbAdapter.frame_codecCst|}|jS(N(u codetableuco_name(uselfuciducode((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu code_name–s uIdbAdapter.code_namecCst|}|jS(N(u codetableu co_filename(uselfuciducode((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu code_filenamešs uIdbAdapter.code_filenamecCstdƒ‚dS(Nu"dict_keys not public or pickleable(uNotImplemented(uselfudid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu dict_keys suIdbAdapter.dict_keyscCst|}t|jƒƒS(N(u dicttableulistukeys(uselfudidudict((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyudict_keys_list§s uIdbAdapter.dict_keys_listcCs$t|}||}t|ƒ}|S(N(u dicttableurepr(uselfudidukeyudictuvalue((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu dict_item«s   uIdbAdapter.dict_itemN(u__name__u __module__u __qualname__u__init__uset_stepuset_quitu set_continueuset_nextu set_returnu get_stackurunu set_breaku clear_breakuclear_all_file_breaksu frame_attru frame_globalsu frame_localsu frame_codeu code_nameu code_filenameu dict_keysudict_keys_listu dict_item(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu IdbAdapterGs(                 u IdbAdaptercCs>t||ƒ}tj|ƒ}t|ƒ}|jt|ƒtS(u|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. (uGUIProxyuDebuggeruIdbu IdbAdapteruregisteru idb_adap_oid(u rpchandleru gui_adap_oidu gui_proxyuidbuidb_adap((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyustart_debugger´s  ustart_debuggercBs\|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S(u FrameProxycCs(||_||_d|_i|_dS(Nu idb_adapter(u_connu_fidu_oidu _dictcache(uselfuconnufid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__Ìs   uFrameProxy.__init__cCsŒ|dd…dkr%t|ƒ‚n|dkr;|jƒS|dkrQ|jƒS|dkrg|jƒS|jj|jd|j|fiƒS(Niu_uf_codeu f_globalsuf_localsu frame_attr(uAttributeErroru _get_f_codeu_get_f_globalsu _get_f_localsu_connu remotecallu_oidu_fid(uselfuname((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu __getattr__Òs      uFrameProxy.__getattr__cCs:|jj|jd|jfiƒ}t|j|j|ƒS(Nu frame_code(u_connu remotecallu_oidu_fidu CodeProxy(uselfucid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu _get_f_codeÞs$uFrameProxy._get_f_codecCs1|jj|jd|jfiƒ}|j|ƒS(Nu frame_globals(u_connu remotecallu_oidu_fidu_get_dict_proxy(uselfudid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu_get_f_globalsâsuFrameProxy._get_f_globalscCs1|jj|jd|jfiƒ}|j|ƒS(Nu frame_locals(u_connu remotecallu_oidu_fidu_get_dict_proxy(uselfudid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu _get_f_localsçsuFrameProxy._get_f_localscCsC||jkr|j|St|j|j|ƒ}||j|<|S(N(u _dictcacheu DictProxyu_connu_oid(uselfudidudp((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu_get_dict_proxyìs   uFrameProxy._get_dict_proxyN( u__name__u __module__u __qualname__u__init__u __getattr__u _get_f_codeu_get_f_globalsu _get_f_localsu_get_dict_proxy(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu FrameProxyÊs     u FrameProxycBs,|EeZdZdd„Zdd„ZdS(u CodeProxycCs||_||_||_dS(N(u_connu_oidu_cid(uselfuconnuoiducid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__ös  uCodeProxy.__init__cCs`|dkr.|jj|jd|jfiƒS|dkr\|jj|jd|jfiƒSdS(Nuco_nameu code_nameu co_filenameu code_filename(u_connu remotecallu_oidu_cid(uselfuname((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu __getattr__ûs   uCodeProxy.__getattr__N(u__name__u __module__u __qualname__u__init__u __getattr__(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu CodeProxyôs u CodeProxycBsD|EeZdZdd„Zdd„Zdd„Zdd„Zd S( u DictProxycCs||_||_||_dS(N(u_connu_oidu_did(uselfuconnuoidudid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__s  uDictProxy.__init__cCs"|jj|jd|jfiƒS(Nudict_keys_list(u_connu remotecallu_oidu_did(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyukeyssuDictProxy.keyscCs%|jj|jd|j|fiƒS(Nu dict_item(u_connu remotecallu_oidu_did(uselfukey((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu __getitem__suDictProxy.__getitem__cCst|ƒ‚dS(N(uAttributeError(uselfuname((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu __getattr__suDictProxy.__getattr__N(u__name__u __module__u __qualname__u__init__ukeysu __getitem__u __getattr__(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu DictProxys  u DictProxycBs,|EeZdZdd„Zdd„ZdS(u GUIAdaptercCs||_||_dS(N(uconnugui(uselfuconnugui((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__s uGUIAdapter.__init__cCs,t|j|ƒ}|jj|||ƒdS(N(u FrameProxyuconnuguiu interaction(uselfumessageufidu modified_infouframe((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu interaction"suGUIAdapter.interactionN(u__name__u __module__u __qualname__u__init__u interaction(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu GUIAdapters u GUIAdaptercBs¤|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„ZdS(uIdbProxycCs||_||_||_dS(N(uoiduconnushell(uselfuconnushelluoid((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu__init__*s  uIdbProxy.__init__cOs"|jj|j|||ƒ}|S(N(uconnu remotecalluoid(uselfu methodnameuargsukwargsuvalue((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyucall/su IdbProxy.callcCs4|jj|jd|fiƒ}||jj_dS(Nurun(uconnu asyncqueueuoidushelluinterpu active_seq(uselfucmdulocalsuseq((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyurun5s!u IdbProxy.runcsAˆjd|j|ƒ\}}‡fdd†|Dƒ}||fS(Nu get_stackcs.g|]$\}}tˆj|ƒ|f‘qS((u FrameProxyuconn(u.0ufiduk(uself(u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu =s u&IdbProxy.get_stack..(ucallu_fid(uselfuframeutbidustackui((uselfu;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu get_stack:suIdbProxy.get_stackcCs|jdƒdS(Nu set_continue(ucall(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu set_continue@suIdbProxy.set_continuecCs|jdƒdS(Nuset_step(ucall(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuset_stepCsuIdbProxy.set_stepcCs|jd|jƒdS(Nuset_next(ucallu_fid(uselfuframe((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuset_nextFsuIdbProxy.set_nextcCs|jd|jƒdS(Nu set_return(ucallu_fid(uselfuframe((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu set_returnIsuIdbProxy.set_returncCs|jdƒdS(Nuset_quit(ucall(uself((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuset_quitLsuIdbProxy.set_quitcCs|jd||ƒ}|S(Nu set_break(ucall(uselfufilenameulinenoumsg((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu set_breakOsuIdbProxy.set_breakcCs|jd||ƒ}|S(Nu clear_break(ucall(uselfufilenameulinenoumsg((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyu clear_breakSsuIdbProxy.clear_breakcCs|jd|ƒ}|S(Nuclear_all_file_breaks(ucall(uselfufilenameumsg((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuclear_all_file_breaksWsuIdbProxy.clear_all_file_breaksN(u__name__u __module__u __qualname__u__init__ucallurunu get_stacku set_continueuset_stepuset_nextu set_returnuset_quitu set_breaku clear_breakuclear_all_file_breaks(u __locals__((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuIdbProxy(s           uIdbProxycCsb|jddtfiƒat||tƒ}tj||ƒ}t||ƒ}|jt|ƒ|S(u]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. uexecustart_the_debugger(u remotecallu gui_adap_oidu idb_adap_oiduIdbProxyuDebuggeru GUIAdapteruregister(urpccltupyshellu idb_proxyuguiugui_adap((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyustart_remote_debugger[s ustart_remote_debuggercCst|ƒ|jtƒdS(u]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(uclose_subprocess_debuggeru unregisteru gui_adap_oid(urpcclt((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuclose_remote_debuggerss uclose_remote_debuggercCs|jddtfiƒdS(Nuexecustop_the_debugger(u remotecallu idb_adap_oid(urpcclt((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyuclose_subprocess_debuggersuclose_subprocess_debuggercCs|jddtfiƒ}dS(Nuexecustart_the_debugger(u remotecallu gui_adap_oid(urpccltuidb_adap_oid_ret((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyurestart_subprocess_debugger‚s urestart_subprocess_debugger(u__doc__utypesuidleliburpcuDebuggeru debuggingu idb_adap_oidu gui_adap_oidu frametableu dicttableu codetableutracebacktableu wrap_frameu wrap_infouGUIProxyu IdbAdapterustart_debuggeru FrameProxyu CodeProxyu DictProxyu GUIAdapteruIdbProxyustart_remote_debuggeruclose_remote_debuggeruclose_subprocess_debuggerurestart_subprocess_debugger(((u;/opt/alt/python33/lib64/python3.3/idlelib/RemoteDebugger.pyus0    m * 3