[Lldb-commits] [lldb] [lldb-dap] Added "port" property to vscode "attach" command. (PR #91570)
Santhosh Kumar Ellendula via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 10 10:16:41 PDT 2024
================
@@ -0,0 +1,202 @@
+"""
+Test lldb-dap "port" configuration to "attach" request
+"""
+
+
+import dap_server
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test import lldbplatformutil
+import lldbdap_testcase
+import os
+import shutil
+import subprocess
+import tempfile
+import threading
+import sys
+import socket
+import select
+
+
+# A class representing a pipe for communicating with debug server.
+# This class includes menthods to open the pipe and read the port number from it.
+class Pipe(object):
+ def __init__(self, prefix):
+ self.name = os.path.join(prefix, "stub_port_number")
+ os.mkfifo(self.name)
+ self._fd = os.open(self.name, os.O_RDONLY | os.O_NONBLOCK)
+
+ def finish_connection(self, timeout):
+ pass
+
+ def read(self, size, timeout):
+ (readers, _, _) = select.select([self._fd], [], [], timeout)
+ if self._fd not in readers:
+ raise TimeoutError
+ return os.read(self._fd, size)
+
+ def close(self):
+ os.close(self._fd)
----------------
santhoshe447 wrote:
I apologize for the confusion regarding the "Pipe " class.
There is a conditional declaration of the "Pipe" class, one for windows and another for non-windows host platform. My confusion was whether I should move both of them or not.
Now I have moved both the "Pipe" classes into common location "lldbgdbserverutils.py" and pushed it.
https://github.com/llvm/llvm-project/pull/91570
More information about the lldb-commits
mailing list