eric6/Debugger/DebugUI.py

branch
multi_processing
changeset 7411
6d8dcb3551b3
parent 7410
401791e6f50f
child 7415
e953b2a449a9
diff -r 401791e6f50f -r 6d8dcb3551b3 eric6/Debugger/DebugUI.py
--- a/eric6/Debugger/DebugUI.py	Wed Feb 12 20:04:31 2020 +0100
+++ b/eric6/Debugger/DebugUI.py	Thu Feb 13 19:27:10 2020 +0100
@@ -111,6 +111,9 @@
         self.enableMultiprocess = Preferences.toBool(
             Preferences.Prefs.settings.value(
                 'DebugInfo/EnableMultiprocess', False))
+        self.multiprocessNoDebugHistory = Preferences.toList(
+            Preferences.Prefs.settings.value(
+                'DebugInfo/MultiprocessNoDebugHistory'))
         
         self.lastDebuggedFile = None
         self.lastStartAction = 0    # 0=None, 1=Script, 2=Project
@@ -918,6 +921,7 @@
         self.argvHistory = []
         self.wdHistory = []
         self.envHistory = []
+        self.multiprocessNoDebugHistory = []
         
         Preferences.Prefs.settings.setValue(
             'DebugInfo/ArgumentsHistory', self.argvHistory)
@@ -925,6 +929,9 @@
             'DebugInfo/WorkingDirectoryHistory', self.wdHistory)
         Preferences.Prefs.settings.setValue(
             'DebugInfo/EnvironmentHistory', self.envHistory)
+        Preferences.Prefs.settings.setValue(
+            'DebugInfo/MultiprocessNoDebugHistory',
+            self.multiprocessNoDebugHistory)
         
     def shutdown(self):
         """
@@ -961,6 +968,9 @@
             'DebugInfo/ForkIntoChild', self.forkIntoChild)
         Preferences.Prefs.settings.setValue(
             'DebugInfo/EnableMultiprocess', self.enableMultiprocess)
+        Preferences.Prefs.settings.setValue(
+            'DebugInfo/MultiprocessNoDebugHistory',
+            self.multiprocessNoDebugHistory)
         
     def shutdownServer(self):
         """
@@ -1246,11 +1256,11 @@
         
         if self.lastAction != -1:
             if self.lastAction == 2:
-                self.__specialContinue()
+                self.__specialContinue(debuggerId)
             else:
-                self.debugActions[self.lastAction]()
+                self.debugActions[self.lastAction](debuggerId)
         else:
-            self.__continue()
+            self.__continue(debuggerId)
         
     def __clientSignal(self, message, filename, lineNo, funcName, funcArgs,
                        debuggerId):
@@ -1717,8 +1727,9 @@
             self.setArgvHistory("", clearHistories=True)
             self.setWdHistory("", clearHistories=True)
             self.setEnvHistory("", clearHistories=True)
+            self.setMultiprocessNoDebugHistory("", clearHistories=True)
         elif dlg.historiesModified():
-            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            argvHistory, wdHistory, envHistory, _ = dlg.getHistories()
             self.setArgvHistory("", history=argvHistory)
             self.setWdHistory("", history=wdHistory)
             self.setEnvHistory("", history=envHistory)
@@ -1852,8 +1863,9 @@
             self.setArgvHistory("", clearHistories=True)
             self.setWdHistory("", clearHistories=True)
             self.setEnvHistory("", clearHistories=True)
+            self.setMultiprocessNoDebugHistory("", clearHistories=True)
         elif dlg.historiesModified():
-            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            argvHistory, wdHistory, envHistory, _ = dlg.getHistories()
             self.setArgvHistory("", history=argvHistory)
             self.setWdHistory("", history=wdHistory)
             self.setEnvHistory("", history=envHistory)
@@ -1991,8 +2003,9 @@
             self.setArgvHistory("", clearHistories=True)
             self.setWdHistory("", clearHistories=True)
             self.setEnvHistory("", clearHistories=True)
+            self.setMultiprocessNoDebugHistory("", clearHistories=True)
         elif dlg.historiesModified():
-            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            argvHistory, wdHistory, envHistory, _ = dlg.getHistories()
             self.setArgvHistory("", history=argvHistory)
             self.setWdHistory("", history=wdHistory)
             self.setEnvHistory("", history=envHistory)
@@ -2034,12 +2047,14 @@
             tracePython=self.tracePython, autoClearShell=self.autoClearShell,
             autoContinue=self.autoContinue, autoFork=self.forkAutomatically,
             forkChild=self.forkIntoChild,
-            enableMultiprocess=self.enableMultiprocess)
+            enableMultiprocess=self.enableMultiprocess,
+            multiprocessNoDebugHistory=self.multiprocessNoDebugHistory)
         if dlg.exec_() == QDialog.Accepted:
             (lastUsedVenvName, argv, wd, env, exceptions, clearShell,
              console) = dlg.getData()
             (tracePython, autoContinue, forkAutomatically, forkIntoChild,
-             enableMultiprocess) = dlg.getDebugData()
+             enableMultiprocess, multiprocessNoDebug,
+             ) = dlg.getDebugData()
             
             if debugProject:
                 fn = self.project.getMainScript(True)
@@ -2114,8 +2129,9 @@
             self.forkAutomatically = forkAutomatically
             self.forkIntoChild = forkIntoChild
             
-            # Save the multiprocess debugging flag
+            # Save the multiprocess debugging data
             self.enableMultiprocess = enableMultiprocess
+            self.setMultiprocessNoDebugHistory(multiprocessNoDebug)
             
             # Hide all error highlights
             self.viewmanager.unhighlight()
@@ -2143,7 +2159,8 @@
                     runInConsole=console, autoFork=forkAutomatically,
                     forkChild=forkIntoChild, clientType=self.clientType,
                     enableCallTrace=enableCallTrace,
-                    enableMultiprocess=enableMultiprocess)
+                    enableMultiprocess=enableMultiprocess,
+                    multiprocessNoDebug=multiprocessNoDebug)
                 
                 if (
                     self.debugServer.isClientProcessUp() and
@@ -2158,11 +2175,14 @@
             self.setArgvHistory("", clearHistories=True)
             self.setWdHistory("", clearHistories=True)
             self.setEnvHistory("", clearHistories=True)
+            self.setMultiprocessNoDebugHistory("", clearHistories=True)
         elif dlg.historiesModified():
-            argvHistory, wdHistory, envHistory = dlg.getHistories()
+            (argvHistory, wdHistory, envHistory,
+             noDebugHistory) = dlg.getHistories()
             self.setArgvHistory("", history=argvHistory)
             self.setWdHistory("", history=wdHistory)
             self.setEnvHistory("", history=envHistory)
+            self.setMultiprocessNoDebugHistory("", history=noDebugHistory)
     
     def __doRestart(self):
         """
@@ -2216,6 +2236,7 @@
                 enableCallTrace = self.debugViewer.isCallTraceEnabled()
                 self.debugViewer.clearCallTrace()
                 self.debugViewer.setCallTraceToProjectMode(forProject)
+                multiprocessNoDebug = self.multiprocessNoDebugHistory[0]
                 
                 # Ask the client to debug the new program.
                 self.debugServer.remoteLoad(
@@ -2229,7 +2250,8 @@
                     forkChild=self.forkIntoChild,
                     clientType=self.clientType,
                     enableCallTrace=enableCallTrace,
-                    enableMultiprocess=self.enableMultiprocess)
+                    enableMultiprocess=self.enableMultiprocess,
+                    multiprocessNoDebug=multiprocessNoDebug)
                 
                 # Signal that we have started a debugging session
                 self.debuggingStarted.emit(fn)
@@ -2295,59 +2317,101 @@
         # Initialize the call stack viewer
         self.debugViewer.initCallStackViewer(False)
         
-    def __continue(self):
+    def __continue(self, debuggerId=""):
         """
         Private method to handle the Continue action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 0
         self.__enterRemote()
-        self.debugServer.remoteContinue(self.getSelectedDebuggerId())
+        self.debugServer.remoteContinue(debuggerId)
 
-    def __specialContinue(self):
+    def __specialContinue(self, debuggerId=""):
         """
         Private method to handle the Special Continue action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 2
         self.__enterRemote()
-        self.debugServer.remoteContinue(self.getSelectedDebuggerId(), 1)
+        self.debugServer.remoteContinue(debuggerId, 1)
 
-    def __step(self):
+    def __step(self, debuggerId=""):
         """
         Private method to handle the Step action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 1
         self.__enterRemote()
-        self.debugServer.remoteStep(self.getSelectedDebuggerId())
+        self.debugServer.remoteStep(debuggerId)
 
-    def __stepOver(self):
+    def __stepOver(self, debuggerId=""):
         """
         Private method to handle the Step Over action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 2
         self.__enterRemote()
-        self.debugServer.remoteStepOver(self.getSelectedDebuggerId())
+        self.debugServer.remoteStepOver(debuggerId)
 
-    def __stepOut(self):
+    def __stepOut(self, debuggerId=""):
         """
         Private method to handle the Step Out action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 3
         self.__enterRemote()
-        self.debugServer.remoteStepOut(self.getSelectedDebuggerId())
+        self.debugServer.remoteStepOut(debuggerId)
 
-    def __stepQuit(self):
+    def __stepQuit(self, debuggerId=""):
         """
         Private method to handle the Step Quit action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 4
         self.__enterRemote()
-        self.debugServer.remoteStepQuit(self.getSelectedDebuggerId())
+        self.debugServer.remoteStepQuit(debuggerId)
         self.__resetUI()
 
-    def __runToCursor(self):
+    def __runToCursor(self, debuggerId=""):
         """
         Private method to handle the Run to Cursor action.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 0
         aw = self.viewmanager.activeWindow()
         line = aw.getCursorPosition()[0] + 1
@@ -2355,16 +2419,22 @@
         self.debugServer.remoteBreakpoint(
             self.getSelectedDebuggerId(),
             aw.getFileName(), line, 1, None, 1)
-        self.debugServer.remoteContinue(self.getSelectedDebuggerId())
+        self.debugServer.remoteContinue(debuggerId)
 
-    def __moveInstructionPointer(self):
+    def __moveInstructionPointer(self, debuggerId=""):
         """
         Private method to move the instruction pointer to a different line.
+        
+        @param debuggerId ID of the debugger backend
+        @type str
         """
+        if not debuggerId:
+            debuggerId = self.getSelectedDebuggerId()
+        
         self.lastAction = 0
         aw = self.viewmanager.activeWindow()
         line = aw.getCursorPosition()[0] + 1
-        self.debugServer.remoteMoveIP(self.getSelectedDebuggerId(), line)
+        self.debugServer.remoteMoveIP(debuggerId, line)
 
     def __enterRemote(self):
         """
@@ -2415,3 +2485,25 @@
         @type bool
         """
         self.debugActGrp.setEnabled(enable)
+
+    def setMultiprocessNoDebugHistory(self, noDebugList, clearHistories=False,
+                                      history=None):
+        """
+        Public slot to initialize the no debug list history.
+        
+        @param noDebugList whitespace separated list of progframs not to be
+            debugged
+        @type str
+        @param clearHistories flag indicating, that the list should be cleared
+        @type bool
+        @param history list of history entries to be set
+        @type list of str
+        """
+        if clearHistories:
+            del self.multiprocessNoDebugHistory[1:]
+        elif history is not None:
+            self.multiprocessNoDebugHistory = history[:]
+        else:
+            if noDebugList in self.multiprocessNoDebugHistory:
+                self.multiprocessNoDebugHistory.remove(noDebugList)
+            self.multiprocessNoDebugHistory.insert(0, noDebugList)

eric ide

mercurial