diff -r cc920e534ac0 -r 72a72fd56494 eric6/Debugger/DebugUI.py --- a/eric6/Debugger/DebugUI.py Thu Jan 30 19:37:03 2020 +0100 +++ b/eric6/Debugger/DebugUI.py Sat Feb 01 19:48:21 2020 +0100 @@ -10,7 +10,7 @@ import os -from PyQt5.QtCore import pyqtSignal, QObject, Qt +from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import QMenu, QToolBar, QApplication, QDialog @@ -1014,10 +1014,11 @@ self.viewmanager.setFileLine(fn, line) if not forStack: self.__getThreadList() - self.__getClientVariables() + self.__getClientVariables(debuggerId) self.debugActGrp.setEnabled(True) - + + @pyqtSlot(int, str, bool) def __clientExit(self, status, message, quiet): """ Private method to handle the debugged program terminating. @@ -1130,7 +1131,7 @@ .format(filename, message, lineNo, characterNo)) def __clientException(self, exceptionType, exceptionMessage, stackTrace, - debuggerId=""): + debuggerId): """ Private method to handle an exception of the debugged program. @@ -1226,7 +1227,7 @@ for fn, ln, func, args in stackTrace: stack.append((fn, ln, func, args)) self.clientStack.emit(stack, debuggerId) - self.__getClientVariables() + self.__getClientVariables(debuggerId) self.ui.setDebugProfile() self.debugActGrp.setEnabled(True) return @@ -1242,7 +1243,8 @@ else: self.__continue() - def __clientSignal(self, message, filename, lineNo, funcName, funcArgs): + def __clientSignal(self, message, filename, lineNo, funcName, funcArgs, + debuggerId): """ Private method to handle a signal generated on the client side. @@ -1256,6 +1258,8 @@ @type str @param funcArgs function arguments @type str + @param debuggerId ID of the debugger backend + @type str """ self.ui.raise_() self.ui.activateWindow() @@ -1287,15 +1291,19 @@ @param debuggerId ID of the debugger backend @type str """ - self.debugServer.remoteThreadList(debuggerId=debuggerId) + self.debugServer.remoteThreadList(debuggerId) - def __clientThreadSet(self): + def __clientThreadSet(self, debuggerId): """ Private method to handle a change of the client's current thread. + + @param debuggerId ID of the debugger backend + @type str """ - self.debugServer.remoteClientVariables(0, self.localsVarFilter) + self.debugServer.remoteClientVariables( + debuggerId, 0, self.localsVarFilter) - def __getClientVariables(self, debuggerId=""): + def __getClientVariables(self, debuggerId): """ Private method to request the global and local variables. @@ -1307,44 +1315,56 @@ @type str """ # get globals first - self.debugServer.remoteClientVariables(1, self.globalsVarFilter, - debuggerId=debuggerId) + self.debugServer.remoteClientVariables( + debuggerId, 1, self.globalsVarFilter) # the local variables are requested once we have received the globals - def __clientVariables(self, scope, variables): + def __clientVariables(self, scope, variables, debuggerId): """ Private method to write the clients variables to the user interface. @param scope scope of the variables (-1 = empty locals, 1 = global, 0 = local) + @type int @param variables the list of variables from the client + @type list + @param debuggerId ID of the debugger backend + @type str """ - self.ui.activateDebugViewer() - if scope > 0: - self.debugViewer.showVariables(variables, True) - if scope == 1: - # now get the local variables - self.debugServer.remoteClientVariables(0, self.localsVarFilter) - elif scope == 0: - self.debugViewer.showVariables(variables, False) - elif scope == -1: - vlist = [(self.tr('No locals available.'), '', '')] - self.debugViewer.showVariables(vlist, False) + if debuggerId == self.getSelectedDebuggerId(): + self.ui.activateDebugViewer() + if scope > 0: + self.debugViewer.showVariables(variables, True) + if scope == 1: + # now get the local variables + self.debugServer.remoteClientVariables( + self.getSelectedDebuggerId(), + 0, self.localsVarFilter) + elif scope == 0: + self.debugViewer.showVariables(variables, False) + elif scope == -1: + vlist = [(self.tr('No locals available.'), '', '')] + self.debugViewer.showVariables(vlist, False) - def __clientVariable(self, scope, variables): + def __clientVariable(self, scope, variables, debuggerId): """ Private method to write the contents of a clients classvariable to the user interface. - @param scope scope of the variables (-1 = empty global, 1 = global, + @param scope scope of the variables (-1 = empty locals, 1 = global, 0 = local) - @param variables the list of members of a classvariable from the client + @type int + @param variables the list of variables from the client + @type list + @param debuggerId ID of the debugger backend + @type str """ - self.ui.activateDebugViewer() - if scope == 1: - self.debugViewer.showVariable(variables, True) - elif scope == 0: - self.debugViewer.showVariable(variables, False) + if debuggerId == self.getSelectedDebuggerId(): + self.ui.activateDebugViewer() + if scope == 1: + self.debugViewer.showVariable(variables, True) + elif scope == 0: + self.debugViewer.showVariable(variables, False) def __clientBreakConditionError(self, filename, lineno): """ @@ -2259,7 +2279,7 @@ """ self.lastAction = 0 self.__enterRemote() - self.debugServer.remoteContinue() + self.debugServer.remoteContinue(self.getSelectedDebuggerId()) self.__getThreadList() def __specialContinue(self): @@ -2268,7 +2288,7 @@ """ self.lastAction = 2 self.__enterRemote() - self.debugServer.remoteContinue(1) + self.debugServer.remoteContinue(self.getSelectedDebuggerId(), 1) self.__getThreadList() def __step(self): @@ -2277,7 +2297,7 @@ """ self.lastAction = 1 self.__enterRemote() - self.debugServer.remoteStep() + self.debugServer.remoteStep(self.getSelectedDebuggerId()) def __stepOver(self): """ @@ -2285,7 +2305,7 @@ """ self.lastAction = 2 self.__enterRemote() - self.debugServer.remoteStepOver() + self.debugServer.remoteStepOver(self.getSelectedDebuggerId()) self.__getThreadList() def __stepOut(self): @@ -2294,7 +2314,7 @@ """ self.lastAction = 3 self.__enterRemote() - self.debugServer.remoteStepOut() + self.debugServer.remoteStepOut(self.getSelectedDebuggerId()) self.__getThreadList() def __stepQuit(self): @@ -2303,7 +2323,7 @@ """ self.lastAction = 4 self.__enterRemote() - self.debugServer.remoteStepQuit() + self.debugServer.remoteStepQuit(self.getSelectedDebuggerId()) self.__resetUI() def __runToCursor(self): @@ -2315,8 +2335,9 @@ line = aw.getCursorPosition()[0] + 1 self.__enterRemote() self.debugServer.remoteBreakpoint( + self.getSelectedDebuggerId(), aw.getFileName(), line, 1, None, 1) - self.debugServer.remoteContinue() + self.debugServer.remoteContinue(self.getSelectedDebuggerId()) self.__getThreadList() def __moveInstructionPointer(self): @@ -2326,7 +2347,7 @@ self.lastAction = 0 aw = self.viewmanager.activeWindow() line = aw.getCursorPosition()[0] + 1 - self.debugServer.remoteMoveIP(line) + self.debugServer.remoteMoveIP(self.getSelectedDebuggerId(), line) def __enterRemote(self): """ @@ -2359,3 +2380,12 @@ self.debugServer.remoteClientStack(debuggerId) self.__getThreadList(debuggerId) self.__getClientVariables(debuggerId) + + def getSelectedDebuggerId(self): + """ + Public method to get the currently selected debugger ID. + + @return selected debugger ID + @rtype str + """ + return self.debugViewer.getSelectedDebuggerId()