11 import bdb |
11 import bdb |
12 import os |
12 import os |
13 import atexit |
13 import atexit |
14 import inspect |
14 import inspect |
15 import ctypes |
15 import ctypes |
|
16 import _thread |
|
17 import time |
16 from inspect import CO_GENERATOR |
18 from inspect import CO_GENERATOR |
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 DebugUtilities import getargvalues, formatargvalues |
22 from DebugUtilities import getargvalues, formatargvalues |
90 # initialize parent |
92 # initialize parent |
91 bdb.Bdb.reset(self) |
93 bdb.Bdb.reset(self) |
92 |
94 |
93 self.__recursionDepth = -1 |
95 self.__recursionDepth = -1 |
94 self.setRecursionDepth(inspect.currentframe()) |
96 self.setRecursionDepth(inspect.currentframe()) |
|
97 |
|
98 # background task to periodicaly check for client interactions |
|
99 self.eventPollFlag = False |
|
100 self.timer = _thread.start_new_thread(self.__eventPollTimer, ()) |
|
101 |
|
102 def __eventPollTimer(self): |
|
103 """ |
|
104 Private method to set a flag every 0.5 s to check for new messages. |
|
105 """ |
|
106 while True: |
|
107 time.sleep(0.5) |
|
108 self.eventPollFlag = True |
95 |
109 |
96 def getCurrentFrame(self): |
110 def getCurrentFrame(self): |
97 """ |
111 """ |
98 Public method to return the current frame. |
112 Public method to return the current frame. |
99 |
113 |
244 """ |
258 """ |
245 if self.quitting: |
259 if self.quitting: |
246 return # None |
260 return # None |
247 |
261 |
248 # give the client a chance to push through new break points. |
262 # give the client a chance to push through new break points. |
249 self._dbgClient.eventPoll() |
263 if self.eventPollFlag: |
|
264 self._dbgClient.eventPoll() |
|
265 self.eventPollFlag = False |
250 |
266 |
251 if event == 'line': |
267 if event == 'line': |
252 if self.stop_here(frame) or self.break_here(frame): |
268 if self.stop_here(frame) or self.break_here(frame): |
253 self.user_line(frame) |
269 self.user_line(frame) |
254 if self.quitting: |
270 if self.quitting: |