forked from OSchip/llvm-project
Remove an assertion that was being hit due to slow DNS name lookups on MacOSX for "localhost".
Changed all "localhost" to "127.0.0.1" to prevent potentially long name lookups. <rdar://problem/16154630> llvm-svn: 202424
This commit is contained in:
parent
fdbad6d5d8
commit
1681092f96
|
@ -423,7 +423,7 @@ PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_i
|
|||
// When remote debugging to iOS, we use a USB mux that always talks
|
||||
// to localhost, so we will need the remote debugserver to accept connections
|
||||
// only from localhost, no matter what our current hostname is
|
||||
port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "localhost");
|
||||
port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "127.0.0.1");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info,
|
|||
// When remote debugging to iOS, we use a USB mux that always talks
|
||||
// to localhost, so we will need the remote debugserver to accept connections
|
||||
// only from localhost, no matter what our current hostname is
|
||||
port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "localhost");
|
||||
port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "127.0.0.1");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -722,19 +722,27 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
|
|||
{
|
||||
// No host and port given, so lets listen on our end and make the debugserver
|
||||
// connect to us..
|
||||
error = StartListenThread ("localhost", 0);
|
||||
error = StartListenThread ("127.0.0.1", 0);
|
||||
if (error.Fail())
|
||||
return error;
|
||||
|
||||
ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection ();
|
||||
out_port = connection->GetBoundPort(3);
|
||||
assert (out_port != 0);
|
||||
char port_cstr[32];
|
||||
snprintf(port_cstr, sizeof(port_cstr), "localhost:%i", out_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);
|
||||
// Wait for 10 seconds to resolve the bound port
|
||||
out_port = connection->GetBoundPort(10);
|
||||
if (out_port > 0)
|
||||
{
|
||||
char port_cstr[32];
|
||||
snprintf(port_cstr, sizeof(port_cstr), "127.0.0.1:%i", out_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);
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString ("failed to bind to port 0 on 127.0.0.1");
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ protected:
|
|||
|
||||
|
||||
lldb_private::Error
|
||||
StartListenThread (const char *hostname = "localhost",
|
||||
StartListenThread (const char *hostname = "127.0.0.1",
|
||||
uint16_t port = 0);
|
||||
|
||||
bool
|
||||
|
|
|
@ -452,7 +452,7 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
|
|||
// to actually have a hostname as far as the remote lldb that is connecting
|
||||
// to this lldb-platform is concerned
|
||||
response.PutCString ("hostname:");
|
||||
response.PutCStringAsRawHex8("localhost");
|
||||
response.PutCStringAsRawHex8("127.0.0.1");
|
||||
response.PutChar(';');
|
||||
#else // #if defined(__arm__)
|
||||
if (Host::GetHostname (s))
|
||||
|
@ -945,7 +945,7 @@ GDBRemoteCommunicationServer::Handle_qLaunchGDBServer (StringExtractorGDBRemote
|
|||
// Spawn a debugserver and try to get the port it listens to.
|
||||
ProcessLaunchInfo debugserver_launch_info;
|
||||
if (hostname.empty())
|
||||
hostname = "localhost";
|
||||
hostname = "127.0.0.1";
|
||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
|
||||
if (log)
|
||||
log->Printf("Launching debugserver with: %s:%u...\n", hostname.c_str(), port);
|
||||
|
|
|
@ -2604,7 +2604,7 @@ ProcessGDBRemote::LaunchAndConnectToDebugserver (const ProcessInfo &process_info
|
|||
|
||||
#if defined (__APPLE__) && defined (__arm__)
|
||||
// On iOS, still do a local connection using a random port
|
||||
const char *hostname = "localhost";
|
||||
const char *hostname = "127.0.0.1";
|
||||
uint16_t port = get_random_port ();
|
||||
#else
|
||||
// Set hostname being NULL to do the reverse connect where debugserver
|
||||
|
|
|
@ -744,7 +744,7 @@ const char *
|
|||
Platform::GetHostname ()
|
||||
{
|
||||
if (IsHost())
|
||||
return "localhost";
|
||||
return "127.0.0.1";
|
||||
|
||||
if (m_name.empty())
|
||||
return NULL;
|
||||
|
|
|
@ -745,7 +745,7 @@ ConnectRemote (RNBRemote *remote,
|
|||
else
|
||||
{
|
||||
if (port != 0)
|
||||
RNBLogSTDOUT ("Listening to port %i for a connection from %s...\n", port, host ? host : "localhost");
|
||||
RNBLogSTDOUT ("Listening to port %i for a connection from %s...\n", port, host ? host : "127.0.0.1");
|
||||
if (unix_socket_name && unix_socket_name[0])
|
||||
{
|
||||
if (remote->Comm().Listen(host, port, PortWasBoundCallbackUnixSocket, unix_socket_name) != rnb_success)
|
||||
|
@ -1266,7 +1266,7 @@ main (int argc, char *argv[])
|
|||
int items_scanned = ::sscanf (argv[0], "%i", &port);
|
||||
if (items_scanned == 1)
|
||||
{
|
||||
host = "localhost";
|
||||
host = "127.0.0.1";
|
||||
DNBLogDebug("host = '%s' port = %i", host.c_str(), port);
|
||||
}
|
||||
else if (argv[0][0] == '/')
|
||||
|
|
Loading…
Reference in New Issue