summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-08-15 09:17:13 +0000
committerPavel Labath <labath@google.com>2016-08-15 09:17:13 +0000
commitb3d1290c442e65ce06bb0983e3627081580f2551 (patch)
treeacbba797b80f9fa6184d4f95a0a421afe06e8794 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
parent58156715b4038928c87615fcbb2c223e3c33a57f (diff)
downloadbcm5719-llvm-b3d1290c442e65ce06bb0983e3627081580f2551.tar.gz
bcm5719-llvm-b3d1290c442e65ce06bb0983e3627081580f2551.zip
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index d194477b504..efc7cad3ce9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1254,15 +1254,17 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *url,
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
{
OpenPOWER on IntegriCloud