Thu, 23 Mar 2017 20:30:49 +0100
move the instruction pointer within the current function (Hotkey: F12)
--- a/DebugClients/Python/DebugBase.py Thu Mar 23 20:27:21 2017 +0100 +++ b/DebugClients/Python/DebugBase.py Thu Mar 23 20:30:49 2017 +0100 @@ -524,6 +524,20 @@ @type frame object """ self._set_stopinfo(None, frame.f_back) + + def move_instruction_pointer(self, lineno): + """ + Public methode to move the instruction pointer to another line. + + @param lineno new line number + @type int + """ + try: + self.currentFrame.f_lineno = lineno + stack = self.getStack(self.currentFrame) + self._dbgClient.sendResponseLine(stack) + except Exception as e: + printerr(e) def set_quit(self): """
--- a/DebugClients/Python/DebugClientBase.py Thu Mar 23 20:27:21 2017 +0100 +++ b/DebugClients/Python/DebugClientBase.py Thu Mar 23 20:30:49 2017 +0100 @@ -723,6 +723,10 @@ self.set_quit() self.eventExit = True + elif method == "RequestMoveIP": + newLine = params["newLine"] + self.currentThreadExec.move_instruction_pointer(newLine) + elif method == "RequestContinue": self.currentThreadExec.go(params["special"]) self.eventExit = True
--- a/Debugger/DebugServer.py Thu Mar 23 20:27:21 2017 +0100 +++ b/Debugger/DebugServer.py Thu Mar 23 20:30:49 2017 +0100 @@ -996,6 +996,14 @@ """ self.debuggerInterface.remoteContinue(special) + def remoteMoveIP(self, line): + """ + Public method to move the instruction pointer to a different line. + + @param line the new line, where execution should be continued + """ + self.debuggerInterface.remoteMoveIP(line) + def remoteBreakpoint(self, fn, line, setBreakpoint, cond=None, temp=False): """ Public method to set or clear a breakpoint.
--- a/Debugger/DebugUI.py Thu Mar 23 20:27:21 2017 +0100 +++ b/Debugger/DebugUI.py Thu Mar 23 20:30:49 2017 +0100 @@ -109,7 +109,7 @@ self.lastAction = -1 self.debugActions = [ self.__continue, self.__step, self.__stepOver, self.__stepOut, - self.__stepQuit, self.__runToCursor + self.__stepQuit, self.__runToCursor, self.__moveInstructionPointer ] self.localsVarFilter, self.globalsVarFilter = \ Preferences.getVarFilters() @@ -357,6 +357,26 @@ )) act.triggered.connect(self.__runToCursor) self.actions.append(act) + + act = E5Action( + self.tr('Move Instruction Pointer to Cursor'), + UI.PixmapCache.getIcon("moveInstructionPointer.png"), + self.tr('&Jump To Cursor'), Qt.Key_F12, 0, + self.debugActGrp, 'dbg_jump_to_cursor') + act.setStatusTip(self.tr( + """Skip the code from the""" + """ current line to the current cursor position""")) + act.setWhatsThis(self.tr( + """<b>Move Instruction Pointer to Cursor</b>""" + """<p>Move the Python internal instruction pointer to the""" + """ current cursor position without executing the code in""" + """ between.</p>""" + """<p>It's not possible to jump out of a function or jump""" + """ in a code block, e.g. a loop. In these cases, a error""" + """ message is printed to the log window.<p>""" + )) + act.triggered.connect(self.__moveInstructionPointer) + self.actions.append(act) act = E5Action( self.tr('Single Step'), @@ -2215,7 +2235,16 @@ self.debugServer.remoteBreakpoint( aw.getFileName(), line, 1, None, 1) self.debugServer.remoteContinue() - + + def __moveInstructionPointer(self): + """ + Private method to move the instruction pointer to a different line. + """ + self.lastAction = 0 + aw = self.viewmanager.activeWindow() + line = aw.getCursorPosition()[0] + 1 + self.debugServer.remoteMoveIP(line) + def __enterRemote(self): """ Private method to update the user interface.
--- a/Debugger/DebuggerInterfaceNone.py Thu Mar 23 20:27:21 2017 +0100 +++ b/Debugger/DebuggerInterfaceNone.py Thu Mar 23 20:30:49 2017 +0100 @@ -210,6 +210,14 @@ """ return + def remoteMoveIP(self, line): + """ + Public method to move the instruction pointer to a different line. + + @param line the new line, where execution should be continued + """ + return + def remoteBreakpoint(self, fn, line, setBreakpoint, cond=None, temp=False): """ Public method to set or clear a breakpoint.
--- a/Debugger/DebuggerInterfacePython2.py Thu Mar 23 20:27:21 2017 +0100 +++ b/Debugger/DebuggerInterfacePython2.py Thu Mar 23 20:30:49 2017 +0100 @@ -563,6 +563,16 @@ "special": special, }) + def remoteMoveIP(self, line): + """ + Public method to move the instruction pointer to a different line. + + @param line the new line, where execution should be continued + """ + self.__sendJsonCommand("RequestMoveIP", { + "newLine": line, + }) + def remoteBreakpoint(self, fn, line, setBreakpoint, cond=None, temp=False): """ Public method to set or clear a breakpoint.
--- a/Debugger/DebuggerInterfacePython3.py Thu Mar 23 20:27:21 2017 +0100 +++ b/Debugger/DebuggerInterfacePython3.py Thu Mar 23 20:30:49 2017 +0100 @@ -563,6 +563,16 @@ "special": special, }) + def remoteMoveIP(self, line): + """ + Public method to move the instruction pointer to a different line. + + @param line the new line, where execution should be continued + """ + self.__sendJsonCommand("RequestMoveIP", { + "newLine": line, + }) + def remoteBreakpoint(self, fn, line, setBreakpoint, cond=None, temp=False): """ Public method to set or clear a breakpoint.
--- a/changelog Thu Mar 23 20:27:21 2017 +0100 +++ b/changelog Thu Mar 23 20:30:49 2017 +0100 @@ -9,6 +9,7 @@ following the one to be ignored - Debugger -- shell autocompleter takes the right global variables into account now + -- move the instruction pointer within the current function (Hotkey: F12) - Mercurial Interface -- extended the user configuration dialog