[Lldb-commits] [lldb] [lldb] Removed gdbserver ports map from lldb-server (PR #104238)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 2 12:17:27 PDT 2024


================
@@ -119,20 +175,78 @@ static Status save_socket_id_to_file(const std::string &socket_id,
   return status;
 }
 
+static Status ListenGdbConnectionsIfNeeded(
+    const Socket::SocketProtocol protocol, std::unique_ptr<TCPSocket> &gdb_sock,
+    const std::string &gdb_address, uint16_t &gdbserver_port) {
+  if (protocol != Socket::ProtocolTcp)
+    return Status();
+
+  gdb_sock = std::make_unique<TCPSocket>(
+      /*should_close=*/true, /*child_processes_inherit=*/false);
+  Status error = gdb_sock->Listen(gdb_address, backlog);
+  if (error.Fail())
+    return error;
+
+  if (gdbserver_port == 0)
+    gdbserver_port = gdb_sock->GetLocalPortNumber();
+
+  return Status();
+}
+
+static Status AcceptGdbConnectionsIfNeeded(
----------------
slydiman wrote:

Done.

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


More information about the lldb-commits mailing list