Tue, 04 Oct 2016 22:38:29 +0200
Some clean up and restructuring.
DebugClients/Python/DebugBase.py | file | annotate | diff | comparison | revisions | |
DebugClients/Python/DebugClientBase.py | file | annotate | diff | comparison | revisions |
--- a/DebugClients/Python/DebugBase.py Tue Oct 04 21:45:33 2016 +0200 +++ b/DebugClients/Python/DebugBase.py Tue Oct 04 22:38:29 2016 +0200 @@ -73,28 +73,22 @@ @param dbgClient the owning client """ self._dbgClient = dbgClient - if sys.version_info[0] == 2: - self.stopOnHandleLine = self._dbgClient.handleLine.func_code - else: - self.stopOnHandleLine = self._dbgClient.handleLine.__code__ self._mainThread = True - self.quitting = 0 + self.quitting = False self.tracePythonLibs(0) # Special handling of a recursion error self.skipFrames = 0 - self.__isBroken = False + self.isBroken = False self.cFrame = None # current frame we are at self.currentFrame = None - # frame that we are stepping in, can be different than currentFrame - self.stepFrame = None - + # frames, where we want to stop or release debugger self.botframe = None self.stopframe = None self.returnframe = None @@ -175,10 +169,7 @@ @param traceMode If it is True, then the step is a step into, otherwise it is a step over. """ - self.stepFrame = self.currentFrame - if traceMode: - self.currentFrame = None self.set_step() else: self.set_next(self.currentFrame) @@ -187,7 +178,6 @@ """ Public method to perform a step out of the current call. """ - self.stepFrame = self.currentFrame self.set_return(self.currentFrame) def go(self, special): @@ -198,7 +188,6 @@ @param special flag indicating a special continue operation """ - self.currentFrame = None self.set_continue(special) def setRecursionDepth(self, frame): @@ -389,10 +378,17 @@ if frame is None: frame = sys._getframe().f_back # Skip set_trace method + if sys.version_info[0] == 2: + stopOnHandleLine = self._dbgClient.handleLine.func_code + bootstrap = '__bootstrap' + else: + stopOnHandleLine = self._dbgClient.handleLine.__code__ + bootstrap = 'bootstrap' + frame.f_trace = self.trace_dispatch while frame is not None: # stop at erics debugger frame - if frame.f_back.f_code == self.stopOnHandleLine: + if frame.f_back.f_code == stopOnHandleLine: frame.f_trace = self.trace_dispatch self.botframe = frame break @@ -430,7 +426,7 @@ except SystemExit: pass finally: - self.quitting = 1 + self.quitting = True sys.settrace(None) def _set_stopinfo(self, stopframe, returnframe): @@ -495,12 +491,11 @@ Disables the trace functions and resets all frame pointer. """ - self.currentFrame = None sys.setprofile(None) sys.settrace(None) self.stopframe = None self.returnframe = None - self.quitting = 1 + self.quitting = True def fix_frame_filename(self, frame): """ @@ -720,13 +715,13 @@ self.currentFrame = frame stack = self.getStack(frame, applyTrace=True) - self.__isBroken = True + self.isBroken = True self._dbgClient.sendResponseLine(stack) self._dbgClient.eventLoop() - self.__isBroken = False - + self.isBroken = False + def user_exception(self, frame, excinfo, unhandled=False): """ Public method reimplemented to report an exception to the debug server. @@ -808,7 +803,8 @@ self.skipFrames = 0 if (exctype == RuntimeError and str(excval).startswith('maximum recursion depth exceeded') or - sys.version_info >= (3, 5) and exctype == RecursionError): + sys.version_info >= (3, 5) and + exctype == RecursionError): # __IGNORE_WARNING__ excval = 'maximum recursion depth exceeded' depth = 0 tb = exctb @@ -951,14 +947,5 @@ # if frame is None return True - def isBroken(self): - """ - Public method to return the broken state of the debugger. - - @return flag indicating the broken state - @rtype bool - """ - return self.__isBroken - # # eflag: noqa = M702
--- a/DebugClients/Python/DebugClientBase.py Tue Oct 04 21:45:33 2016 +0200 +++ b/DebugClients/Python/DebugClientBase.py Tue Oct 04 22:38:29 2016 +0200 @@ -232,8 +232,6 @@ self.callTraceEnabled = None - self.skipdirs = sys.path[:] - self.variant = 'You should not see this' # commandline completion stuff @@ -310,7 +308,7 @@ d = {} d["id"] = t.get_ident() d["name"] = t.get_name() - d["broken"] = t.isBroken() + d["broken"] = t.isBroken threadList.append(d) else: currentId = -1 @@ -318,7 +316,7 @@ d["id"] = -1 d["name"] = "MainThread" if hasattr(self, "isBroken"): - d["broken"] = self.isBroken() + d["broken"] = self.isBroken else: d["broken"] = False threadList.append(d)