[Lldb-commits] [lldb] [lldb][test] Add a function to spawn lldb-server platforms (PR #205083)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 1 02:52:16 PDT 2026


================
@@ -26,29 +25,11 @@ class TestPlatformProcessConnect(TestBase):
     def test_platform_process_connect(self):
         self.build()
 
-        hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0]
-        listen_url = "[%s]:0" % hostname
-
-        port_file = self.getBuildArtifact("port")
-        commandline_args = [
-            "platform",
-            "--listen",
-            listen_url,
-            "--socket-file",
-            port_file,
-            "--",
-            self.getBuildArtifact("a.out"),
-            "foo",
-        ]
-        self.spawnSubprocess(lldbgdbserverutils.get_lldb_server_exe(), commandline_args)
-
-        socket_id = lldbutil.wait_for_file_on_target(self, port_file)
-
-        new_platform = lldb.SBPlatform("remote-" + self.getPlatform())
-        self.dbg.SetSelectedPlatform(new_platform)
-
-        connect_url = "connect://[%s]:%s" % (hostname, socket_id)
-        self.runCmd("platform connect %s" % connect_url)
+        lldbutil.connect_to_new_remote_platform(
+            self,
+            lldbgdbserverutils.get_lldb_server_exe(),
+            extra_args=["--", self.getBuildArtifact("a.out"), "foo"],
----------------
DavidSpickett wrote:

This puts the platform in a mode where when you connect you automatically get a debug server spawned with a.out running.

Which seems like a great idea if you're running the same program over and over, but when I try to "run" again, it fails. Another problem for another time.

https://github.com/llvm/llvm-project/pull/205083


More information about the lldb-commits mailing list