DebugClients/Python3/DebugClientBase.py

branch
debugger speed
changeset 5005
684f5ba04f0b
parent 4944
d4709f4818bb
child 5041
f00a4c8bcbbd
equal deleted inserted replaced
5004:556528860c7a 5005:684f5ba04f0b
265 Public method to setup a thread for DebugClient to debug. 265 Public method to setup a thread for DebugClient to debug.
266 266
267 If mainThread is non-zero, then we are attaching to the already 267 If mainThread is non-zero, then we are attaching to the already
268 started mainthread of the app and the rest of the args are ignored. 268 started mainthread of the app and the rest of the args are ignored.
269 269
270 @param target the start function of the target thread (i.e. the 270 @param target the start function of the target thread (i.e. the user
271 user code) 271 code)
272 @param args arguments to pass to target 272 @param args arguments to pass to target
273 @param kwargs keyword arguments to pass to target 273 @param kwargs keyword arguments to pass to target
274 @param mainThread True, if we are attaching to the already 274 @param mainThread True, if we are attaching to the already
275 started mainthread of the app 275 started mainthread of the app
276 """ 276 """
500 sys.path = self.__getSysPath(os.path.dirname(sys.argv[0])) 500 sys.path = self.__getSysPath(os.path.dirname(sys.argv[0]))
501 if wd == '': 501 if wd == '':
502 os.chdir(sys.path[1]) 502 os.chdir(sys.path[1])
503 else: 503 else:
504 os.chdir(wd) 504 os.chdir(wd)
505 tracePython = int(tracePython)
506 self.running = sys.argv[0] 505 self.running = sys.argv[0]
507 self.mainFrame = None 506 self.mainFrame = None
508 self.inRawMode = False 507 self.inRawMode = False
509 self.debugging = True 508 self.debugging = True
510 509
518 517
519 # clear all old breakpoints, they'll get set after we have 518 # clear all old breakpoints, they'll get set after we have
520 # started 519 # started
521 self.mainThread.clear_all_breaks() 520 self.mainThread.clear_all_breaks()
522 521
523 self.mainThread.tracePython = tracePython 522 self.mainThread.tracePythonLibs(int(tracePython))
524 523
525 # This will eventually enter a local event loop. 524 # This will eventually enter a local event loop.
526 # Note the use of backquotes to cause a repr of self.running. 525 # Note the use of backquotes to cause a repr of self.running.
527 # The need for this is on Windows os where backslash is the 526 # The need for this is on Windows os where backslash is the
528 # path separator. They will get inadvertantly stripped away 527 # path separator. They will get inadvertantly stripped away
560 # set the system exception handling function to ensure, that 559 # set the system exception handling function to ensure, that
561 # we report on all unhandled exceptions 560 # we report on all unhandled exceptions
562 sys.excepthook = self.__unhandled_exception 561 sys.excepthook = self.__unhandled_exception
563 self.__interceptSignals() 562 self.__interceptSignals()
564 563
565 self.mainThread.tracePython = False 564 self.mainThread.tracePythonLibs(0)
566 565
567 self.debugMod.__dict__['__file__'] = sys.argv[0] 566 self.debugMod.__dict__['__file__'] = sys.argv[0]
568 sys.modules['__main__'] = self.debugMod 567 sys.modules['__main__'] = self.debugMod
569 res = 0 568 res = 0
570 code = self.__compileFileSource(self.running) 569 code = self.__compileFileSource(self.running)
2026 self.mainFrame = None 2025 self.mainFrame = None
2027 self.inRawMode = False 2026 self.inRawMode = False
2028 self.debugging = True 2027 self.debugging = True
2029 2028
2030 self.attachThread(mainThread=True) 2029 self.attachThread(mainThread=True)
2031 self.mainThread.tracePython = tracePython 2030 self.mainThread.tracePythonLibs(tracePython)
2032 2031
2033 # set the system exception handling function to ensure, that 2032 # set the system exception handling function to ensure, that
2034 # we report on all unhandled exceptions 2033 # we report on all unhandled exceptions
2035 sys.excepthook = self.__unhandled_exception 2034 sys.excepthook = self.__unhandled_exception
2036 self.__interceptSignals() 2035 self.__interceptSignals()
2084 self.write("{0}{1}|{2:d}\n".format( 2083 self.write("{0}{1}|{2:d}\n".format(
2085 DebugProtocol.PassiveStartup, self.running, exceptions)) 2084 DebugProtocol.PassiveStartup, self.running, exceptions))
2086 self.__interact() 2085 self.__interact()
2087 2086
2088 self.attachThread(mainThread=True) 2087 self.attachThread(mainThread=True)
2089 self.mainThread.tracePython = tracePython 2088 self.mainThread.tracePythonLibs(tracePython)
2090 2089
2091 # set the system exception handling function to ensure, that 2090 # set the system exception handling function to ensure, that
2092 # we report on all unhandled exceptions 2091 # we report on all unhandled exceptions
2093 sys.excepthook = self.__unhandled_exception 2092 sys.excepthook = self.__unhandled_exception
2094 self.__interceptSignals() 2093 self.__interceptSignals()

eric ide

mercurial