DebugClients/Python/DebugBase.py

branch
debugger speed
changeset 5044
630b9f290a77
parent 5041
f00a4c8bcbbd
child 5045
50862a6a2c63
equal deleted inserted replaced
5041:f00a4c8bcbbd 5044:630b9f290a77
12 import os 12 import os
13 import types 13 import types
14 import atexit 14 import atexit
15 import inspect 15 import inspect
16 import ctypes 16 import ctypes
17 import thread
18 import time
17 19
18 from DebugProtocol import ResponseClearWatch, ResponseClearBreak, \ 20 from DebugProtocol import ResponseClearWatch, ResponseClearBreak, \
19 ResponseLine, ResponseSyntax, ResponseException, CallTrace 21 ResponseLine, ResponseSyntax, ResponseException, CallTrace
20 from BreakpointWatch import Breakpoint, Watch 22 from BreakpointWatch import Breakpoint, Watch
21 23
89 # initialize parent 91 # initialize parent
90 bdb.Bdb.reset(self) 92 bdb.Bdb.reset(self)
91 93
92 self.__recursionDepth = -1 94 self.__recursionDepth = -1
93 self.setRecursionDepth(inspect.currentframe()) 95 self.setRecursionDepth(inspect.currentframe())
96
97 # background task to periodicaly check for client interactions
98 self.eventPollFlag = False
99 self.timer = thread.start_new_thread(self.__eventPollTimer, ())
100
101 def __eventPollTimer(self):
102 """
103 Private method to set a flag every 0.5 s to check for new messages.
104 """
105 while True:
106 time.sleep(0.5)
107 self.eventPollFlag = True
94 108
95 def getCurrentFrame(self): 109 def getCurrentFrame(self):
96 """ 110 """
97 Public method to return the current frame. 111 Public method to return the current frame.
98 112
243 """ 257 """
244 if self.quitting: 258 if self.quitting:
245 return # None 259 return # None
246 260
247 # give the client a chance to push through new break points. 261 # give the client a chance to push through new break points.
248 self._dbgClient.eventPoll() 262 if self.eventPollFlag:
263 self._dbgClient.eventPoll()
264 self.eventPollFlag = False
249 265
250 if event == 'line': 266 if event == 'line':
251 if self.stop_here(frame) or self.break_here(frame): 267 if self.stop_here(frame) or self.break_here(frame):
252 self.user_line(frame) 268 self.user_line(frame)
253 if self.quitting: 269 if self.quitting:

eric ide

mercurial