eric6/DebugClients/Python/DebugClientBase.py

branch
multi_processing
changeset 7372
021f0252afac
parent 7360
9190402e4505
child 7373
d036d72f457c
equal deleted inserted replaced
7371:067f717c5a80 7372:021f0252afac
220 220
221 self.readstream = None 221 self.readstream = None
222 self.writestream = None 222 self.writestream = None
223 self.errorstream = None 223 self.errorstream = None
224 self.pollingDisabled = False 224 self.pollingDisabled = False
225
226 self.__debuggerId = ""
225 227
226 self.callTraceEnabled = None 228 self.callTraceEnabled = None
227 229
228 self.variant = 'You should not see this' 230 self.variant = 'You should not see this'
229 231
1108 self.sendJsonCommand("PassiveStartup", { 1110 self.sendJsonCommand("PassiveStartup", {
1109 "filename": filename, 1111 "filename": filename,
1110 "exceptions": exceptions, 1112 "exceptions": exceptions,
1111 }) 1113 })
1112 1114
1115 def sendDebuggerId(self, debuggerId):
1116 """
1117 Public method to send the debug client id.
1118
1119 @param debuggerId id of this debug client instance (made up of
1120 hostname and process ID)
1121 @type str
1122 """
1123 self.sendJsonCommand("DebuggerId", {
1124 "id": self.__debuggerId,
1125 })
1126
1113 def __clientCapabilities(self): 1127 def __clientCapabilities(self):
1114 """ 1128 """
1115 Private method to determine the clients capabilities. 1129 Private method to determine the clients capabilities.
1116 1130
1117 @return client capabilities (integer) 1131 @return client capabilities (integer)
1271 if remoteAddress is None: 1285 if remoteAddress is None:
1272 remoteAddress = "127.0.0.1" 1286 remoteAddress = "127.0.0.1"
1273 elif "@@i" in remoteAddress: 1287 elif "@@i" in remoteAddress:
1274 remoteAddress = remoteAddress.split("@@i")[0] 1288 remoteAddress = remoteAddress.split("@@i")[0]
1275 sock = socket.create_connection((remoteAddress, port)) 1289 sock = socket.create_connection((remoteAddress, port))
1276 1290
1291 self.__debuggerId = "{0}-{1}".format(socket.gethostname(), os.getpid())
1292
1277 self.readstream = AsyncFile(sock, sys.stdin.mode, sys.stdin.name) 1293 self.readstream = AsyncFile(sock, sys.stdin.mode, sys.stdin.name)
1278 self.writestream = AsyncFile(sock, sys.stdout.mode, sys.stdout.name) 1294 self.writestream = AsyncFile(sock, sys.stdout.mode, sys.stdout.name)
1279 self.errorstream = AsyncFile(sock, sys.stderr.mode, sys.stderr.name) 1295 self.errorstream = AsyncFile(sock, sys.stderr.mode, sys.stderr.name)
1280 1296
1281 if redirect: 1297 if redirect:
1284 sys.stderr = self.errorstream 1300 sys.stderr = self.errorstream
1285 self.redirect = redirect 1301 self.redirect = redirect
1286 1302
1287 # attach to the main thread here 1303 # attach to the main thread here
1288 self.attachThread(mainThread=True) 1304 self.attachThread(mainThread=True)
1305
1306 self.sendDebuggerId(self.__debuggerId)
1289 1307
1290 def __unhandled_exception(self, exctype, excval, exctb): 1308 def __unhandled_exception(self, exctype, excval, exctb):
1291 """ 1309 """
1292 Private method called to report an uncaught exception. 1310 Private method called to report an uncaught exception.
1293 1311

eric ide

mercurial