eric6/Debugger/DebugServer.py

changeset 8163
29fb6d420a25
parent 8160
d1057f83610e
child 8176
31965986ecd1
child 8218
7c09585bd960
equal deleted inserted replaced
8162:8358c3c95841 8163:29fb6d420a25
482 self.clientType = clType 482 self.clientType = clType
483 Preferences.Prefs.settings.setValue( 483 Preferences.Prefs.settings.setValue(
484 'DebugClient/Type', self.clientType) 484 'DebugClient/Type', self.clientType)
485 485
486 def startClient(self, unplanned=True, clType=None, forProject=False, 486 def startClient(self, unplanned=True, clType=None, forProject=False,
487 runInConsole=False, venvName="", workingDir=None): 487 runInConsole=False, venvName="", workingDir=None,
488 configOverride=None):
488 """ 489 """
489 Public method to start a debug client. 490 Public method to start a debug client.
490 491
491 @param unplanned flag indicating that the client has died 492 @param unplanned flag indicating that the client has died
492 @type bool 493 @type bool
499 @type bool 500 @type bool
500 @param venvName name of the virtual environment to be used 501 @param venvName name of the virtual environment to be used
501 @type str 502 @type str
502 @param workingDir directory to start the debugger client in 503 @param workingDir directory to start the debugger client in
503 @type str 504 @type str
505 @param configOverride dictionary containing the global config override
506 data
507 @type dict
504 """ 508 """
505 self.running = False 509 self.running = False
506 510
507 if not self.passive or not self.passiveClientExited: 511 if not self.passive or not self.passiveClientExited:
508 if self.debuggerInterface and self.debuggerInterface.isConnected(): 512 if self.debuggerInterface and self.debuggerInterface.isConnected():
531 project = e5App().getObject("Project") 535 project = e5App().getObject("Project")
532 if not project.isDebugPropertiesLoaded(): 536 if not project.isDebugPropertiesLoaded():
533 self.clientProcess, isNetworked, clientInterpreter = ( 537 self.clientProcess, isNetworked, clientInterpreter = (
534 self.debuggerInterface.startRemote( 538 self.debuggerInterface.startRemote(
535 self.serverPort(), runInConsole, venvName, 539 self.serverPort(), runInConsole, venvName,
536 self.__originalPathString, workingDir=workingDir)) 540 self.__originalPathString, workingDir=workingDir,
541 configOverride=configOverride))
537 else: 542 else:
538 self.clientProcess, isNetworked, clientInterpreter = ( 543 self.clientProcess, isNetworked, clientInterpreter = (
539 self.debuggerInterface.startRemoteForProject( 544 self.debuggerInterface.startRemoteForProject(
540 self.serverPort(), runInConsole, venvName, 545 self.serverPort(), runInConsole, venvName,
541 self.__originalPathString, workingDir=workingDir)) 546 self.__originalPathString, workingDir=workingDir,
547 configOverride=configOverride))
542 else: 548 else:
543 self.clientProcess, isNetworked, clientInterpreter = ( 549 self.clientProcess, isNetworked, clientInterpreter = (
544 self.debuggerInterface.startRemote( 550 self.debuggerInterface.startRemote(
545 self.serverPort(), runInConsole, venvName, 551 self.serverPort(), runInConsole, venvName,
546 self.__originalPathString, workingDir=workingDir)) 552 self.__originalPathString, workingDir=workingDir,
553 configOverride=configOverride))
547 554
548 if self.clientProcess: 555 if self.clientProcess:
549 self.clientProcess.readyReadStandardError.connect( 556 self.clientProcess.readyReadStandardError.connect(
550 self.__clientProcessError) 557 self.__clientProcessError)
551 self.clientProcess.readyReadStandardOutput.connect( 558 self.clientProcess.readyReadStandardOutput.connect(
931 self.debuggerInterface.remoteEnvironment(envdict) 938 self.debuggerInterface.remoteEnvironment(envdict)
932 939
933 def remoteLoad(self, venvName, fn, argv, wd, env, autoClearShell=True, 940 def remoteLoad(self, venvName, fn, argv, wd, env, autoClearShell=True,
934 tracePython=False, autoContinue=True, forProject=False, 941 tracePython=False, autoContinue=True, forProject=False,
935 runInConsole=False, clientType="", enableCallTrace=False, 942 runInConsole=False, clientType="", enableCallTrace=False,
936 enableMultiprocess=False, multiprocessNoDebug=""): 943 enableMultiprocess=False, multiprocessNoDebug="",
944 configOverride=None):
937 """ 945 """
938 Public method to load a new program to debug. 946 Public method to load a new program to debug.
939 947
940 @param venvName name of the virtual environment to be used 948 @param venvName name of the virtual environment to be used
941 @type str 949 @type str
970 debugging 978 debugging
971 @type bool 979 @type bool
972 @param multiprocessNoDebug space separated list of programs not to be 980 @param multiprocessNoDebug space separated list of programs not to be
973 debugged 981 debugged
974 @type str 982 @type str
983 @param configOverride dictionary containing the global config override
984 data
985 @type dict
975 """ 986 """
976 self.__autoClearShell = autoClearShell 987 self.__autoClearShell = autoClearShell
977 self.__multiprocessNoDebugList = [ 988 self.__multiprocessNoDebugList = [
978 s.strip() for s in multiprocessNoDebug.split(os.pathsep) 989 s.strip() for s in multiprocessNoDebug.split(os.pathsep)
979 ] 990 ]
997 self.__setClientType( 1008 self.__setClientType(
998 self.__findLanguageForExtension(os.path.splitext(fn)[1])) 1009 self.__findLanguageForExtension(os.path.splitext(fn)[1]))
999 except KeyError: 1010 except KeyError:
1000 self.__setClientType('Python3') # assume it is a Python3 file 1011 self.__setClientType('Python3') # assume it is a Python3 file
1001 self.startClient(False, forProject=forProject, 1012 self.startClient(False, forProject=forProject,
1002 runInConsole=runInConsole, venvName=venvName) 1013 runInConsole=runInConsole, venvName=venvName,
1014 configOverride=configOverride)
1003 1015
1004 self.setCallTraceEnabled("", enableCallTrace) 1016 self.setCallTraceEnabled("", enableCallTrace)
1005 self.remoteEnvironment(env) 1017 self.remoteEnvironment(env)
1006 1018
1007 self.debuggerInterface.remoteLoad( 1019 self.debuggerInterface.remoteLoad(
1013 self.__restoreBreakpoints() 1025 self.__restoreBreakpoints()
1014 self.__restoreWatchpoints() 1026 self.__restoreWatchpoints()
1015 self.__restoreNoDebugList() 1027 self.__restoreNoDebugList()
1016 1028
1017 def remoteRun(self, venvName, fn, argv, wd, env, autoClearShell=True, 1029 def remoteRun(self, venvName, fn, argv, wd, env, autoClearShell=True,
1018 forProject=False, runInConsole=False, clientType=""): 1030 forProject=False, runInConsole=False, clientType="",
1031 configOverride=None):
1019 """ 1032 """
1020 Public method to load a new program to run. 1033 Public method to load a new program to run.
1021 1034
1022 @param venvName name of the virtual environment to be used 1035 @param venvName name of the virtual environment to be used
1023 @type str 1036 @type str
1037 @param runInConsole flag indicating to start the debugger in a 1050 @param runInConsole flag indicating to start the debugger in a
1038 console window 1051 console window
1039 @type bool 1052 @type bool
1040 @param clientType client type to be used 1053 @param clientType client type to be used
1041 @type str 1054 @type str
1055 @param configOverride dictionary containing the global config override
1056 data
1057 @type dict
1042 """ 1058 """
1043 self.__autoClearShell = autoClearShell 1059 self.__autoClearShell = autoClearShell
1044 1060
1045 if clientType not in self.getSupportedLanguages(): 1061 if clientType not in self.getSupportedLanguages():
1046 E5MessageBox.critical( 1062 E5MessageBox.critical(
1061 self.__setClientType( 1077 self.__setClientType(
1062 self.__findLanguageForExtension(os.path.splitext(fn)[1])) 1078 self.__findLanguageForExtension(os.path.splitext(fn)[1]))
1063 except KeyError: 1079 except KeyError:
1064 self.__setClientType('Python3') # assume it is a Python3 file 1080 self.__setClientType('Python3') # assume it is a Python3 file
1065 self.startClient(False, forProject=forProject, 1081 self.startClient(False, forProject=forProject,
1066 runInConsole=runInConsole, venvName=venvName) 1082 runInConsole=runInConsole, venvName=venvName,
1083 configOverride=configOverride)
1067 1084
1068 self.remoteEnvironment(env) 1085 self.remoteEnvironment(env)
1069 1086
1070 self.debuggerInterface.remoteRun(fn, argv, wd) 1087 self.debuggerInterface.remoteRun(fn, argv, wd)
1071 self.debugging = False 1088 self.debugging = False
1072 self.running = True 1089 self.running = True
1073 1090
1074 def remoteCoverage(self, venvName, fn, argv, wd, env, 1091 def remoteCoverage(self, venvName, fn, argv, wd, env,
1075 autoClearShell=True, erase=False, forProject=False, 1092 autoClearShell=True, erase=False, forProject=False,
1076 runInConsole=False, clientType=""): 1093 runInConsole=False, clientType="", configOverride=None):
1077 """ 1094 """
1078 Public method to load a new program to collect coverage data. 1095 Public method to load a new program to collect coverage data.
1079 1096
1080 @param venvName name of the virtual environment to be used 1097 @param venvName name of the virtual environment to be used
1081 @type str 1098 @type str
1098 @param runInConsole flag indicating to start the debugger in a 1115 @param runInConsole flag indicating to start the debugger in a
1099 console window 1116 console window
1100 @type bool 1117 @type bool
1101 @param clientType client type to be used 1118 @param clientType client type to be used
1102 @type str 1119 @type str
1120 @param configOverride dictionary containing the global config override
1121 data
1122 @type dict
1103 """ 1123 """
1104 self.__autoClearShell = autoClearShell 1124 self.__autoClearShell = autoClearShell
1105 1125
1106 if clientType not in self.getSupportedLanguages(): 1126 if clientType not in self.getSupportedLanguages():
1107 # a not supported client language was requested 1127 # a not supported client language was requested
1122 self.__setClientType( 1142 self.__setClientType(
1123 self.__findLanguageForExtension(os.path.splitext(fn)[1])) 1143 self.__findLanguageForExtension(os.path.splitext(fn)[1]))
1124 except KeyError: 1144 except KeyError:
1125 self.__setClientType('Python3') # assume it is a Python3 file 1145 self.__setClientType('Python3') # assume it is a Python3 file
1126 self.startClient(False, forProject=forProject, 1146 self.startClient(False, forProject=forProject,
1127 runInConsole=runInConsole, venvName=venvName) 1147 runInConsole=runInConsole, venvName=venvName,
1148 configOverride=configOverride)
1128 1149
1129 self.remoteEnvironment(env) 1150 self.remoteEnvironment(env)
1130 1151
1131 self.debuggerInterface.remoteCoverage(fn, argv, wd, erase) 1152 self.debuggerInterface.remoteCoverage(fn, argv, wd, erase)
1132 self.debugging = False 1153 self.debugging = False
1133 self.running = True 1154 self.running = True
1134 1155
1135 def remoteProfile(self, venvName, fn, argv, wd, env, 1156 def remoteProfile(self, venvName, fn, argv, wd, env,
1136 autoClearShell=True, erase=False, forProject=False, 1157 autoClearShell=True, erase=False, forProject=False,
1137 runInConsole=False, clientType=""): 1158 runInConsole=False, clientType="", configOverride=None):
1138 """ 1159 """
1139 Public method to load a new program to collect profiling data. 1160 Public method to load a new program to collect profiling data.
1140 1161
1141 @param venvName name of the virtual environment to be used 1162 @param venvName name of the virtual environment to be used
1142 @type str 1163 @type str
1159 @param runInConsole flag indicating to start the debugger in a 1180 @param runInConsole flag indicating to start the debugger in a
1160 console window 1181 console window
1161 @type bool 1182 @type bool
1162 @param clientType client type to be used 1183 @param clientType client type to be used
1163 @type str 1184 @type str
1185 @param configOverride dictionary containing the global config override
1186 data
1187 @type dict
1164 """ 1188 """
1165 self.__autoClearShell = autoClearShell 1189 self.__autoClearShell = autoClearShell
1166 1190
1167 if clientType not in self.getSupportedLanguages(): 1191 if clientType not in self.getSupportedLanguages():
1168 # a not supported client language was requested 1192 # a not supported client language was requested
1183 self.__setClientType( 1207 self.__setClientType(
1184 self.__findLanguageForExtension(os.path.splitext(fn)[1])) 1208 self.__findLanguageForExtension(os.path.splitext(fn)[1]))
1185 except KeyError: 1209 except KeyError:
1186 self.__setClientType('Python3') # assume it is a Python3 file 1210 self.__setClientType('Python3') # assume it is a Python3 file
1187 self.startClient(False, forProject=forProject, 1211 self.startClient(False, forProject=forProject,
1188 runInConsole=runInConsole, venvName=venvName) 1212 runInConsole=runInConsole, venvName=venvName,
1213 configOverride=configOverride)
1189 1214
1190 self.remoteEnvironment(env) 1215 self.remoteEnvironment(env)
1191 1216
1192 self.debuggerInterface.remoteProfile(fn, argv, wd, erase) 1217 self.debuggerInterface.remoteProfile(fn, argv, wd, erase)
1193 self.debugging = False 1218 self.debugging = False

eric ide

mercurial