[Lldb-commits] [lldb] [lldb] Removed gdbserver ports map from lldb-server (PR #104238)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 23 05:31:21 PDT 2024
================
@@ -160,66 +95,56 @@ GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform() =
default;
Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
- const lldb_private::Args &args, std::string hostname, lldb::pid_t &pid,
- std::optional<uint16_t> &port, std::string &socket_name) {
- if (!port) {
- llvm::Expected<uint16_t> available_port = m_port_map.GetNextAvailablePort();
- if (available_port)
- port = *available_port;
- else
- return Status(available_port.takeError());
- }
-
- // Spawn a new thread to accept the port that gets bound after binding to
- // port 0 (zero).
+ const lldb_private::Args &args, lldb::pid_t &pid, std::string &socket_name,
+ shared_fd_t fd) {
+ std::ostringstream url;
+ if (fd == SharedSocket::kInvalidFD) {
+ if (m_socket_protocol == Socket::ProtocolTcp) {
+ // Just check that GDBServer exists. GDBServer must be launched after
+ // accepting the connection.
+ if (!GetDebugserverPath(nullptr))
+ return Status::FromErrorString("unable to locate debugserver");
+ return Status();
----------------
labath wrote:
But do both of those callers need the "optional launch" functionality? AIUI, it's only the Handle_qLaunchGDBServer that does, and the code in lldb-platform.cpp should launch a server unconditionally.
https://github.com/llvm/llvm-project/pull/104238
More information about the lldb-commits
mailing list