diff -r 40992b7a60a9 -r 4e2ab5215bcf DebugClients/Python/DebugBase.py --- a/DebugClients/Python/DebugBase.py Sun Feb 19 22:13:48 2017 +0100 +++ b/DebugClients/Python/DebugBase.py Tue Feb 21 22:01:20 2017 +0100 @@ -92,7 +92,6 @@ self.currentFrame = None # frames, where we want to stop or release debugger - self.botframe = None self.stopframe = None self.returnframe = None self.stop_everywhere = False @@ -312,19 +311,13 @@ return self.trace_dispatch if event == 'call': - if self.botframe is None and frame.f_lineno >= 1: - self.botframe = frame - frame.f_trace = self.trace_dispatch - - self.user_line(frame) - return self.trace_dispatch - - if not (self.stop_here(frame) or + if (self.stop_here(frame) or self.__checkBreakInFrame(frame) or Watch.watches != []): + return self.trace_dispatch + else: # No need to trace this function - return - return self.trace_dispatch + return if event == 'return': return @@ -384,7 +377,6 @@ # stop at erics debugger frame or a threading bootstrap if (frame.f_back.f_code == stopOnHandleLine): frame.f_trace = self.trace_dispatch - self.botframe = frame break frame = frame.f_back @@ -408,17 +400,9 @@ @type dict """ try: - frame = sys._getframe() - self.botframe = frame - # First time the dispach function is called, a "base debug" - # function has to be returned, which is called at every user code - # function call. Because of setting botframe manually, the - # specific branch returning the trace_dispatch itself is skipped. - # Because the next step is always in threading.py and we assume - # that there is no breakpoint in it, it's save to return - # trace_dispatch unconditionally. - sys.settrace(lambda frame, event, arg: self.trace_dispatch) - frame.f_trace = self.trace_dispatch + # Because in the initial run method the "base debug" function is + # set up, it's also valid for the threads afterwards. + sys.settrace(self.trace_dispatch) target(*args, **kwargs) except Exception: @@ -450,6 +434,10 @@ cmd = compile(cmd, "<string>", "exec") if debug: + # First time the trace_dispatch function is called, a "base debug" + # function has to be returned, which is called at every user code + # function call. This is ensured by setting stop_everywhere. + self.stop_everywhere = True sys.settrace(self.trace_dispatch) try: