[Lldb-commits] [lldb] r278662 - Fixup r278524 for non-apple targets

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 15 02:17:14 PDT 2016


Author: labath
Date: Mon Aug 15 04:17:13 2016
New Revision: 278662

URL: http://llvm.org/viewvc/llvm-project?rev=278662&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=278662&r1=278661&r2=278662&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Aug 15 04:17:13 2016
@@ -1254,15 +1254,17 @@ GDBRemoteCommunication::StartDebugserver
     
                 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
                 {




More information about the lldb-commits mailing list