³ò
ž›\Kc           @   s(  d  Z  d d k 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(    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt
   wrap_frame*   s    
c         C   sn   |  d j o d SnV |  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(    (    s,   /usr/lib/python2.5/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(    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   A   s    N(   t   __name__t
   __module__R   R   R   (    (    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   J   s    c         C   s   |  i  i ƒ  d  S(   N(   R   t   set_step(   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   O   s    c         C   s   |  i  i ƒ  d  S(   N(   R   t   set_quit(   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR    R   s    c         C   s   |  i  i ƒ  d  S(   N(   R   t   set_continue(   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR!   U   s    c         C   s   t  | } |  i i | ƒ d  S(   N(   R   R   t   set_next(   R   R   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR"   X   s    
c         C   s   t  | } |  i i | ƒ d  S(   N(   R   R   t
   set_return(   R   R   R   (    (    s,   /usr/lib/python2.5/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(    (    s,   /usr/lib/python2.5/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+   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR,   m   s    c         C   s   |  i  i | | ƒ } | S(   N(   R   t	   set_break(   R   t   filenamet   linenot   msg(    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR/   q   s    c         C   s   |  i  i | | ƒ } | S(   N(   R   t   clear_break(   R   R0   R1   R2   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR3   u   s    c         C   s   |  i  i | ƒ } | S(   N(   R   t   clear_all_file_breaks(   R   R0   R2   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR4   y   s    c         C   s   t  | } t | | ƒ S(   N(   R   t   getattr(   R   R   t   nameR   (    (    s,   /usr/lib/python2.5/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(    (    s,   /usr/lib/python2.5/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;   (    (    s,   /usr/lib/python2.5/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(    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt
   frame_code‘   s
    
	
c         C   s   t  | } | i S(   N(   R@   t   co_name(   R   RB   RA   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt	   code_nameš   s    
c         C   s   t  | } | i S(   N(   R@   t   co_filename(   R   RB   RA   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt   code_filenamež   s    
c         C   s   t  | } | i ƒ  S(   N(   R9   t   keys(   R   R;   R:   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt	   dict_keys¤   s    
c         C   s$   t  | } | | } t | ƒ } | S(   N(   R9   t   repr(   R   R;   t   keyR:   t   value(    (    s,   /usr/lib/python2.5/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   (    (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   H   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(    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   É   s    			c         C   s”   | d  d j o t  | ‚ n | d j o |  i ƒ  Sn | d j o |  i ƒ  Sn | d j o |  i ƒ  Sn |  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   (    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/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;   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR^   ß   s    c         C   s1   |  i  i |  i d |  i f h  ƒ } |  i | ƒ S(   NR>   (   RW   R   RY   RX   Rb   (   R   R;   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR_   ä   s    c         C   sK   |  i  i | ƒ o |  i  | Sn t |  i |  i | ƒ } | |  i  | <| S(   N(   RZ   t   has_keyt	   DictProxyRW   RY   (   R   R;   t   dp(    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyRb   é   s
    (   R   R   R   R`   R]   R^   R_   Rb   (    (    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   ó   s    		c         C   sj   | d j o& |  i  i |  i d |  i f h  ƒ Sn | d j o& |  i  i |  i d |  i f h  ƒ Sn d  S(   NRD   RE   RF   RG   (   RW   R   RY   Rf   (   R   R6   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR`   ø   s    (   R   R   R   R`   (    (    (    s,   /usr/lib/python2.5/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;   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR     s    		c         C   s"   |  i  i |  i d |  i f h  ƒ S(   NRI   (   RW   R   RY   Rg   (   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyRH     s    c         C   s%   |  i  i |  i d |  i | f h  ƒ S(   NRM   (   RW   R   RY   Rg   (   R   RK   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt   __getitem__  s    c         C   s   t  | ‚ d  S(   N(   R\   (   R   R6   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR`     s    (   R   R   R   RH   Rh   R`   (    (    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR     s    	c         C   s,   t  |  i | ƒ } |  i i | | | ƒ d  S(   N(   RV   R   Rj   R   (   R   R   R   R   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR     s    (   R   R   R   R   (    (    (    s,   /usr/lib/python2.5/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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   "  s    		c         O   s"   |  i  i |  i | | | ƒ } | S(   N(   R   R   R   (   R   t
   methodnamet   argst   kwargsRL   (    (    s,   /usr/lib/python2.5/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(    (    s,   /usr/lib/python2.5/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*   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR$   2  s    9c         C   s   |  i  d ƒ d  S(   NR!   (   Rp   (   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR!   8  s    c         C   s   |  i  d ƒ d  S(   NR   (   Rp   (   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR   ;  s    c         C   s   |  i  d | i ƒ d  S(   NR"   (   Rp   RX   (   R   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR"   >  s    c         C   s   |  i  d | i ƒ d  S(   NR#   (   Rp   RX   (   R   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR#   A  s    c         C   s   |  i  d ƒ d  S(   NR    (   Rp   (   R   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR    D  s    c         C   s   |  i  d | | ƒ } | S(   NR/   (   Rp   (   R   R0   R1   R2   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR/   G  s    c         C   s   |  i  d | | ƒ } | S(   NR3   (   Rp   (   R   R0   R1   R2   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR3   K  s    c         C   s   |  i  d | ƒ } | S(   NR4   (   Rp   (   R   R0   R2   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR4   O  s    (   R   R   R   Rp   R,   R$   R!   R   R"   R#   R    R/   R3   R4   (    (    (    s,   /usr/lib/python2.5/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(    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt   start_remote_debuggerS  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   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt   close_remote_debuggerk  s    	
c         C   s   |  i  d d t f h  ƒ d  S(   NRv   t   stop_the_debugger(   R   RQ   (   Rx   (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyR}   w  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(    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pyt   restart_subprocess_debuggerz  s    (    (    (    (    (    (    (    (   t   __doc__t   sysR	   t   rpcRN   t	   debuggingRQ   R   R   R9   R@   R   R   R   R   R   RU   RV   Ra   Rd   Ri   Rk   R|   R   R}   R‚   (    (    (    s,   /usr/lib/python2.5/idlelib/RemoteDebugger.pys   <module>   s2   		i	*3			