diff -r 9986ec0e559a -r 10516539f238 Debugger/DebuggerInterfacePython.py --- a/Debugger/DebuggerInterfacePython.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Debugger/DebuggerInterfacePython.py Fri Oct 18 23:00:41 2013 +0200 @@ -76,7 +76,8 @@ # set default values for capabilities of clients self.clientCapabilities = ClientDefaultCapabilities - self.codec = QTextCodec.codecForName(Preferences.getSystem("StringEncoding")) + self.codec = QTextCodec.codecForName( + Preferences.getSystem("StringEncoding")) self.__unicodeRe = re.compile(r"""\bu(["'])""") @@ -125,7 +126,8 @@ @param program name of the executable to start (string) @param arguments arguments to be passed to the program (list of string) - @param environment dictionary of environment settings to pass (dict of string) + @param environment dictionary of environment settings to pass + (dict of string) @return the process object (QProcess) or None """ proc = QProcess() @@ -164,19 +166,22 @@ debugClientType = Preferences.getDebugger("DebugClientType") if debugClientType == "standard": debugClient = os.path.join(getConfig('ericDir'), - "DebugClients", "Python", "DebugClient.py") + "DebugClients", "Python", + "DebugClient.py") elif debugClientType == "threaded": debugClient = os.path.join(getConfig('ericDir'), - "DebugClients", "Python", "DebugClientThreads.py") + "DebugClients", "Python", + "DebugClientThreads.py") else: debugClient = Preferences.getDebugger("DebugClient") if debugClient == "": debugClient = os.path.join(sys.path[0], - "DebugClients", "Python", "DebugClient.py") + "DebugClients", "Python", + "DebugClient.py") redirect = str(Preferences.getDebugger("PythonRedirect")) - noencoding = \ - Preferences.getDebugger("PythonNoEncoding") and '--no-encoding' or '' + noencoding = Preferences.getDebugger("PythonNoEncoding") and \ + '--no-encoding' or '' if Preferences.getDebugger("RemoteDbgEnabled"): ipaddr = self.debugServer.getHostAddress(False) @@ -194,7 +199,8 @@ E5MessageBox.critical(None, self.trUtf8("Start Debugger"), self.trUtf8( - """<p>The debugger backend could not be started.</p>""")) + """<p>The debugger backend could not be""" + """ started.</p>""")) # set translation function if Preferences.getDebugger("PathTranslation"): @@ -239,7 +245,8 @@ E5MessageBox.critical(None, self.trUtf8("Start Debugger"), self.trUtf8( - """<p>The debugger backend could not be started.</p>""")) + """<p>The debugger backend could not be""" + """ started.</p>""")) return process, self.__isNetworked process = self.__startProcess(interpreter, @@ -248,7 +255,8 @@ if process is None: E5MessageBox.critical(None, self.trUtf8("Start Debugger"), - self.trUtf8("""<p>The debugger backend could not be started.</p>""")) + self.trUtf8( + """<p>The debugger backend could not be started.</p>""")) return process, self.__isNetworked def startRemoteForProject(self, port, runInConsole): @@ -289,11 +297,14 @@ E5MessageBox.critical(None, self.trUtf8("Start Debugger"), self.trUtf8( - """<p>The debugger backend could not be started.</p>""")) + """<p>The debugger backend could not be""" + """ started.</p>""")) # set translation function if project.getDebugProperty("PATHTRANSLATION"): - self.translateRemote = project.getDebugProperty("REMOTEPATH") - self.translateLocal = project.getDebugProperty("LOCALPATH") + self.translateRemote = \ + project.getDebugProperty("REMOTEPATH") + self.translateLocal = \ + project.getDebugProperty("LOCALPATH") self.translate = self.__remoteTranslation else: self.translate = self.__identityTranslation @@ -332,7 +343,8 @@ E5MessageBox.critical(None, self.trUtf8("Start Debugger"), self.trUtf8( - """<p>The debugger backend could not be started.</p>""")) + """<p>The debugger backend could not be""" + """ started.</p>""")) return process, self.__isNetworked process = self.__startProcess(interpreter, @@ -341,7 +353,8 @@ if process is None: E5MessageBox.critical(None, self.trUtf8("Start Debugger"), - self.trUtf8("""<p>The debugger backend could not be started.</p>""")) + self.trUtf8( + """<p>The debugger backend could not be started.</p>""")) return process, self.__isNetworked def getClientCapabilities(self): @@ -421,22 +434,24 @@ @param env environment settings (dictionary) """ - self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEnv, str(env))) + self.__sendCommand('{0}{1}\n'.format( + DebugProtocol.RequestEnv, str(env))) - def remoteLoad(self, fn, argv, wd, traceInterpreter=False, autoContinue=True, - autoFork=False, forkChild=False): + def remoteLoad(self, fn, argv, wd, traceInterpreter=False, + autoContinue=True, autoFork=False, forkChild=False): """ Public method to load a new program to debug. @param fn the filename to debug (string) @param argv the commandline arguments to pass to the program (string) @param wd the working directory for the program (string) - @keyparam traceInterpreter flag indicating if the interpreter library should be - traced as well (boolean) - @keyparam autoContinue flag indicating, that the debugger should not stop - at the first executable line (boolean) + @keyparam traceInterpreter flag indicating if the interpreter library + should be traced as well (boolean) + @keyparam autoContinue flag indicating, that the debugger should not + stop at the first executable line (boolean) @keyparam autoFork flag indicating the automatic fork mode (boolean) - @keyparam forkChild flag indicating to debug the child after forking (boolean) + @keyparam forkChild flag indicating to debug the child after forking + (boolean) """ self.__autoContinue = autoContinue self.__scriptName = os.path.abspath(fn) @@ -446,8 +461,9 @@ self.__sendCommand('{0}{1}\n'.format( DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format( - DebugProtocol.RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)), - traceInterpreter)) + DebugProtocol.RequestLoad, wd, fn, + str(Utilities.parseOptionString(argv)), + traceInterpreter)) def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False): """ @@ -457,7 +473,8 @@ @param argv the commandline arguments to pass to the program (string) @param wd the working directory for the program (string) @keyparam autoFork flag indicating the automatic fork mode (boolean) - @keyparam forkChild flag indicating to debug the child after forking (boolean) + @keyparam forkChild flag indicating to debug the child after forking + (boolean) """ self.__scriptName = os.path.abspath(fn) @@ -466,7 +483,8 @@ self.__sendCommand('{0}{1}\n'.format( DebugProtocol.RequestForkMode, repr((autoFork, forkChild)))) self.__sendCommand('{0}{1}|{2}|{3}\n'.format( - DebugProtocol.RequestRun, wd, fn, str(Utilities.parseOptionString(argv)))) + DebugProtocol.RequestRun, wd, fn, + str(Utilities.parseOptionString(argv)))) def remoteCoverage(self, fn, argv, wd, erase=False): """ @@ -483,8 +501,8 @@ wd = self.translate(wd, False) fn = self.translate(os.path.abspath(fn), False) self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format( - DebugProtocol.RequestCoverage, wd, fn, str(Utilities.parseOptionString(argv)), - erase)) + DebugProtocol.RequestCoverage, wd, fn, + str(Utilities.parseOptionString(argv)), erase)) def remoteProfile(self, fn, argv, wd, erase=False): """ @@ -493,7 +511,8 @@ @param fn the filename to run (string) @param argv the commandline arguments to pass to the program (string) @param wd the working directory for the program (string) - @keyparam erase flag indicating that timing info should be cleared first (boolean) + @keyparam erase flag indicating that timing info should be cleared + first (boolean) """ self.__scriptName = os.path.abspath(fn) @@ -543,7 +562,8 @@ @param special flag indicating a special continue operation (boolean) """ - self.__sendCommand('{0}{1:d}\n'.format(DebugProtocol.RequestContinue, special)) + self.__sendCommand('{0}{1:d}\n'.format( + DebugProtocol.RequestContinue, special)) def remoteBreakpoint(self, fn, line, set, cond=None, temp=False): """ @@ -557,7 +577,8 @@ """ fn = self.translate(fn, False) self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( - DebugProtocol.RequestBreak, fn, line, temp, set, cond)) + DebugProtocol.RequestBreak, fn, line, temp, set, + cond)) def remoteBreakpointEnable(self, fn, line, enable): """ @@ -565,7 +586,8 @@ @param fn filename the breakpoint belongs to (string) @param line linenumber of the breakpoint (int) - @param enable flag indicating enabling or disabling a breakpoint (boolean) + @param enable flag indicating enabling or disabling a breakpoint + (boolean) """ fn = self.translate(fn, False) self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( @@ -588,7 +610,8 @@ Public method to set or clear a watch expression. @param cond expression of the watch expression (string) - @param set flag indicating setting or resetting a watch expression (boolean) + @param set flag indicating setting or resetting a watch expression + (boolean) @param temp flag indicating a temporary watch expression (boolean) """ # cond is combination of cond and special (s. watch expression viewer) @@ -600,7 +623,8 @@ Public method to enable or disable a watch expression. @param cond expression of the watch expression (string) - @param enable flag indicating enabling or disabling a watch expression (boolean) + @param enable flag indicating enabling or disabling a watch expression + (boolean) """ # cond is combination of cond and special (s. watch expression viewer) self.__sendCommand('{0}{1},{2:d}\n'.format( @@ -608,7 +632,8 @@ def remoteWatchpointIgnore(self, cond, count): """ - Public method to ignore a watch expression the next couple of occurrences. + Public method to ignore a watch expression the next couple of + occurrences. @param cond expression of the watch expression (string) @param count number of occurrences to ignore (int) @@ -637,7 +662,8 @@ @param tid id of the thread (integer) """ - self.__sendCommand('{0}{1:d}\n'.format(DebugProtocol.RequestThreadSet, tid)) + self.__sendCommand('{0}{1:d}\n'.format( + DebugProtocol.RequestThreadSet, tid)) def remoteClientVariables(self, scope, filter, framenr=0): """ @@ -660,7 +686,8 @@ @param framenr framenumber of the variables to retrieve (int) """ self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format( - DebugProtocol.RequestVariable, str(var), framenr, scope, str(filter))) + DebugProtocol.RequestVariable, str(var), framenr, scope, + str(filter))) def remoteClientSetFilter(self, scope, filter): """ @@ -682,11 +709,13 @@ cmd = "on" else: cmd = "off" - self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestCallTrace, cmd)) + self.__sendCommand('{0}{1}\n'.format( + DebugProtocol.RequestCallTrace, cmd)) def remoteEval(self, arg): """ - Public method to evaluate arg in the current context of the debugged program. + Public method to evaluate arg in the current context of the debugged + program. @param arg the arguments to evaluate (string) """ @@ -694,7 +723,8 @@ def remoteExec(self, stmt): """ - Public method to execute stmt in the current context of the debugged program. + Public method to execute stmt in the current context of the debugged + program. @param stmt statement to execute (string) """ @@ -719,7 +749,8 @@ @param text the text to be completed (string) """ - self.__sendCommand("{0}{1}\n".format(DebugProtocol.RequestCompletion, text)) + self.__sendCommand("{0}{1}\n".format( + DebugProtocol.RequestCompletion, text)) def remoteUTPrepare(self, fn, tn, tfn, failed, cov, covname, coverase): """ @@ -729,11 +760,13 @@ @param tn the testname to load (string) @param tfn the test function name to load tests from (string) @param failed list of failed test, if only failed test should be run - (list of strings) - @param cov flag indicating collection of coverage data is requested (boolean) + (list of strings) + @param cov flag indicating collection of coverage data is requested + (boolean) @param covname filename to be used to assemble the coverage caches - filename (string) - @param coverase flag indicating erasure of coverage data is requested (boolean) + filename (string) + @param coverase flag indicating erasure of coverage data is requested + (boolean) """ self.__scriptName = os.path.abspath(fn) @@ -758,7 +791,8 @@ """ Private method to ask the user which branch of a fork to follow. """ - selections = [self.trUtf8("Parent Process"), self.trUtf8("Child process")] + selections = [self.trUtf8("Parent Process"), + self.trUtf8("Child process")] res, ok = QInputDialog.getItem( None, self.trUtf8("Client forking"), @@ -814,8 +848,9 @@ self.__autoContinue = False QTimer.singleShot(0, self.remoteContinue) else: - self.debugServer.signalClientLine(cf[0], int(cf[1]), - resp == DebugProtocol.ResponseStack) + self.debugServer.signalClientLine( + cf[0], int(cf[1]), + resp == DebugProtocol.ResponseStack) self.debugServer.signalClientStack(stack) continue @@ -831,7 +866,8 @@ if resp == DebugProtocol.ResponseThreadList: currentId, threadList = eval(evalArg) - self.debugServer.signalClientThreadList(currentId, threadList) + self.debugServer.signalClientThreadList( + currentId, threadList) continue if resp == DebugProtocol.ResponseThreadSet: @@ -883,7 +919,8 @@ exctype = None excmessage = '' stack = [] - self.debugServer.signalClientException(exctype, excmessage, stack) + self.debugServer.signalClientException( + exctype, excmessage, stack) continue if resp == DebugProtocol.ResponseSyntax: @@ -899,7 +936,8 @@ cn = 0 if cn is None: cn = 0 - self.debugServer.signalClientSyntaxError(message, fn, ln, cn) + self.debugServer.signalClientSyntaxError( + message, fn, ln, cn) continue if resp == DebugProtocol.ResponseExit: @@ -918,7 +956,8 @@ fn, lineno = evalArg.split(',') lineno = int(lineno) fn = self.translate(fn, True) - self.debugServer.signalClientBreakConditionError(fn, lineno) + self.debugServer.signalClientBreakConditionError( + fn, lineno) continue if resp == DebugProtocol.ResponseClearWatch: @@ -936,7 +975,8 @@ if resp == DebugProtocol.ResponseBanner: version, platform, dbgclient = eval(evalArg) - self.debugServer.signalClientBanner(version, platform, dbgclient) + self.debugServer.signalClientBanner( + version, platform, dbgclient) continue if resp == DebugProtocol.ResponseCapabilities: @@ -974,12 +1014,14 @@ if resp == DebugProtocol.ResponseUTTestFailed: testname, traceback, id = eval(evalArg) - self.debugServer.clientUtTestFailed(testname, traceback, id) + self.debugServer.clientUtTestFailed( + testname, traceback, id) continue if resp == DebugProtocol.ResponseUTTestErrored: testname, traceback, id = eval(evalArg) - self.debugServer.clientUtTestErrored(testname, traceback, id) + self.debugServer.clientUtTestErrored( + testname, traceback, id) continue if resp == DebugProtocol.ResponseUTTestSkipped: @@ -989,12 +1031,14 @@ if resp == DebugProtocol.ResponseUTTestFailedExpected: testname, traceback, id = eval(line[eoc:-1]) - self.debugServer.clientUtTestFailedExpected(testname, traceback, id) + self.debugServer.clientUtTestFailedExpected( + testname, traceback, id) continue if resp == DebugProtocol.ResponseUTTestSucceededUnexpected: testname, id = eval(line[eoc:-1]) - self.debugServer.clientUtTestSucceededUnexpected(testname, id) + self.debugServer.clientUtTestSucceededUnexpected( + testname, id) continue if resp == DebugProtocol.ResponseUTFinished: