Ñò
—à"Ic           @   s  d  Z  d d k Z d d k Z d d k Z d Z d a d Z h  Z h  Z h  Z	 h  Z
 d „  Z d „  Z d d d	 „  ƒ  YZ d
 d d „  ƒ  YZ d „  Z d d d „  ƒ  YZ d d d „  ƒ  YZ d d d „  ƒ  YZ d d  d „  ƒ  YZ d d! d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z d S("   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.

iÿÿÿÿNi    t   idb_adaptert   gui_adapterc         C   s   t  |  ƒ } |  t | <| S(   N(   t   idt
   frametable(   t   framet   fid(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt
   wrap_frame)   s    
c         C   sQ   |  d j o d S|  d } t | ƒ } | t | <|  d |  d | f } | Sd S(   s0   replace info[2], a traceback instance, by its IDi   i    i   N(   t   NoneR   t   tracebacktable(   t   infot	   tracebackt   traceback_idt   modified_info(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt	   wrap_info.   s    

t   GUIProxyc           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   connt   oid(   t   selfR   t   gui_adap_oid(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   __init__<   s    	c         C   s5   |  i  i |  i d | t | ƒ t | ƒ f h  ƒ d  S(   Nt   interaction(   R   t
   remotecallR   R   R   (   R   t   messageR   R	   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   @   s    N(   t   __name__t
   __module__R   R   R   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   :   s   	t
   IdbAdapterc           B   s³   e  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 RS(   c         C   s   | |  _  d  S(   N(   t   idb(   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   I   s    c         C   s   |  i  i ƒ  d  S(   N(   R   t   set_step(   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   N   s    c         C   s   |  i  i ƒ  d  S(   N(   R   t   set_quit(   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   Q   s    c         C   s   |  i  i ƒ  d  S(   N(   R   t   set_continue(   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   T   s    c         C   s   t  | } |  i i | ƒ d  S(   N(   R   R   t   set_next(   R   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   W   s    
c         C   s   t  | } |  i i | ƒ d  S(   N(   R   R   t
   set_return(   R   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   [   s    
c   	      C   sƒ   t  | } | d  j o
 d  } n t | } |  i i | | ƒ \ } } g  } | D] \ } } | t | ƒ | f qQ ~ } | | f S(   N(   R   R   R   R   t	   get_stackR   (	   R   R   t   tbidR   t   tbt   stackt   it   _[1]t   k(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR    _   s    


3c         C   s&   d d  k  } |  i i | | i ƒ d  S(   Niÿÿÿÿ(   t   __main__R   t   runt   __dict__(   R   t   cmdR'   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR(   l   s    c         C   s   |  i  i | | ƒ } | S(   N(   R   t	   set_break(   R   t   filenamet   linenot   msg(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR+   p   s    c         C   s   |  i  i | | ƒ } | S(   N(   R   t   clear_break(   R   R,   R-   R.   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR/   t   s    c         C   s   |  i  i | ƒ } | S(   N(   R   t   clear_all_file_breaks(   R   R,   R.   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR0   x   s    c         C   s   t  | } t | | ƒ S(   N(   R   t   getattr(   R   R   t   nameR   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt
   frame_attr~   s    
c         C   s-   t  | } | i } t | ƒ } | t | <| S(   N(   R   t	   f_globalsR   t	   dicttable(   R   R   R   t   dictt   did(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   frame_globals‚   s
    
	
c         C   s-   t  | } | i } t | ƒ } | t | <| S(   N(   R   t   f_localsR   R5   (   R   R   R   R6   R7   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   frame_locals‰   s
    
	
c         C   s-   t  | } | i } t | ƒ } | t | <| S(   N(   R   t   f_codeR   t	   codetable(   R   R   R   t   codet   cid(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt
   frame_code   s
    
	
c         C   s   t  | } | i S(   N(   R<   t   co_name(   R   R>   R=   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt	   code_name™   s    
c         C   s   t  | } | i S(   N(   R<   t   co_filename(   R   R>   R=   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   code_filename   s    
c         C   s   t  | } | i ƒ  S(   N(   R5   t   keys(   R   R7   R6   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt	   dict_keys£   s    
c         C   s$   t  | } | | } t | ƒ } | S(   N(   R5   t   repr(   R   R7   t   keyR6   t   value(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt	   dict_item§   s    

(   R   R   R   R   R   R   R   R   R    R(   R+   R/   R0   R3   R8   R:   R?   RA   RC   RE   RI   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   G   s&   																			c         C   s>   t  |  | ƒ } t i | ƒ } 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.

    (   R   t   Debuggert   IdbR   t   registert   idb_adap_oid(   t
   rpchandlerR   t	   gui_proxyR   t   idb_adap(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   start_debugger°   s
    
t
   FrameProxyc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s(   | |  _  | |  _ d |  _ h  |  _ d  S(   NR    (   t   _connt   _fidt   _oidt
   _dictcache(   R   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   È   s    			c         C   s‹   | d  d j o t  | ‚ n | d j o |  i ƒ  S| d j o |  i ƒ  S| d j o |  i ƒ  S|  i i |  i d |  i | f h  ƒ S(   Ni   t   _R;   R4   R9   R3   (   t   AttributeErrort   _get_f_codet   _get_f_globalst   _get_f_localsRS   R   RU   RT   (   R   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   __getattr__Î   s    c         C   s:   |  i  i |  i d |  i f h  ƒ } t |  i  |  i | ƒ S(   NR?   (   RS   R   RU   RT   t	   CodeProxy(   R   R>   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRY   Ú   s    $c         C   s1   |  i  i |  i d |  i f h  ƒ } |  i | ƒ S(   NR8   (   RS   R   RU   RT   t   _get_dict_proxy(   R   R7   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRZ   Þ   s    c         C   s1   |  i  i |  i d |  i f h  ƒ } |  i | ƒ S(   NR:   (   RS   R   RU   RT   R^   (   R   R7   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR[   ã   s    c         C   sH   |  i  i | ƒ o |  i  | St |  i |  i | ƒ } | |  i  | <| S(   N(   RV   t   has_keyt	   DictProxyRS   RU   (   R   R7   t   dp(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR^   è   s
    (   R   R   R   R\   RY   RZ   R[   R^   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRR   Æ   s   					R]   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   RS   RU   t   _cid(   R   R   R   R>   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   ò   s    		c         C   sd   | d j o# |  i  i |  i d |  i f h  ƒ S| d j o# |  i  i |  i d |  i f h  ƒ Sd  S(   NR@   RA   RB   RC   (   RS   R   RU   Rb   (   R   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR\   ÷   s    (   R   R   R   R\   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR]   ð   s   	R`   c           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   RS   RU   t   _did(   R   R   R   R7   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR     s    		c         C   s"   |  i  i |  i d |  i f h  ƒ S(   NRE   (   RS   R   RU   Rc   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRD     s    c         C   s%   |  i  i |  i d |  i | f h  ƒ S(   NRI   (   RS   R   RU   Rc   (   R   RG   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   __getitem__
  s    c         C   s   t  | ‚ d  S(   N(   RX   (   R   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR\     s    (   R   R   R   RD   Rd   R\   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR`      s   			t
   GUIAdapterc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   R   t   gui(   R   R   Rf   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR     s    	c         C   s,   t  |  i | ƒ } |  i i | | | ƒ d  S(   N(   RR   R   Rf   R   (   R   R   R   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR     s    (   R   R   R   R   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRe     s   	t   IdbProxyc           B   st   e  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 RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   R   R   t   shell(   R   R   Rh   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   !  s    		c         O   s"   |  i  i |  i | | | ƒ } | S(   N(   R   R   R   (   R   t
   methodnamet   argst   kwargsRH   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   call&  s    c         C   s4   |  i  i |  i d | f h  ƒ } | |  i i _ d  S(   NR(   (   R   t
   asyncqueueR   Rh   t   interpt
   active_seq(   R   R*   t   localst   seq(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR(   ,  s    !c         C   sa   |  i  d | i | ƒ \ } } g  } | D]% \ } } | t |  i | ƒ | f q) ~ } | | f S(   NR    (   Rl   RT   RR   R   (   R   R   R!   R#   R$   R%   R   R&   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR    1  s    9c         C   s   |  i  d ƒ d  S(   NR   (   Rl   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   7  s    c         C   s   |  i  d ƒ d  S(   NR   (   Rl   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   :  s    c         C   s   |  i  d | i ƒ d  S(   NR   (   Rl   RT   (   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   =  s    c         C   s   |  i  d | i ƒ d  S(   NR   (   Rl   RT   (   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   @  s    c         C   s   |  i  d ƒ d  S(   NR   (   Rl   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   C  s    c         C   s   |  i  d | | ƒ } | S(   NR+   (   Rl   (   R   R,   R-   R.   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR+   F  s    c         C   s   |  i  d | | ƒ } | S(   NR/   (   Rl   (   R   R,   R-   R.   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR/   J  s    c         C   s   |  i  d | ƒ } | S(   NR0   (   Rl   (   R   R,   R.   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR0   N  s    (   R   R   R   Rl   R(   R    R   R   R   R   R   R+   R/   R0   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRg     s   											c         C   sb   |  i  d d t f h  ƒ a t |  | t ƒ } t i | | ƒ } 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.

    t   exect   start_the_debugger(   R   R   RM   Rg   RJ   Re   RL   (   t   rpccltt   pyshellt	   idb_proxyRf   t   gui_adap(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   start_remote_debuggerR  s    c         C   s   t  |  ƒ |  i t ƒ d S(   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(   t   close_subprocess_debuggert
   unregisterR   (   Rt   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   close_remote_debuggerj  s    	
c         C   s   |  i  d d t f h  ƒ d  S(   NRr   t   stop_the_debugger(   R   RM   (   Rt   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRy   v  s    c         C   s   |  i  d d t f h  ƒ } d  S(   NRr   Rs   (   R   R   (   Rt   t   idb_adap_oid_ret(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   restart_subprocess_debuggery  s    (    (    (    (    (    (    (    (   t   __doc__t   typest   rpcRJ   t	   debuggingRM   R   R   R5   R<   R   R   R   R   R   RQ   RR   R]   R`   Re   Rg   Rx   R{   Ry   R~   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   <module>   s0   		i	*3			