================ @@ -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 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits