Sun, 09 Feb 2020 19:27:49 +0100
Continued with the multiprocess debugger.
--- a/eric6/DebugClients/Python/DebugBase.py Sat Feb 08 17:02:40 2020 +0100 +++ b/eric6/DebugClients/Python/DebugBase.py Sun Feb 09 19:27:49 2020 +0100 @@ -14,7 +14,6 @@ import inspect import ctypes import time -from inspect import CO_GENERATOR from BreakpointWatch import Breakpoint, Watch @@ -345,7 +344,7 @@ # skip the internal StopIteration exception (with no traceback) # triggered by a subiterator run with the 'yield from' # statement. - if not (frame.f_code.co_flags & CO_GENERATOR and + if not (frame.f_code.co_flags & inspect.CO_GENERATOR and arg[0] is StopIteration and arg[2] is None): self.user_exception(arg) # Stop at the StopIteration or GeneratorExit exception when the @@ -353,7 +352,7 @@ # command, or a next/until command at the last statement in the # generator before the exception. elif (self.stopframe and frame is not self.stopframe and - self.stopframe.f_code.co_flags & CO_GENERATOR and + self.stopframe.f_code.co_flags & inspect.CO_GENERATOR and arg[0] in (StopIteration, GeneratorExit)): self.user_exception(arg) return None
--- a/eric6/DebugClients/Python/DebugClientBase.py Sat Feb 08 17:02:40 2020 +0100 +++ b/eric6/DebugClients/Python/DebugClientBase.py Sun Feb 09 19:27:49 2020 +0100 @@ -2013,20 +2013,27 @@ def startDebugger(self, filename=None, host=None, port=None, enableTrace=True, exceptions=True, tracePython=False, - redirect=True): + redirect=True, passive=True): """ Public method used to start the remote debugger. - @param filename the program to be debugged (string) - @param host hostname of the debug server (string) - @param port portnumber of the debug server (int) - @param enableTrace flag to enable the tracing function (boolean) + @param filename the program to be debugged + @type str + @param host hostname of the debug server + @type str + @param port portnumber of the debug server + @type int + @param enableTrace flag to enable the tracing function + @type bool @param exceptions flag to enable exception reporting of the IDE - (boolean) + @type bool @param tracePython flag to enable tracing into the Python library - (boolean) + @type bool @param redirect flag indicating redirection of stdin, stdout and - stderr (boolean) + stderr + @type bool + @param passive flag indicating a passive debugging session + @type bool """ if host is None: host = os.getenv('ERICHOST', 'localhost') @@ -2044,8 +2051,9 @@ self.running = None if self.running: self.__setCoding(self.running) - self.passive = True - self.sendPassiveStartup(self.running, exceptions) + self.passive = passive + if passive: + self.sendPassiveStartup(self.running, exceptions) self.__interact() # setup the debugger variables @@ -2304,6 +2312,13 @@ sys.settrace(None) sys.setprofile(None) self.sessionClose(False) +## (wd, host, port, exceptions, tracePython, redirect, +## noencoding, fork_auto, fork_child) = self.startOptions +## self.startDebugger(sys.argv[0], host, port, +## exceptions=exceptions, +## tracePython=tracePython, +## redirect=redirect, +## passive=False) else: # parent if self.fork_child:
--- a/eric6/Debugger/DebugUI.py Sat Feb 08 17:02:40 2020 +0100 +++ b/eric6/Debugger/DebugUI.py Sun Feb 09 19:27:49 2020 +0100 @@ -2395,3 +2395,12 @@ @rtype str """ return self.debugViewer.getSelectedDebuggerId() + + def setDebugActionsEnabled(self, enable): + """ + Public method to set the enabled state of the debug actions. + + @param enable enable state to be set + @type bool + """ + self.debugActGrp.setEnabled(enable)
--- a/eric6/Debugger/DebugViewer.py Sat Feb 08 17:02:40 2020 +0100 +++ b/eric6/Debugger/DebugViewer.py Sun Feb 09 19:27:49 2020 +0100 @@ -432,7 +432,7 @@ @param debuggerId ID of the debugger backend @type str """ - self.__setDebuggerIcon(debuggerId, "exceptions") + self.__setDebuggerIconAndState(debuggerId, "mediaPlaybackPause", "broken") def __clientSyntaxError(self, message, filename, lineNo, characterNo, debuggerId): @@ -450,7 +450,7 @@ @param debuggerId ID of the debugger backend @type str """ - self.__setDebuggerIcon(debuggerId, "syntaxError22") + self.__setDebuggerIconAndState(debuggerId, "syntaxError22", "exception") def __clientException(self, exceptionType, exceptionMessage, stackTrace, debuggerId): @@ -466,7 +466,7 @@ @param debuggerId ID of the debugger backend @type str """ - self.__setDebuggerIcon(debuggerId, "exceptions") + self.__setDebuggerIconAndState(debuggerId, "exceptions", "exception") def setVariablesFilter(self, globalsFilter, localsFilter): """ @@ -609,11 +609,14 @@ if debugStatus == -1: icon = "mediaPlaybackStart" + state = "running" elif debugStatus == 0: icon = "mediaPlaybackPause" + state = "broken" else: icon = "exceptions" - self.__setDebuggerIcon("", icon) + state = "exception" + self.__setDebuggerIconAndState("", icon, state) def __threadSelected(self, current, previous): """ @@ -653,6 +656,9 @@ self.callStackViewer.clear() self.debugUI.getDebuggerData(debuggerId) + self.debugUI.setDebugActionsEnabled( + self.getSelectedDebuggerState() != "running") + self.__showSource() def showDebuggersList(self, debuggerIds): """ @@ -682,7 +688,16 @@ """ return self.__debuggersCombo.currentText() - def __setDebuggerIcon(self, debuggerId, iconName): + def getSelectedDebuggerState(self): + """ + Public method to get the currently selected debugger's state. + + @return selected debugger's state (running, broken, exception) + @rtype str + """ + return self.__debuggersCombo.currentData() + + def __setDebuggerIconAndState(self, debuggerId, iconName, state): """ Private method to set the icon for a specific debugger ID. @@ -691,6 +706,8 @@ @type str @param iconName name of the icon to be used @type str + @param state state of the debugger (running, broken, exception) + @type str """ if debuggerId: index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly) @@ -699,3 +716,4 @@ if index >= 0: self.__debuggersCombo.setItemIcon( index, UI.PixmapCache.getIcon(iconName)) + self.__debuggersCombo.setItemData(index, state)