This patch gets remote-linux platform able to run processes

Make sure the selected platform is always used

Make sure that the host uses the connect://hostname to connect to both
the lldb-platform and the lldb-gdbserver rather than what the platform
reports as the hostname of the lldb-gdbserver

Make sure that lldb-platform uses the IP address on it's connection
back to the host instead of the hostname that the host sends to it
when launching lldb-gdbserver with the remote host information

Tested on OSX and Linux

llvm-svn: 226712
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index 2df2ed8..8eb4240 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -45,6 +45,7 @@
 
 // Project includes
 #include "Utility/StringExtractorGDBRemote.h"
+#include "Utility/UriParser.h"
 #include "ProcessGDBRemote.h"
 #include "ProcessGDBRemoteLog.h"
 
@@ -1910,6 +1911,9 @@
         // Spawn a new thread to accept the port that gets bound after
         // binding to port 0 (zero).
 
+        // ignore the hostname send from the remote end, just use the ip address
+        // that we're currently communicating with as the hostname
+
         // Spawn a debugserver and try to get the port it listens to.
         ProcessLaunchInfo debugserver_launch_info;
         if (hostname.empty())
@@ -1919,7 +1923,14 @@
 
         debugserver_launch_info.SetMonitorProcessCallback(ReapDebugserverProcess, this, false);
 
-        Error error = StartDebugserverProcess (hostname.empty() ? NULL : hostname.c_str(),
+        std::string platform_scheme;
+        std::string platform_ip;
+        int platform_port;
+        std::string platform_path;
+        bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme, platform_ip, platform_port, platform_path);
+        assert(ok);
+        Error error = StartDebugserverProcess (
+                                         platform_ip.c_str(),
                                          port,
                                          debugserver_launch_info,
                                          port);