[Pydev-cvs] org.python.pydev.debug/pysrc pydevd.py, 1.89, 1.90 pydevd_frame.py, 1.22, 1.23
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-02-18 17:11:46
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20626/pysrc Modified Files: pydevd.py pydevd_frame.py Log Message: Fixes in step return / return handling. Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** pydevd.py 17 Feb 2008 17:01:21 -0000 1.89 --- pydevd.py 18 Feb 2008 17:11:48 -0000 1.90 *************** *** 529,546 **** info.pydev_step_stop = None ! elif info.pydev_step_cmd == CMD_STEP_OVER and event != 'return': info.pydev_step_stop = frame ! ! elif info.pydev_step_cmd == CMD_STEP_RETURN or (info.pydev_step_cmd == CMD_STEP_OVER and event == 'return'): back_frame = frame.f_back if back_frame is not None: ! back_frame.f_trace = GetGlobalDebugger().trace_dispatch ! info.pydev_step_stop = back_frame else: #No back frame?!? -- this happens in jython when we have some frame created from an awt event #(the previous frame would be the awt event, but this doesn't make part of 'jython', only 'java') info.pydev_step_stop = None ! info.pydev_step_cmd = CMD_RUN ! del frame cmd = self.cmdFactory.makeThreadRunMessage(id(thread), info.pydev_step_cmd) --- 529,549 ---- info.pydev_step_stop = None ! elif info.pydev_step_cmd == CMD_STEP_OVER: info.pydev_step_stop = frame ! ! elif info.pydev_step_cmd == CMD_STEP_RETURN: back_frame = frame.f_back if back_frame is not None: ! #steps back to the same frame (in a return call it will stop in the 'back frame' for the user) ! info.pydev_step_stop = frame else: #No back frame?!? -- this happens in jython when we have some frame created from an awt event #(the previous frame would be the awt event, but this doesn't make part of 'jython', only 'java') + #so, if we're doing a step return in this situation, it's the same as just making it run info.pydev_step_stop = None ! info.pydev_step_cmd = None ! info.pydev_state = STATE_RUN ! ! del frame cmd = self.cmdFactory.makeThreadRunMessage(id(thread), info.pydev_step_cmd) Index: pydevd_frame.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd_frame.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pydevd_frame.py 17 Feb 2008 17:01:21 -0000 1.22 --- pydevd_frame.py 18 Feb 2008 17:11:48 -0000 1.23 *************** *** 13,17 **** def __init__(self, *args): ! #args = mainDebugger, filename, base, additionalInfo, t, frame #yeap, much faster than putting in self and the getting it from self later on self._args = args[:-1] --- 13,17 ---- def __init__(self, *args): ! #args = mainDebugger, filename, base, info, t, frame #yeap, much faster than putting in self and the getting it from self later on self._args = args[:-1] *************** *** 27,31 **** return None ! mainDebugger, filename, additionalInfo, thread = self._args breakpoint = mainDebugger.breakpoints.get(filename) --- 27,31 ---- return None ! mainDebugger, filename, info, thread = self._args breakpoint = mainDebugger.breakpoints.get(filename) *************** *** 33,38 **** #print 'frame: trace_dispatch', self.base, frame.f_lineno, event, frame.f_code.co_name ! can_skip = additionalInfo.pydev_state == STATE_RUN and additionalInfo.pydev_step_stop is None \ ! and additionalInfo.pydev_step_cmd is None # Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint, --- 33,38 ---- #print 'frame: trace_dispatch', self.base, frame.f_lineno, event, frame.f_code.co_name ! can_skip = info.pydev_state == STATE_RUN and info.pydev_step_stop is None \ ! and info.pydev_step_cmd is None # Let's check to see if we are in a function that has a breakpoint. If we don't have a breakpoint, *************** *** 59,67 **** else: # if we had some break, it won't get here (so, that's a context that we want to skip) if can_skip: ! #print 'skipping', frame.f_lineno, additionalInfo.pydev_state, additionalInfo.pydev_step_stop, additionalInfo.pydev_step_cmd return None #We may have hit a breakpoint or we are already in step mode. Either way, let's check what we should do in this frame ! #print 'NOT skipped', base, frame.f_lineno, additionalInfo.pydev_state, additionalInfo.pydev_step_stop, additionalInfo.pydev_step_cmd --- 59,67 ---- else: # if we had some break, it won't get here (so, that's a context that we want to skip) if can_skip: ! #print 'skipping', frame.f_lineno, info.pydev_state, info.pydev_step_stop, info.pydev_step_cmd return None #We may have hit a breakpoint or we are already in step mode. Either way, let's check what we should do in this frame ! #print 'NOT skipped', base, frame.f_lineno, info.pydev_state, info.pydev_step_stop, info.pydev_step_cmd *************** *** 71,75 **** #return is not taken into account for breakpoint hit because we'd have a double-hit in this case #(one for the line and the other for the return). ! if event != 'return' and additionalInfo.pydev_state != STATE_SUSPEND and breakpoint is not None \ and breakpoint.has_key(line): --- 71,75 ---- #return is not taken into account for breakpoint hit because we'd have a double-hit in this case #(one for the line and the other for the return). ! if event != 'return' and info.pydev_state != STATE_SUSPEND and breakpoint is not None \ and breakpoint.has_key(line): *************** *** 92,96 **** # if thread has a suspend flag, we suspend with a busy wait ! if additionalInfo.pydev_state == STATE_SUSPEND and additionalInfo.pydev_step_cmd != CMD_STEP_RETURN: self.doWaitSuspend(thread, frame, event, arg) return self.trace_dispatch --- 92,96 ---- # if thread has a suspend flag, we suspend with a busy wait ! if info.pydev_state == STATE_SUSPEND and info.pydev_step_cmd != CMD_STEP_RETURN: self.doWaitSuspend(thread, frame, event, arg) return self.trace_dispatch *************** *** 102,123 **** #step handling. We stop when we hit the right frame try: ! if additionalInfo.pydev_step_cmd == CMD_STEP_INTO and event in ('line', 'return'): ! self.setSuspend(thread, CMD_STEP_INTO) ! self.doWaitSuspend(thread, frame, event, arg) ! elif additionalInfo.pydev_step_cmd in (CMD_STEP_OVER, CMD_STEP_RETURN): ! self.setSuspend(thread, additionalInfo.pydev_step_cmd) ! if event == 'return': ! #if we're in a return, we want it to appear to the user in the previous frame! ! self.doWaitSuspend(thread, frame.f_back, event, arg) ! elif event == 'line' and additionalInfo.pydev_step_stop == frame: self.doWaitSuspend(thread, frame, event, arg) except: traceback.print_exc() ! additionalInfo.pydev_step_cmd = None #if we are quitting, let's stop the tracing --- 102,142 ---- #step handling. We stop when we hit the right frame try: ! ! if info.pydev_step_cmd == CMD_STEP_INTO: ! stop = event in ('line', 'return') ! ! elif info.pydev_step_cmd == CMD_STEP_OVER: ! stop = info.pydev_step_stop == frame and event in ('line', 'return') ! ! elif info.pydev_step_cmd == CMD_STEP_RETURN: ! ! stop = event == 'return' and info.pydev_step_stop == frame ! ! else: ! stop = False ! if stop: ! #event is always == line or return at this point ! if event == 'line': ! self.setSuspend(thread, info.pydev_step_cmd) self.doWaitSuspend(thread, frame, event, arg) + else: + back = frame.f_back + if back is not None: + #if we're in a return, we want it to appear to the user in the previous frame! + self.setSuspend(thread, info.pydev_step_cmd) + self.doWaitSuspend(thread, back, event, arg) + else: + #in jython we may not have a back frame + info.pydev_step_stop = None + info.pydev_step_cmd = None + info.pydev_state = STATE_RUN except: traceback.print_exc() ! info.pydev_step_cmd = None #if we are quitting, let's stop the tracing |