DavidSpickett created this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. DavidSpickett requested review of this revision. Herald added a subscriber: JDevlieghere.
Previously if you did: $ lldb-server platform --server <...> --min-gdbserver-port 12346 --max-gdbserver-port 12347 (meaning only use port 12346 for gdbservers) Then tried to launch two gdbservers on the same connection, the second one would return port 65535. Which is a real port number but it actually means lldb-server didn't find one it was allowed to use. send packet: $qLaunchGDBServer;<...> read packet: $pid:1919;port:12346;#c0 <...> send packet: $qLaunchGDBServer;<...> read packet: $pid:1927;port:65535;#c7 This situation should be an error even if port 65535 does happen to be available on the current machine. Found while investigating: https://bugs.llvm.org/show_bug.cgi?id=48205 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D91634 Files: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -97,6 +97,8 @@ uint16_t &port, std::string &socket_name) { if (port == UINT16_MAX) port = GetNextAvailablePort(); + if (port == UINT16_MAX) + return Status("Could not find an available port to launch a gdbserver."); // Spawn a new thread to accept the port that gets bound after binding to // port 0 (zero).
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -97,6 +97,8 @@ uint16_t &port, std::string &socket_name) { if (port == UINT16_MAX) port = GetNextAvailablePort(); + if (port == UINT16_MAX) + return Status("Could not find an available port to launch a gdbserver."); // Spawn a new thread to accept the port that gets bound after binding to // port 0 (zero).
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits