;ς
ό?c           @   s  d  Z  d k Z d k Z d k Z d k Z d Z d a d Z h  Z h  Z	 h  Z
 h  Z d   Z d   Z d f  d     YZ d	 f  d
     YZ d   Z d f  d     YZ d f  d     YZ d f  d     YZ d f  d     YZ d f  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.

Ni    s   idb_adapters   gui_adapterc         C   s   t  |   } |  t | <| Sd  S(   N(   s   ids   frames   fids
   frametable(   s   frames   fid(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   wrap_frame*   s    
c         C   sn   |  t j o t 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(   s   infos   Nones	   tracebacks
   isinstances   typess   TracebackTypes   AssertionErrors   ids   traceback_ids   tracebacktables   modified_info(   s   infos	   tracebacks   traceback_ids   modified_info(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   wrap_info/   s     

s   GUIProxyc           B   s   t  Z d   Z e d  Z RS(   Nc         C   s   | |  _  | |  _ d  S(   N(   s   conns   selfs   gui_adap_oids   oid(   s   selfs   conns   gui_adap_oid(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__=   s    	c         C   s5   |  i i |  i d | t |  t |  f h   d  S(   Ns   interaction(	   s   selfs   conns
   remotecalls   oids   messages
   wrap_frames   frames	   wrap_infos   info(   s   selfs   messages   frames   info(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   interactionA   s    (   s   __name__s
   __module__s   __init__s   Nones   interaction(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   GUIProxy;   s   	s
   IdbAdapterc           B   s³   t  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(   Nc         C   s   | |  _  d  S(   N(   s   idbs   self(   s   selfs   idb(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__J   s    c         C   s   |  i i   d  S(   N(   s   selfs   idbs   set_step(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_stepO   s    c         C   s   |  i i   d  S(   N(   s   selfs   idbs   set_quit(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_quitR   s    c         C   s   |  i i   d  S(   N(   s   selfs   idbs   set_continue(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_continueU   s    c         C   s   t  | } |  i i |  d  S(   N(   s
   frametables   fids   frames   selfs   idbs   set_next(   s   selfs   fids   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_nextX   s    
c         C   s   t  | } |  i i |  d  S(   N(   s
   frametables   fids   frames   selfs   idbs
   set_return(   s   selfs   fids   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   set_return\   s    
c   	      C   s   t  | } | t j o
 t } n t | } |  i i	 | |  \ } } g  i } | D]" \ } } | t |  | f  qT ~ } | | f Sd  S(   N(   s
   frametables   fids   frames   tbids   Nones   tbs   tracebacktables   selfs   idbs	   get_stacks   stacks   is   appends   _[1]s   ks
   wrap_frame(	   s   selfs   fids   tbids   is   stacks   _[1]s   tbs   frames   k(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   get_stack`   s    


9c         C   s#   d  k  } |  i i | | i  d  S(   N(   s   __main__s   selfs   idbs   runs   cmds   __dict__(   s   selfs   cmds   __main__(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   runm   s    	c         C   s   |  i i | |  } | Sd  S(   N(   s   selfs   idbs	   set_breaks   filenames   linenos   msg(   s   selfs   filenames   linenos   msg(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   set_breakq   s    c         C   s   |  i i | |  } | Sd  S(   N(   s   selfs   idbs   clear_breaks   filenames   linenos   msg(   s   selfs   filenames   linenos   msg(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   clear_breaku   s    c         C   s   |  i i |  } | Sd  S(   N(   s   selfs   idbs   clear_all_file_breakss   filenames   msg(   s   selfs   filenames   msg(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   clear_all_file_breaksy   s    c         C   s   t  | } t | |  Sd  S(   N(   s
   frametables   fids   frames   getattrs   name(   s   selfs   fids   names   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   frame_attr   s    
c         C   s1   t  | } | i } t |  } | t | <| Sd  S(   N(   s
   frametables   fids   frames	   f_globalss   dicts   ids   dids	   dicttable(   s   selfs   fids   dids   dicts   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   frame_globals   s
    
	
c         C   s1   t  | } | i } t |  } | t | <| Sd  S(   N(   s
   frametables   fids   frames   f_localss   dicts   ids   dids	   dicttable(   s   selfs   fids   dids   dicts   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   frame_locals   s
    
	
c         C   s1   t  | } | i } t |  } | t | <| Sd  S(   N(   s
   frametables   fids   frames   f_codes   codes   ids   cids	   codetable(   s   selfs   fids   codes   cids   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   frame_code   s
    
	
c         C   s   t  | } | i Sd  S(   N(   s	   codetables   cids   codes   co_name(   s   selfs   cids   code(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   code_name   s    
c         C   s   t  | } | i Sd  S(   N(   s	   codetables   cids   codes   co_filename(   s   selfs   cids   code(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   code_filename   s    
c         C   s   t  | } | i   Sd  S(   N(   s	   dicttables   dids   dicts   keys(   s   selfs   dids   dict(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   dict_keys€   s    
c         C   s(   t  | } | | } t |  } | Sd  S(   N(   s	   dicttables   dids   dicts   keys   values   repr(   s   selfs   dids   keys   values   dict(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   dict_item¨   s    

(   s   __name__s
   __module__s   __init__s   set_steps   set_quits   set_continues   set_nexts
   set_returns	   get_stacks   runs	   set_breaks   clear_breaks   clear_all_file_breakss
   frame_attrs   frame_globalss   frame_localss
   frame_codes	   code_names   code_filenames	   dict_keyss	   dict_item(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   IdbAdapterH   s&   																			c         C   sB   t  |  |  } t i |  } t |  } |  i	 t
 |  t
 Sd 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.

    N(   s   GUIProxys
   rpchandlers   gui_adap_oids	   gui_proxys   Debuggers   Idbs   idbs
   IdbAdapters   idb_adaps   registers   idb_adap_oid(   s
   rpchandlers   gui_adap_oids   idb_adaps   idbs	   gui_proxy(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   start_debugger±   s    	 s
   FrameProxyc           B   s>   t  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   Nc         C   s(   | |  _ | |  _ d |  _ h  |  _ d  S(   Ns   idb_adapter(   s   conns   selfs   _conns   fids   _fids   _oids
   _dictcache(   s   selfs   conns   fid(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__Ι   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   Sd  S(   Ni   s   _s   f_codes	   f_globalss   f_localss
   frame_attr(
   s   names   AttributeErrors   selfs   _get_f_codes   _get_f_globalss   _get_f_localss   _conns
   remotecalls   _oids   _fid(   s   selfs   name(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __getattr__Ο   s    c         C   s>   |  i i |  i d |  i f h   } t |  i |  i |  Sd  S(   Ns
   frame_code(   s   selfs   _conns
   remotecalls   _oids   _fids   cids	   CodeProxy(   s   selfs   cid(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   _get_f_codeΫ   s    $c         C   s5   |  i i |  i d |  i f h   } |  i |  Sd  S(   Ns   frame_globals(   s   selfs   _conns
   remotecalls   _oids   _fids   dids   _get_dict_proxy(   s   selfs   did(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   _get_f_globalsί   s    c         C   s5   |  i i |  i d |  i f h   } |  i |  Sd  S(   Ns   frame_locals(   s   selfs   _conns
   remotecalls   _oids   _fids   dids   _get_dict_proxy(   s   selfs   did(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   _get_f_localsδ   s    c         C   sO   |  i i |  o |  i | Sn t |  i |  i |  } | |  i | <| Sd  S(   N(   s   selfs
   _dictcaches   has_keys   dids	   DictProxys   _conns   _oids   dp(   s   selfs   dids   dp(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   _get_dict_proxyι   s
    (   s   __name__s
   __module__s   __init__s   __getattr__s   _get_f_codes   _get_f_globalss   _get_f_localss   _get_dict_proxy(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   FrameProxyΗ   s   					s	   CodeProxyc           B   s   t  Z d   Z d   Z RS(   Nc         C   s   | |  _ | |  _ | |  _ d  S(   N(   s   conns   selfs   _conns   oids   _oids   cids   _cid(   s   selfs   conns   oids   cid(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__σ   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(   Ns   co_names	   code_names   co_filenames   code_filename(   s   names   selfs   _conns
   remotecalls   _oids   _cid(   s   selfs   name(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __getattr__ψ   s    (   s   __name__s
   __module__s   __init__s   __getattr__(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   CodeProxyρ   s   	s	   DictProxyc           B   s,   t  Z d   Z d   Z d   Z d   Z RS(   Nc         C   s   | |  _ | |  _ | |  _ d  S(   N(   s   conns   selfs   _conns   oids   _oids   dids   _did(   s   selfs   conns   oids   did(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__  s    		c         C   s&   |  i i |  i d |  i f h   Sd  S(   Ns	   dict_keys(   s   selfs   _conns
   remotecalls   _oids   _did(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   keys  s    c         C   s)   |  i i |  i d |  i | f h   Sd  S(   Ns	   dict_item(   s   selfs   _conns
   remotecalls   _oids   _dids   key(   s   selfs   key(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __getitem__  s    c         C   s   t  |  d  S(   N(   s   AttributeErrors   name(   s   selfs   name(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __getattr__  s    (   s   __name__s
   __module__s   __init__s   keyss   __getitem__s   __getattr__(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   DictProxy  s   			s
   GUIAdapterc           B   s   t  Z d   Z d   Z RS(   Nc         C   s   | |  _  | |  _ d  S(   N(   s   conns   selfs   gui(   s   selfs   conns   gui(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__  s    	c         C   s,   t  |  i |  } |  i i | | |  d  S(   N(	   s
   FrameProxys   selfs   conns   fids   frames   guis   interactions   messages   modified_info(   s   selfs   messages   fids   modified_infos   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   interaction  s    (   s   __name__s
   __module__s   __init__s   interaction(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   GUIAdapter  s   	s   IdbProxyc           B   st   t  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(   Nc         C   s   | |  _  | |  _ | |  _ d  S(   N(   s   oids   selfs   conns   shell(   s   selfs   conns   shells   oid(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   __init__"  s    		c         O   s&   |  i i |  i | | |  } | Sd  S(   N(   s   selfs   conns
   remotecalls   oids
   methodnames   argss   kwargss   value(   s   selfs
   methodnames   argss   kwargss   value(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   call'  s    c         C   s4   |  i i |  i d | f h   } | |  i i _ d  S(   Ns   run(	   s   selfs   conns
   asyncqueues   oids   cmds   seqs   shells   interps
   active_seq(   s   selfs   cmds   localss   seq(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   run-  s    !c         C   sk   |  i d | i |  \ } } g  i } | D]( \ } } | t |  i |  | f  q, ~ } | | f Sd  S(   Ns	   get_stack(   s   selfs   calls   frames   _fids   tbids   stacks   is   appends   _[1]s   fids   ks
   FrameProxys   conn(   s   selfs   frames   tbids   is   stacks   _[1]s   fids   k(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   get_stack2  s    ?c         C   s   |  i d  d  S(   Ns   set_continue(   s   selfs   call(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_continue8  s    c         C   s   |  i d  d  S(   Ns   set_step(   s   selfs   call(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_step;  s    c         C   s   |  i d | i  d  S(   Ns   set_next(   s   selfs   calls   frames   _fid(   s   selfs   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_next>  s    c         C   s   |  i d | i  d  S(   Ns
   set_return(   s   selfs   calls   frames   _fid(   s   selfs   frame(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys
   set_returnA  s    c         C   s   |  i d  d  S(   Ns   set_quit(   s   selfs   call(   s   self(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   set_quitD  s    c         C   s   |  i d | |  } | Sd  S(   Ns	   set_break(   s   selfs   calls   filenames   linenos   msg(   s   selfs   filenames   linenos   msg(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys	   set_breakG  s    c         C   s   |  i d | |  } | Sd  S(   Ns   clear_break(   s   selfs   calls   filenames   linenos   msg(   s   selfs   filenames   linenos   msg(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   clear_breakK  s    c         C   s   |  i d |  } | Sd  S(   Ns   clear_all_file_breaks(   s   selfs   calls   filenames   msg(   s   selfs   filenames   msg(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   clear_all_file_breaksO  s    (   s   __name__s
   __module__s   __init__s   calls   runs	   get_stacks   set_continues   set_steps   set_nexts
   set_returns   set_quits	   set_breaks   clear_breaks   clear_all_file_breaks(    (    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   IdbProxy   s   											c         C   sf   |  i d d t f h   a t |  | t  } t i | |  } t	 |  |  } |  i t |  | Sd 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.

    s   execs   start_the_debuggerN(   s   rpcclts
   remotecalls   gui_adap_oids   idb_adap_oids   IdbProxys   pyshells	   idb_proxys   Debuggers   guis
   GUIAdapters   gui_adaps   register(   s   rpcclts   pyshells   gui_adaps   guis	   idb_proxy(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   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(   s   close_subprocess_debuggers   rpcclts
   unregisters   gui_adap_oid(   s   rpcclt(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   close_remote_debuggerk  s     
c         C   s   |  i d d t f h   d  S(   Ns   execs   stop_the_debugger(   s   rpcclts
   remotecalls   idb_adap_oid(   s   rpcclt(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   close_subprocess_debuggerw  s    c         C   s6   |  i d d t f h   } | t j p
 t d  d  S(   Ns   execs   start_the_debuggers    Idb restarted with different oid(   s   rpcclts
   remotecalls   gui_adap_oids   idb_adap_oid_rets   idb_adap_oids   AssertionError(   s   rpcclts   idb_adap_oid_ret(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   restart_subprocess_debuggerz  s    (   s   __doc__s   syss   typess   rpcs   Debuggers	   debuggings   idb_adap_oids   gui_adap_oids
   frametables	   dicttables	   codetables   tracebacktables
   wrap_frames	   wrap_infos   GUIProxys
   IdbAdapters   start_debuggers
   FrameProxys	   CodeProxys	   DictProxys
   GUIAdapters   IdbProxys   start_remote_debuggers   close_remote_debuggers   close_subprocess_debuggers   restart_subprocess_debugger(   s	   CodeProxys	   debuggings	   dicttables
   frametables
   GUIAdapters   rpcs
   wrap_frames   IdbProxys
   IdbAdapters   start_debuggers   gui_adap_oids   start_remote_debuggers   syss
   FrameProxys   typess   GUIProxys   tracebacktables   close_remote_debuggers   Debuggers	   DictProxys	   wrap_infos	   codetables   close_subprocess_debuggers   restart_subprocess_debugger(    (    s3   /mit/python/lib/python2.3/idlelib/RemoteDebugger.pys   ?   s2   						i	*3			