DebugClients/Python/ThreadExtension.py

branch
debugger fine grinding
changeset 5667
86554f131048
parent 5651
982465f8389c
child 5680
b93cb6353cc0
child 5914
e44c04a89dbc
equal deleted inserted replaced
5666:aa3532e96210 5667:86554f131048
37 self.threadNumber = 1 37 self.threadNumber = 1
38 self.enableImportHooks = True 38 self.enableImportHooks = True
39 self._original_start_new_thread = None 39 self._original_start_new_thread = None
40 self.threadingAttached = False 40 self.threadingAttached = False
41 self.qtThreadAttached = False 41 self.qtThreadAttached = False
42 self.greenlet = False
42 43
43 self.clientLock = threading.RLock() 44 self.clientLock = threading.RLock()
44 45
45 # dictionary of all threads running {id: DebugBase} 46 # dictionary of all threads running {id: DebugBase}
46 self.threads = {_thread.get_ident(): self} 47 self.threads = {_thread.get_ident(): self}
258 """ 259 """
259 if fullname in sys.modules or not self.debugging: 260 if fullname in sys.modules or not self.debugging:
260 return None 261 return None
261 262
262 if fullname in [self.threadModName, 'PyQt4.QtCore', 'PyQt5.QtCore', 263 if fullname in [self.threadModName, 'PyQt4.QtCore', 'PyQt5.QtCore',
263 'PySide.QtCore', 'PySide2.QtCore', 264 'PySide.QtCore', 'PySide2.QtCore', 'greenlet',
264 'threading'] and self.enableImportHooks: 265 'threading'] and self.enableImportHooks:
265 # Disable hook to be able to import original module 266 # Disable hook to be able to import original module
266 self.enableImportHooks = False 267 self.enableImportHooks = False
267 return self 268 return self
268 269
283 self._original_start_new_thread is None): 284 self._original_start_new_thread is None):
284 # make thread hooks available to system 285 # make thread hooks available to system
285 self._original_start_new_thread = module.start_new_thread 286 self._original_start_new_thread = module.start_new_thread
286 module.start_new_thread = self.attachThread 287 module.start_new_thread = self.attachThread
287 288
289 elif (fullname == 'greenlet' and self.greenlet is False):
290 # Check for greenlet.settrace
291 if hasattr(module, 'settrace'):
292 self.greenlet = True
293 DebugBase.pollTimerEnabled = False
294
295 # TODO: Implement the debugger extension for greenlets
296
288 # Add hook for threading.run() 297 # Add hook for threading.run()
289 elif (fullname == "threading" and self.threadingAttached is False): 298 elif (fullname == "threading" and self.threadingAttached is False):
290 self.threadingAttached = True 299 self.threadingAttached = True
291 300
292 # _debugClient as a class attribute can't be accessed in following 301 # _debugClient as a class attribute can't be accessed in following

eric ide

mercurial