;
Ñâ"Ic               @   s  d  Z  d d l Z d d l m Z d d l m Z d Z d a d Z i  Z i  Z	 i  Z
 i  Z d „  Z d „  Z Gd	 „  d
 ƒ Z Gd „  d ƒ Z d „  Z Gd „  d ƒ Z Gd „  d ƒ Z Gd „  d ƒ Z Gd „  d ƒ Z Gd „  d ƒ Z d „  Z d „  Z d „  Z d „  Z d S(   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.

i    N(   u   rpc(   u   Debuggeru   idb_adapteru   gui_adapterc             C   s   t  |  ƒ } |  t | <| S(   N(   u   idu
   frametable(   u   frameu   fid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   wrap_frame)   s    
c             C   sQ   |  d k o d S|  d } t | ƒ } | t | <|  d |  d | f } | Sd S(   u0   replace info[2], a traceback instance, by its IDi   i    i   N(   u   Noneu   idu   tracebacktable(   u   infou	   tracebacku   traceback_idu   modified_info(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   wrap_info.   s    

c             B   s#   |  Ee  Z d  „  Z d d „ Z d S(   c             C   s   | |  _  | |  _ d  S(   N(   u   connu   oid(   u   selfu   connu   gui_adap_oid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__<   s    	c             C   s5   |  j  j |  j d | t | ƒ t | ƒ f i  ƒ d  S(   Nu   interaction(   u   connu
   remotecallu   oidu
   wrap_frameu	   wrap_info(   u   selfu   messageu   frameu   info(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   interaction@   s    N(   u   __name__u
   __module__u   __init__u   Noneu   interaction(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   GUIProxy:   s   
	u   GUIProxyc             B   sÂ   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   c             C   s   | |  _  d  S(   N(   u   idb(   u   selfu   idb(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__I   s    c             C   s   |  j  j ƒ  d  S(   N(   u   idbu   set_step(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_stepN   s    c             C   s   |  j  j ƒ  d  S(   N(   u   idbu   set_quit(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_quitQ   s    c             C   s   |  j  j ƒ  d  S(   N(   u   idbu   set_continue(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_continueT   s    c             C   s   t  | } |  j j | ƒ d  S(   N(   u
   frametableu   idbu   set_next(   u   selfu   fidu   frame(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_nextW   s    
c             C   s   t  | } |  j j | ƒ d  S(   N(   u
   frametableu   idbu
   set_return(   u   selfu   fidu   frame(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   set_return[   s    
c             C   s`   t  | } | d  k o
 d  } n t | } |  j j | | ƒ \ } } d „  | Dƒ } | | f S(   Nc             S   s-   g  } |  ] \ } } | t  | ƒ | f q
 S(    (   u
   wrap_frame(   u   .0u   _[1]u   frameu   k(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   <listcomp>f   s    (   u
   frametableu   Noneu   tracebacktableu   idbu	   get_stack(   u   selfu   fidu   tbidu   frameu   tbu   stacku   i(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   get_stack_   s    


c             C   s&   d d  l  } |  j j | | j ƒ d  S(   Ni    (   u   __main__u   idbu   runu   __dict__(   u   selfu   cmdu   __main__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   runi   s    c             C   s   |  j  j | | ƒ } | S(   N(   u   idbu	   set_break(   u   selfu   filenameu   linenou   msg(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   set_breakm   s    c             C   s   |  j  j | | ƒ } | S(   N(   u   idbu   clear_break(   u   selfu   filenameu   linenou   msg(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   clear_breakq   s    c             C   s   |  j  j | ƒ } | S(   N(   u   idbu   clear_all_file_breaks(   u   selfu   filenameu   msg(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   clear_all_file_breaksu   s    c             C   s   t  | } t | | ƒ S(   N(   u
   frametableu   getattr(   u   selfu   fidu   nameu   frame(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   frame_attr{   s    
c             C   s-   t  | } | j } t | ƒ } | t | <| S(   N(   u
   frametableu	   f_globalsu   idu	   dicttable(   u   selfu   fidu   frameu   dictu   did(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   frame_globals   s
    
	
c             C   s-   t  | } | j } t | ƒ } | t | <| S(   N(   u
   frametableu   f_localsu   idu	   dicttable(   u   selfu   fidu   frameu   dictu   did(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   frame_locals†   s
    
	
c             C   s-   t  | } | j } t | ƒ } | t | <| S(   N(   u
   frametableu   f_codeu   idu	   codetable(   u   selfu   fidu   frameu   codeu   cid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   frame_code   s
    
	
c             C   s   t  | } | j S(   N(   u	   codetableu   co_name(   u   selfu   cidu   code(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   code_name–   s    
c             C   s   t  | } | j S(   N(   u	   codetableu   co_filename(   u   selfu   cidu   code(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   code_filenameš   s    
c             C   s   t  d ƒ ‚ d  S(   Nu"   dict_keys not public or pickleable(   u   NotImplemented(   u   selfu   did(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   dict_keys    s    c             C   s   t  | } t | j ƒ  ƒ S(   N(   u	   dicttableu   listu   keys(   u   selfu   didu   dict(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   dict_keys_list§   s    
c             C   s$   t  | } | | } t | ƒ } | S(   N(   u	   dicttableu   repr(   u   selfu   didu   keyu   dictu   value(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   dict_item«   s    

N(   u   __name__u
   __module__u   __init__u   set_stepu   set_quitu   set_continueu   set_nextu
   set_returnu	   get_stacku   runu	   set_breaku   clear_breaku   clear_all_file_breaksu
   frame_attru   frame_globalsu   frame_localsu
   frame_codeu	   code_nameu   code_filenameu	   dict_keysu   dict_keys_listu	   dict_item(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   IdbAdapterG   s(   
							
													u
   IdbAdapterc             C   s>   t  |  | ƒ } t j | ƒ } t | ƒ } |  j t | ƒ t S(   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.

    (   u   GUIProxyu   Debuggeru   Idbu
   IdbAdapteru   registeru   idb_adap_oid(   u
   rpchandleru   gui_adap_oidu	   gui_proxyu   idbu   idb_adap(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   start_debugger´   s
    
c             B   sD   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d S(   c             C   s(   | |  _  | |  _ d |  _ i  |  _ d  S(   Nu   idb_adapter(   u   _connu   _fidu   _oidu
   _dictcache(   u   selfu   connu   fid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__Ì   s    			c             C   s”   | d  d … d k o t  | ƒ ‚ n | d k o |  j ƒ  S| d k o |  j ƒ  S| d k o |  j ƒ  S|  j j |  j d |  j | f i  ƒ S(   Ni   u   _u   f_codeu	   f_globalsu   f_localsu
   frame_attr(   u   AttributeErroru   _get_f_codeu   _get_f_globalsu   _get_f_localsu   _connu
   remotecallu   _oidu   _fid(   u   selfu   name(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __getattr__Ò   s    c             C   s:   |  j  j |  j d |  j f i  ƒ } t |  j  |  j | ƒ S(   Nu
   frame_code(   u   _connu
   remotecallu   _oidu   _fidu	   CodeProxy(   u   selfu   cid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   _get_f_codeÞ   s    $c             C   s1   |  j  j |  j d |  j f i  ƒ } |  j | ƒ S(   Nu   frame_globals(   u   _connu
   remotecallu   _oidu   _fidu   _get_dict_proxy(   u   selfu   did(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   _get_f_globalsâ   s    c             C   s1   |  j  j |  j d |  j f i  ƒ } |  j | ƒ S(   Nu   frame_locals(   u   _connu
   remotecallu   _oidu   _fidu   _get_dict_proxy(   u   selfu   did(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   _get_f_localsç   s    c             C   sE   | |  j  k o |  j  | St |  j |  j | ƒ } | |  j  | <| S(   N(   u
   _dictcacheu	   DictProxyu   _connu   _oid(   u   selfu   didu   dp(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   _get_dict_proxyì   s
    N(   u   __name__u
   __module__u   __init__u   __getattr__u   _get_f_codeu   _get_f_globalsu   _get_f_localsu   _get_dict_proxy(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   FrameProxyÊ   s   
					u
   FrameProxyc             B   s    |  Ee  Z d  „  Z d „  Z d S(   c             C   s   | |  _  | |  _ | |  _ d  S(   N(   u   _connu   _oidu   _cid(   u   selfu   connu   oidu   cid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__ö   s    		c             C   sd   | d k o# |  j  j |  j d |  j f i  ƒ S| d k o# |  j  j |  j d |  j f i  ƒ Sd  S(   Nu   co_nameu	   code_nameu   co_filenameu   code_filename(   u   _connu
   remotecallu   _oidu   _cid(   u   selfu   name(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __getattr__û   s    N(   u   __name__u
   __module__u   __init__u   __getattr__(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   CodeProxyô   s   
	u	   CodeProxyc             B   s2   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d S(   c             C   s   | |  _  | |  _ | |  _ d  S(   N(   u   _connu   _oidu   _did(   u   selfu   connu   oidu   did(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__  s    		c             C   s"   |  j  j |  j d |  j f i  ƒ S(   Nu   dict_keys_list(   u   _connu
   remotecallu   _oidu   _did(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   keys  s    c             C   s%   |  j  j |  j d |  j | f i  ƒ S(   Nu	   dict_item(   u   _connu
   remotecallu   _oidu   _did(   u   selfu   key(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __getitem__  s    c             C   s   t  | ƒ ‚ d  S(   N(   u   AttributeError(   u   selfu   name(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __getattr__  s    N(   u   __name__u
   __module__u   __init__u   keysu   __getitem__u   __getattr__(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   DictProxy  s   
				u	   DictProxyc             B   s    |  Ee  Z d  „  Z d „  Z d S(   c             C   s   | |  _  | |  _ d  S(   N(   u   connu   gui(   u   selfu   connu   gui(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__  s    	c             C   s,   t  |  j | ƒ } |  j j | | | ƒ d  S(   N(   u
   FrameProxyu   connu   guiu   interaction(   u   selfu   messageu   fidu   modified_infou   frame(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   interaction"  s    N(   u   __name__u
   __module__u   __init__u   interaction(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   GUIAdapter  s   
	u
   GUIAdapterc             B   sz   |  Ee  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d S(   c             C   s   | |  _  | |  _ | |  _ d  S(   N(   u   oidu   connu   shell(   u   selfu   connu   shellu   oid(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   __init__*  s    		c             O   s"   |  j  j |  j | | | ƒ } | S(   N(   u   connu
   remotecallu   oid(   u   selfu
   methodnameu   argsu   kwargsu   value(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   call/  s    c             C   s4   |  j  j |  j d | f i  ƒ } | |  j j _ d  S(   Nu   run(   u   connu
   asyncqueueu   oidu   shellu   interpu
   active_seq(   u   selfu   cmdu   localsu   seq(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   run5  s    !c                s>   ˆ  j  d | j | ƒ \ } } ‡  f d †  | Dƒ } | | f S(   Nu	   get_stackc                s3   g  } |  ]% \ } } | t  ˆ  j | ƒ | f q
 S(    (   u
   FrameProxyu   conn(   u   .0u   _[1]u   fidu   k(   u   self(    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   <listcomp>=  s    (   u   callu   _fid(   u   selfu   frameu   tbidu   stacku   i(    (   u   selfu3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   get_stack:  s    c             C   s   |  j  d ƒ d  S(   Nu   set_continue(   u   call(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_continue@  s    c             C   s   |  j  d ƒ d  S(   Nu   set_step(   u   call(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_stepC  s    c             C   s   |  j  d | j ƒ d  S(   Nu   set_next(   u   callu   _fid(   u   selfu   frame(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_nextF  s    c             C   s   |  j  d | j ƒ d  S(   Nu
   set_return(   u   callu   _fid(   u   selfu   frame(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu
   set_returnI  s    c             C   s   |  j  d ƒ d  S(   Nu   set_quit(   u   call(   u   self(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   set_quitL  s    c             C   s   |  j  d | | ƒ } | S(   Nu	   set_break(   u   call(   u   selfu   filenameu   linenou   msg(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu	   set_breakO  s    c             C   s   |  j  d | | ƒ } | S(   Nu   clear_break(   u   call(   u   selfu   filenameu   linenou   msg(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   clear_breakS  s    c             C   s   |  j  d | ƒ } | S(   Nu   clear_all_file_breaks(   u   call(   u   selfu   filenameu   msg(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   clear_all_file_breaksW  s    N(   u   __name__u
   __module__u   __init__u   callu   runu	   get_stacku   set_continueu   set_stepu   set_nextu
   set_returnu   set_quitu	   set_breaku   clear_breaku   clear_all_file_breaks(   u
   __locals__(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   IdbProxy(  s   
											u   IdbProxyc             C   sb   |  j  d d t f i  ƒ a t |  | t ƒ } t j | | ƒ } t |  | ƒ } |  j t | ƒ | 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.

    u   execu   start_the_debugger(   u
   remotecallu   gui_adap_oidu   idb_adap_oidu   IdbProxyu   Debuggeru
   GUIAdapteru   register(   u   rpccltu   pyshellu	   idb_proxyu   guiu   gui_adap(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   start_remote_debugger[  s    c             C   s   t  |  ƒ |  j t ƒ d S(   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(   u   close_subprocess_debuggeru
   unregisteru   gui_adap_oid(   u   rpcclt(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   close_remote_debuggers  s    	
c             C   s   |  j  d d t f i  ƒ d  S(   Nu   execu   stop_the_debugger(   u
   remotecallu   idb_adap_oid(   u   rpcclt(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   close_subprocess_debugger  s    c             C   s   |  j  d d t f i  ƒ } d  S(   Nu   execu   start_the_debugger(   u
   remotecallu   gui_adap_oid(   u   rpccltu   idb_adap_oid_ret(    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   restart_subprocess_debugger‚  s    (   u   __doc__u   typesu   idlelibu   rpcu   Debuggeru	   debuggingu   idb_adap_oidu   gui_adap_oidu
   frametableu	   dicttableu	   codetableu   tracebacktableu
   wrap_frameu	   wrap_infou   GUIProxyu
   IdbAdapteru   start_debuggeru
   FrameProxyu	   CodeProxyu	   DictProxyu
   GUIAdapteru   IdbProxyu   start_remote_debuggeru   close_remote_debuggeru   close_subprocess_debuggeru   restart_subprocess_debugger(    (    (    u3   /mit/python/lib/python3.0/idlelib/RemoteDebugger.pyu   <module>   s0   		m	*3			