diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/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).