2626
2727debugging = 0
2828
29- # In the PYTHON subprocess
29+ #=======================================
30+ #
31+ # In the PYTHON subprocess:
3032
3133frametable = {}
3234dicttable = {}
@@ -59,6 +61,8 @@ class IdbAdapter:
5961 def __init__ (self , idb ):
6062 self .idb = idb
6163
64+ #----------called by an IdbProxy----------
65+
6266 def set_step (self ):
6367 self .idb .set_step ()
6468
@@ -90,6 +94,15 @@ def run(self, cmd):
9094 import __main__
9195 self .idb .run (cmd , __main__ .__dict__ )
9296
97+ def set_break (self , filename , lineno ):
98+ msg = self .idb .set_break (filename , lineno )
99+ return msg
100+
101+ def clear_break (self , filename , lineno ):
102+ msg = self .idb .clear_break (filename , lineno )
103+
104+ #----------called by a FrameProxy----------
105+
93106 def frame_attr (self , fid , name ):
94107 frame = frametable [fid ]
95108 return getattr (frame , name )
@@ -115,6 +128,8 @@ def frame_code(self, fid):
115128 codetable [cid ] = code
116129 return cid
117130
131+ #----------called by a CodeProxy----------
132+
118133 def code_name (self , cid ):
119134 code = codetable [cid ]
120135 return code .co_name
@@ -123,6 +138,8 @@ def code_filename(self, cid):
123138 code = codetable [cid ]
124139 return code .co_filename
125140
141+ #----------called by a DictProxy----------
142+
126143 def dict_keys (self , did ):
127144 dict = dicttable [did ]
128145 return dict .keys ()
@@ -141,16 +158,30 @@ def dict_item(self, did, key):
141158# #value = None
142159 return value
143160
161+ #----------end class IdbAdapter----------
162+
163+
144164def start_debugger (conn , gui_adap_oid ):
145- "Launch debugger in the remote python subprocess"
165+ """Start the debugger and its RPC link in the Python subprocess
166+
167+ Start the subprocess side of the split debugger and set up that side of the
168+ RPC link by instantiating the GUIProxy, Idle debugger, and IdbAdapter
169+ objects and linking them together. Register the IdbAdapter to handle RPC
170+ requests from the split Debugger GUI via the IdbProxy.
171+
172+ """
146173 gui_proxy = GUIProxy (conn , gui_adap_oid )
147174 idb = Debugger .Idb (gui_proxy )
148175 idb_adap = IdbAdapter (idb )
149176 idb_adap_oid = "idb_adapter"
150177 conn .register (idb_adap_oid , idb_adap )
151178 return idb_adap_oid
152179
153- # In the IDLE process
180+
181+ #=======================================
182+ #
183+ # In the IDLE process:
184+
154185
155186class FrameProxy :
156187
@@ -193,6 +224,7 @@ def _get_dict_proxy(self, did):
193224 self ._dictcache [did ] = dp
194225 return dp
195226
227+
196228class CodeProxy :
197229
198230 def __init__ (self , conn , oid , cid ):
@@ -208,6 +240,7 @@ def __getattr__(self, name):
208240 return self ._conn .remotecall (self ._oid , "code_filename" ,
209241 (self ._cid ,), {})
210242
243+
211244class DictProxy :
212245
213246 def __init__ (self , conn , oid , did ):
@@ -226,6 +259,7 @@ def __getattr__(self, name):
226259 ##print >>sys.__stderr__, "failed DictProxy.__getattr__:", name
227260 raise AttributeError , name
228261
262+
229263class GUIAdapter :
230264
231265 def __init__ (self , conn , gui ):
@@ -238,6 +272,7 @@ def interaction(self, message, fid, iid):
238272 info = None # XXX for now
239273 self .gui .interaction (message , frame , info )
240274
275+
241276class IdbProxy :
242277
243278 def __init__ (self , conn , oid ):
@@ -274,14 +309,22 @@ def set_return(self, frame):
274309 def set_quit (self ):
275310 self .call ("set_quit" )
276311
312+ def set_break (self , filename , lineno ):
313+ msg = self .call ("set_break" , filename , lineno )
314+ return msg
315+
316+ def clear_break (self , filename , lineno ):
317+ msg = self .call ("clear_break" , filename , lineno )
318+
277319def start_remote_debugger (conn , pyshell ):
278320 """Start the subprocess debugger, initialize the debugger GUI and RPC link
279321
280- Start the debugger in the remote Python process. Instantiate IdbProxy,
281- Debugger GUI, and Debugger GUIAdapter objects, and link them together.
322+ Request the RPCServer start the Python subprocess debugger and link. Set
323+ up the Idle side of the split debugger by instantiating the IdbProxy,
324+ Debugger GUI, and Debugger GUIAdapter objects and linking them together.
282325
283- The GUIAdapter will handle debugger GUI interaction requests coming from
284- the subprocess debugger via the GUIProxy.
326+ Register the GUIAdapter to handle debugger GUI interaction requests coming
327+ from the subprocess debugger via the GUIProxy.
285328
286329 The IdbAdapter will pass execution and environment requests coming from the
287330 Idle debugger GUI to the subprocess debugger via the IdbProxy.
0 commit comments