eric6/Debugger/DebuggerInterfacePython.py

branch
multi_processing
changeset 7389
770ffcb88be5
parent 7379
72a72fd56494
child 7390
052ce4cf06c6
diff -r 3de001de249c -r 770ffcb88be5 eric6/Debugger/DebuggerInterfacePython.py
--- a/eric6/Debugger/DebuggerInterfacePython.py	Sun Feb 02 12:01:27 2020 +0100
+++ b/eric6/Debugger/DebuggerInterfacePython.py	Sun Feb 02 16:41:40 2020 +0100
@@ -87,26 +87,32 @@
         
         # attribute to remember the name of the executed script
         self.__scriptName = ""
-
+    
     def __identityTranslation(self, fn, remote2local=True):
         """
         Private method to perform the identity path translation.
         
-        @param fn filename to be translated (string)
+        @param fn filename to be translated
+        @type str
         @param remote2local flag indicating the direction of translation
             (False = local to remote, True = remote to local [default])
-        @return translated filename (string)
+        @type bool
+        @return translated filename
+        @rtype str
         """
         return fn
-        
+    
     def __remoteTranslation(self, fn, remote2local=True):
         """
         Private method to perform the path translation.
         
-        @param fn filename to be translated (string)
+        @param fn filename to be translated
+        @type str
         @param remote2local flag indicating the direction of translation
             (False = local to remote, True = remote to local [default])
-        @return translated filename (string)
+        @type bool
+        @return translated filename
+        @rtype str
         """
         if remote2local:
             path = fn.replace(self.translateRemote, self.translateLocal)
@@ -118,7 +124,7 @@
                 path = path.replace("\\", "/")
         
         return path
-        
+    
     def __startProcess(self, program, arguments, environment=None,
                        workingDir=None):
         """
@@ -149,7 +155,7 @@
             proc = None
         
         return proc
-        
+    
     def startRemote(self, port, runInConsole, venvName, originalPathString,
                     workingDir=None):
         """
@@ -324,7 +330,7 @@
             self.__startedVenv = venvName
         
         return process, self.__isNetworked, interpreter
-
+    
     def startRemoteForProject(self, port, runInConsole, venvName,
                               originalPathString, workingDir=None):
         """
@@ -423,7 +429,7 @@
             else:
                 # remote shell command is missing
                 return None, self.__isNetworked, ""
-    
+        
         # set translation function
         self.translate = self.__identityTranslation
         
@@ -492,7 +498,8 @@
         """
         Public method to retrieve the debug clients capabilities.
         
-        @return debug client capabilities (integer)
+        @return debug client capabilities
+        @rtype int
         """
         return self.clientCapabilities
     
@@ -529,7 +536,7 @@
             if self.__master is None:
                 self.__master = debuggerId
                 # Get the remote clients capabilities
-                self.remoteCapabilities()
+                self.remoteCapabilities(debuggerId)
             
             self.debugServer.signalClientDebuggerIds(
                 sorted(self.__connections.keys()))
@@ -602,7 +609,7 @@
         self.queue = []
         
         self.__master = None
-
+    
     def __shutdownSocket(self, sock):
         """
         Private slot to shut down a socket.
@@ -647,16 +654,22 @@
         """
         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 autoFork flag indicating the automatic fork mode (boolean)
-        @keyparam forkChild flag indicating to debug the child after forking
-            (boolean)
+        @param fn the filename to debug
+        @type str
+        @param argv the commandline arguments to pass to the program
+        @type str
+        @param wd the working directory for the program
+        @type str
+        @param traceInterpreter flag indicating if the interpreter library
+            should be traced as well
+        @type bool
+        @param autoContinue flag indicating, that the debugger should not
+            stop at the first executable line
+        @type bool
+        @param autoFork flag indicating the automatic fork mode
+        @type bool
+        @param forkChild flag indicating to debug the child after forking
+        @type bool
         """
         self.__autoContinue = autoContinue
         self.__scriptName = os.path.abspath(fn)
@@ -676,12 +689,16 @@
         """
         Public method to load a new program to run.
         
-        @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 autoFork flag indicating the automatic fork mode (boolean)
-        @keyparam forkChild flag indicating to debug the child after forking
-            (boolean)
+        @param fn the filename to run
+        @type str
+        @param argv the commandline arguments to pass to the program
+        @type str
+        @param wd the working directory for the program
+        @type str
+        @param autoFork flag indicating the automatic fork mode
+        @type bool
+        @param forkChild flag indicating to debug the child after forking
+        @type bool
         """
         self.__scriptName = os.path.abspath(fn)
         
@@ -699,11 +716,15 @@
         """
         Public method to load a new program to collect coverage data.
         
-        @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 coverage info should be
-            cleared first (boolean)
+        @param fn the filename to run
+        @type str
+        @param argv the commandline arguments to pass to the program
+        @type str
+        @param wd the working directory for the program
+        @type str
+        @param erase flag indicating that coverage info should be
+            cleared first
+        @type bool
         """
         self.__scriptName = os.path.abspath(fn)
         
@@ -715,16 +736,20 @@
             "argv": Utilities.parseOptionString(argv),
             "erase": erase,
         }, self.__master)
-
+    
     def remoteProfile(self, fn, argv, wd, erase=False):
         """
         Public method to load a new program to collect profiling data.
         
-        @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)
+        @param fn the filename to run
+        @type str
+        @param argv the commandline arguments to pass to the program
+        @type str
+        @param wd the working directory for the program
+        @type str
+        @param erase flag indicating that timing info should be cleared
+            first
+        @type bool
         """
         self.__scriptName = os.path.abspath(fn)
         
@@ -964,16 +989,18 @@
                 "count": count,
             }, debuggerId)
     
-    # TODO: add debuggerId
-    def remoteRawInput(self, s):
+    def remoteRawInput(self, debuggerId, inputString):
         """
         Public method to send the raw input to the debugged program.
         
-        @param s the raw input (string)
+        @param debuggerId ID of the debugger backend
+        @type str
+        @param inputString the raw input
+        @type str
         """
         self.__sendJsonCommand("RawInput", {
-            "input": s,
-        })
+            "input": inputString,
+        }, debuggerId)
     
     def remoteThreadList(self, debuggerId):
         """
@@ -983,7 +1010,7 @@
         @type str
         """
         self.__sendJsonCommand("RequestThreadList", {}, debuggerId)
-        
+    
     def remoteSetThread(self, debuggerId, tid):
         """
         Public method to request to set the given thread as current thread.
@@ -1059,19 +1086,21 @@
             "maxSize": maxSize,
         }, debuggerId)
     
-    # TODO: add debuggerId
-    def remoteClientSetFilter(self, scope, filterStr):
+    def remoteClientSetFilter(self, debuggerId, scope, filterStr):
         """
         Public method to set a variables filter list.
         
+        @param debuggerId ID of the debugger backend
+        @type str
         @param scope the scope of the variables (0 = local, 1 = global)
+        @type int
         @param filterStr regexp string for variable names to filter out
-            (string)
+        @type str
         """
         self.__sendJsonCommand("RequestSetFilter", {
             "scope": scope,
             "filter": filterStr,
-        })
+        }, debuggerId)
     
     def setCallTraceEnabled(self, debuggerId, on):
         """
@@ -1106,7 +1135,8 @@
         Public slot to get the a list of possible commandline completions
         from the remote client.
         
-        @param text the text to be completed (string)
+        @param text the text to be completed
+        @type str
         """
         self.__sendJsonCommand("RequestCompletion", {
             "text": text,
@@ -1210,26 +1240,30 @@
         """
         self.__sendJsonCommand("RequestUTStop", {})
     
-    def __askForkTo(self):
+    def __askForkTo(self, debuggerId):
         """
         Private method to ask the user which branch of a fork to follow.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
         selections = [self.tr("Parent Process"),
                       self.tr("Child process")]
         res, ok = QInputDialog.getItem(
             None,
             self.tr("Client forking"),
-            self.tr("Select the fork branch to follow."),
+            self.tr("Select the fork branch to follow (Debugger: {0}).")
+            .format(debuggerId),
             selections,
             0, False)
         if not ok or res == selections[0]:
             self.__sendJsonCommand("ResponseForkTo", {
                 "target": "parent",
-            })
+            }, debuggerId)
         else:
             self.__sendJsonCommand("ResponseForkTo", {
                 "target": "child",
-            })
+            }, debuggerId)
     
     def __parseClientLine(self, sock):
         """
@@ -1365,30 +1399,27 @@
         elif method == "ResponseContinue":
             self.debugServer.signalClientStatement(True, params["debuggerId"])
         
-        # TODO: add debuggerId
         elif method == "RequestRaw":
             self.debugServer.signalClientRawInput(
-                params["prompt"], params["echo"])
+                params["prompt"], params["echo"], params["debuggerId"])
         
-        # TODO: add debuggerId
         elif method == "ResponseBPConditionError":
             fn = self.translate(params["filename"], True)
             self.debugServer.signalClientBreakConditionError(
-                fn, params["line"])
+                fn, params["line"], params["debuggerId"])
         
-        # TODO: add debuggerId
         elif method == "ResponseClearBreakpoint":
             fn = self.translate(params["filename"], True)
-            self.debugServer.signalClientClearBreak(fn, params["line"])
+            self.debugServer.signalClientClearBreak(
+                fn, params["line"], params["debuggerId"])
         
-        # TODO: add debuggerId
         elif method == "ResponseWatchConditionError":
             self.debugServer.signalClientWatchConditionError(
-                params["condition"])
+                params["condition"], params["debuggerId"])
         
-        # TODO: add debuggerId
         elif method == "ResponseClearWatch":
-            self.debugServer.signalClientClearWatch(params["condition"])
+            self.debugServer.signalClientClearWatch(
+                params["condition"], params["debuggerId"])
         
         elif method == "ResponseException":
             exctype = params["type"]
@@ -1477,9 +1508,8 @@
             self.debugServer.clientUtTestSucceededUnexpected(
                 params["testname"], params["id"])
         
-        # TODO: add debuggerId
         elif method == "RequestForkTo":
-            self.__askForkTo()
+            self.__askForkTo(params["debuggerId"])
     
     def __sendJsonCommand(self, command, params, debuggerId="", sock=None):
         """

eric ide

mercurial