Ñò
—à"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   sk   |  d j o d S|  d } t | t i ƒ p t ‚ t | ƒ } | t | <|  d |  d | f } | Sd S(   s0   replace info[2], a traceback instance, by its IDi   i    i   N(   t   Nonet
   isinstancet   typest   TracebackTypet   AssertionErrorR   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   R0   R1   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR3   t   s    c         C   s   |  i  i | ƒ } | S(   N(   R   t   clear_all_file_breaks(   R   R0   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR4   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   R9   (   R   R   R   R:   R;   (    (    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   RB   RA   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt	   code_name™   s    
c         C   s   t  | } | i S(   N(   R@   t   co_filename(   R   RB   RA   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   code_filename   s    
c         C   s   t  | } | i ƒ  S(   N(   R9   t   keys(   R   R;   R:   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt	   dict_keys£   s    
c         C   s$   t  | } | | } t | ƒ } | S(   N(   R9   t   repr(   R   R;   t   keyR:   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/   R3   R4   R7   R<   R>   RC   RE   RG   RI   RM   (    (    (    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?   R8   R=   R7   (   t   AttributeErrort   _get_f_codet   _get_f_globalst   _get_f_localsRW   R   RY   RX   (   R   R6   (    (    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(   NRC   (   RW   R   RY   RX   t	   CodeProxy(   R   RB   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR]   Ú   s    $c         C   s1   |  i  i |  i d |  i f h  ƒ } |  i | ƒ S(   NR<   (   RW   R   RY   RX   t   _get_dict_proxy(   R   R;   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR^   Þ   s    c         C   s1   |  i  i |  i d |  i f h  ƒ } |  i | ƒ S(   NR>   (   RW   R   RY   RX   Rb   (   R   R;   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR_   ã   s    c         C   sH   |  i  i | ƒ o |  i  | St |  i |  i | ƒ } | |  i  | <| S(   N(   RZ   t   has_keyt	   DictProxyRW   RY   (   R   R;   t   dp(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRb   è   s
    (   R   R   R   R`   R]   R^   R_   Rb   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRV   Æ   s   					Ra   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   RW   RY   t   _cid(   R   R   R   RB   (    (    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(   NRD   RE   RF   RG   (   RW   R   RY   Rf   (   R   R6   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR`   ÷   s    (   R   R   R   R`   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRa   ð   s   	Rd   c           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   RW   RY   t   _did(   R   R   R   R;   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR     s    		c         C   s"   |  i  i |  i d |  i f h  ƒ S(   NRI   (   RW   R   RY   Rg   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRH     s    c         C   s%   |  i  i |  i d |  i | f h  ƒ S(   NRM   (   RW   R   RY   Rg   (   R   RK   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   __getitem__
  s    c         C   s   t  | ‚ d  S(   N(   R\   (   R   R6   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR`     s    (   R   R   R   RH   Rh   R`   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRd      s   			t
   GUIAdapterc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   R   t   gui(   R   R   Rj   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR     s    	c         C   s,   t  |  i | ƒ } |  i i | | | ƒ d  S(   N(   RV   R   Rj   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.pyRi     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   Rl   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   kwargsRL   (    (    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   Rl   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$   (   Rp   RX   RV   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!   (   Rp   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR!   7  s    c         C   s   |  i  d ƒ d  S(   NR   (   Rp   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR   :  s    c         C   s   |  i  d | i ƒ d  S(   NR"   (   Rp   RX   (   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR"   =  s    c         C   s   |  i  d | i ƒ d  S(   NR#   (   Rp   RX   (   R   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR#   @  s    c         C   s   |  i  d ƒ d  S(   NR    (   Rp   (   R   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR    C  s    c         C   s   |  i  d | | ƒ } | S(   NR/   (   Rp   (   R   R0   R1   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR/   F  s    c         C   s   |  i  d | | ƒ } | S(   NR3   (   Rp   (   R   R0   R1   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR3   J  s    c         C   s   |  i  d | ƒ } | S(   NR4   (   Rp   (   R   R0   R2   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR4   N  s    (   R   R   R   Rp   R,   R$   R!   R   R"   R#   R    R/   R3   R4   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyRk     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   RQ   Rk   RN   Ri   RP   (   t   rpccltt   pyshellt	   idb_proxyRj   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   (   Rx   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   close_remote_debuggerj  s    	
c         C   s   |  i  d d t f h  ƒ d  S(   NRv   t   stop_the_debugger(   R   RQ   (   Rx   (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyR}   v  s    c         C   s6   |  i  d d t f h  ƒ } | t j p
 t d ‚ d  S(   NRv   Rw   s    Idb restarted with different oid(   R   R   RQ   R   (   Rx   t   idb_adap_oid_ret(    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   restart_subprocess_debuggery  s    (    (    (    (    (    (    (    (   t   __doc__R	   t   rpcRN   t	   debuggingRQ   R   R   R9   R@   R   R   R   R   R   RU   RV   Ra   Rd   Ri   Rk   R|   R   R}   R‚   (    (    (    s3   /mit/python/lib/python2.6/idlelib/RemoteDebugger.pyt   <module>   s0   		i	*3			