Sun, 04 Sep 2016 13:46:43 +0200
Worked on the last TODOs for the modernized debugger protocol.
--- a/DebugClients/Python2/DebugBase.py Sat Sep 03 19:20:42 2016 +0200 +++ b/DebugClients/Python2/DebugBase.py Sun Sep 04 13:46:43 2016 +0200 @@ -198,17 +198,20 @@ if not self.__skip_it(fromFrame) and not self.__skip_it(toFrame): if event in ["call", "return"]: fr = fromFrame - # TODO: change from and to info to a dictionary - fromStr = "%s:%s:%s" % ( - self._dbgClient.absPath(self.fix_frame_filename(fr)), - fr.f_lineno, - fr.f_code.co_name) + fromInfo = { + "filename": self._dbgClient.absPath( + self.fix_frame_filename(fr)), + "linenumber": fr.f_lineno, + "codename": fr.f_code.co_name, + } fr = toFrame - toStr = "%s:%s:%s" % ( - self._dbgClient.absPath(self.fix_frame_filename(fr)), - fr.f_lineno, - fr.f_code.co_name) - self._dbgClient.sendCallTrace(event, fromStr, toStr) + toInfo = { + "filename": self._dbgClient.absPath( + self.fix_frame_filename(fr)), + "linenumber": fr.f_lineno, + "codename": fr.f_code.co_name, + } + self._dbgClient.sendCallTrace(event, fromInfo, toInfo) def trace_dispatch(self, frame, event, arg): """
--- a/DebugClients/Python2/DebugClientBase.py Sat Sep 03 19:20:42 2016 +0200 +++ b/DebugClients/Python2/DebugClientBase.py Sun Sep 04 13:46:43 2016 +0200 @@ -940,21 +940,23 @@ "stack": stack, }) - def sendCallTrace(self, event, fromStr, toStr): + def sendCallTrace(self, event, fromInfo, toInfo): """ Public method to send a call trace entry. @param event trace event (call or return) @type str - @param fromStr pre-formatted origin info - @type str - @param toStr pre-formatted target info - @type str + @param fromInfo dictionary containing the origin info + @type dict with 'filename', 'linenumber' and 'codename' + as keys + @param toInfo dictionary containing the target info + @type dict with 'filename', 'linenumber' and 'codename' + as keys """ self.sendJsonCommand("CallTrace", { "event": event[0], - "from": fromStr, - "to": toStr, + "from": fromInfo, + "to": toInfo, }) def sendException(self, exceptionType, exceptionMessage, stack):
--- a/DebugClients/Python3/DebugBase.py Sat Sep 03 19:20:42 2016 +0200 +++ b/DebugClients/Python3/DebugBase.py Sun Sep 04 13:46:43 2016 +0200 @@ -199,17 +199,20 @@ if not self.__skip_it(fromFrame) and not self.__skip_it(toFrame): if event in ["call", "return"]: fr = fromFrame - # TODO: change from and to info to a dictionary - fromStr = "{0}:{1}:{2}".format( - self._dbgClient.absPath(self.fix_frame_filename(fr)), - fr.f_lineno, - fr.f_code.co_name) + fromInfo = { + "filename": self._dbgClient.absPath( + self.fix_frame_filename(fr)), + "linenumber": fr.f_lineno, + "codename": fr.f_code.co_name, + } fr = toFrame - toStr = "{0}:{1}:{2}".format( - self._dbgClient.absPath(self.fix_frame_filename(fr)), - fr.f_lineno, - fr.f_code.co_name) - self._dbgClient.sendCallTrace(event, fromStr, toStr) + toInfo = { + "filename": self._dbgClient.absPath( + self.fix_frame_filename(fr)), + "linenumber": fr.f_lineno, + "codename": fr.f_code.co_name, + } + self._dbgClient.sendCallTrace(event, fromInfo, toInfo) def trace_dispatch(self, frame, event, arg): """
--- a/DebugClients/Python3/DebugClientBase.py Sat Sep 03 19:20:42 2016 +0200 +++ b/DebugClients/Python3/DebugClientBase.py Sun Sep 04 13:46:43 2016 +0200 @@ -934,21 +934,23 @@ "stack": stack, }) - def sendCallTrace(self, event, fromStr, toStr): + def sendCallTrace(self, event, fromInfo, toInfo): """ Public method to send a call trace entry. @param event trace event (call or return) @type str - @param fromStr pre-formatted origin info - @type str - @param toStr pre-formatted target info - @type str + @param fromInfo dictionary containing the origin info + @type dict with 'filename', 'linenumber' and 'codename' + as keys + @param toInfo dictionary containing the target info + @type dict with 'filename', 'linenumber' and 'codename' + as keys """ self.sendJsonCommand("CallTrace", { "event": event[0], - "from": fromStr, - "to": toStr, + "from": fromInfo, + "to": toInfo, }) def sendException(self, exceptionType, exceptionMessage, stack):
--- a/Debugger/DebugUI.py Sat Sep 03 19:20:42 2016 +0200 +++ b/Debugger/DebugUI.py Sun Sep 04 13:46:43 2016 +0200 @@ -983,7 +983,10 @@ """ Private method to handle the debugged program terminating. - @param status exit code of the debugged program (int) + @param status exit code of the debugged program + @type int + @param message exit message of the debugged program + @type str """ self.viewmanager.exit()
--- a/Debugger/DebuggerInterfacePython2.py Sat Sep 03 19:20:42 2016 +0200 +++ b/Debugger/DebuggerInterfacePython2.py Sun Sep 04 13:46:43 2016 +0200 @@ -887,12 +887,14 @@ elif method == "CallTrace": isCall = params["event"].lower() == "c" - fromFile, fromLineno, fromFunc = params["from"].rsplit(":", 2) - toFile, toLineno, toFunc = params["to"].rsplit(":", 2) + fromInfo = params["from"] + toInfo = params["to"] self.debugServer.signalClientCallTrace( isCall, - fromFile, fromLineno, fromFunc, - toFile, toLineno, toFunc) + fromInfo["filename"], str(fromInfo["linenumber"]), + fromInfo["codename"], + toInfo["filename"], str(toInfo["linenumber"]), + toInfo["codename"]) elif method == "ResponseVariables": self.debugServer.signalClientVariables(
--- a/Debugger/DebuggerInterfacePython3.py Sat Sep 03 19:20:42 2016 +0200 +++ b/Debugger/DebuggerInterfacePython3.py Sun Sep 04 13:46:43 2016 +0200 @@ -887,12 +887,14 @@ elif method == "CallTrace": isCall = params["event"].lower() == "c" - fromFile, fromLineno, fromFunc = params["from"].rsplit(":", 2) - toFile, toLineno, toFunc = params["to"].rsplit(":", 2) + fromInfo = params["from"] + toInfo = params["to"] self.debugServer.signalClientCallTrace( isCall, - fromFile, fromLineno, fromFunc, - toFile, toLineno, toFunc) + fromInfo["filename"], str(fromInfo["linenumber"]), + fromInfo["codename"], + toInfo["filename"], str(toInfo["linenumber"]), + toInfo["codename"]) elif method == "ResponseVariables": self.debugServer.signalClientVariables(