eric6/DebugClients/Python/DebugClientBase.py

branch
multi_processing
changeset 7372
021f0252afac
parent 7360
9190402e4505
child 7373
d036d72f457c
diff -r 067f717c5a80 -r 021f0252afac eric6/DebugClients/Python/DebugClientBase.py
--- a/eric6/DebugClients/Python/DebugClientBase.py	Sun Jan 26 16:00:52 2020 +0100
+++ b/eric6/DebugClients/Python/DebugClientBase.py	Sun Jan 26 19:29:06 2020 +0100
@@ -223,6 +223,8 @@
         self.errorstream = None
         self.pollingDisabled = False
         
+        self.__debuggerId = ""
+        
         self.callTraceEnabled = None
         
         self.variant = 'You should not see this'
@@ -1110,6 +1112,18 @@
             "exceptions": exceptions,
         })
     
+    def sendDebuggerId(self, debuggerId):
+        """
+        Public method to send the debug client id.
+        
+        @param debuggerId id of this debug client instance (made up of
+            hostname and process ID)
+        @type str
+        """
+        self.sendJsonCommand("DebuggerId", {
+            "id": self.__debuggerId,
+        })
+    
     def __clientCapabilities(self):
         """
         Private method to determine the clients capabilities.
@@ -1273,7 +1287,9 @@
         elif "@@i" in remoteAddress:
             remoteAddress = remoteAddress.split("@@i")[0]
         sock = socket.create_connection((remoteAddress, port))
-
+        
+        self.__debuggerId = "{0}-{1}".format(socket.gethostname(), os.getpid())
+        
         self.readstream = AsyncFile(sock, sys.stdin.mode, sys.stdin.name)
         self.writestream = AsyncFile(sock, sys.stdout.mode, sys.stdout.name)
         self.errorstream = AsyncFile(sock, sys.stderr.mode, sys.stderr.name)
@@ -1286,6 +1302,8 @@
         
         # attach to the main thread here
         self.attachThread(mainThread=True)
+        
+        self.sendDebuggerId(self.__debuggerId)
 
     def __unhandled_exception(self, exctype, excval, exctb):
         """

eric ide

mercurial