diff options
author | Greg Clayton <gclayton@apple.com> | 2014-02-27 19:38:18 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-02-27 19:38:18 +0000 |
commit | 1681092f9652b443aa2a355080b76714190579c0 (patch) | |
tree | 59b60aa1d16f37338479324b95d3951ddbf369b9 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | |
parent | fdbad6d5d8d666d71045db94301a18f6cdb858d2 (diff) | |
download | bcm5719-llvm-1681092f9652b443aa2a355080b76714190579c0.tar.gz bcm5719-llvm-1681092f9652b443aa2a355080b76714190579c0.zip |
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 72600d83593..e3bc9f145ea 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -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; + } } |