Fixup r278524 for non-apple targets
The commit started passing a nullptr port into GDBRemoteCommunication::StartDebugserverProcess.
The function was mostly handling the null value correctly, but it one case it did not check it's
value before assigning to it. Fix that.
llvm-svn: 278662
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index d194477..efc7cad 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1254,15 +1254,17 @@
ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection ();
// Wait for 10 seconds to resolve the bound port
- *port = connection->GetListeningPort(10);
- if (*port > 0)
+ uint16_t port_ = connection->GetListeningPort(10);
+ if (port_ > 0)
{
char port_cstr[32];
- snprintf(port_cstr, sizeof(port_cstr), "127.0.0.1:%i", *port);
+ snprintf(port_cstr, sizeof(port_cstr), "127.0.0.1:%i", port_);
// Send the host and port down that debugserver and specify an option
// so that it connects back to the port we are listening to in this process
debugserver_args.AppendArgument("--reverse-connect");
debugserver_args.AppendArgument(port_cstr);
+ if (port)
+ *port = port_;
}
else
{