summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp21
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp9
2 files changed, 5 insertions, 25 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index fbb72baf13e..cb2e1f96f6e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -708,27 +708,6 @@ GDBRemoteCommunicationServer::Handle_qSpeedTest (StringExtractorGDBRemote &packe
return SendErrorResponse (7);
}
-
-static void *
-AcceptPortFromInferior (void *arg)
-{
- const char *connect_url = (const char *)arg;
- ConnectionFileDescriptor file_conn;
- Error error;
- if (file_conn.Connect (connect_url, &error) == eConnectionStatusSuccess)
- {
- char pid_str[256];
- ::memset (pid_str, 0, sizeof(pid_str));
- ConnectionStatus status;
- const size_t pid_str_len = file_conn.Read (pid_str, sizeof(pid_str), 0, status, NULL);
- if (pid_str_len > 0)
- {
- int pid = atoi (pid_str);
- return (void *)(intptr_t)pid;
- }
- }
- return NULL;
-}
//
//static bool
//WaitForProcessToSIGSTOP (const lldb::pid_t pid, const int timeout_in_seconds)
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index bc9163f7f71..4e34a9a09a0 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -166,8 +166,6 @@ namespace {
} // anonymous namespace end
-static bool rand_initialized = false;
-
// TODO Randomly assigning a port is unsafe. We should get an unused
// ephemeral port from the kernel and make sure we reserve it before passing
// it to debugserver.
@@ -180,19 +178,22 @@ static bool rand_initialized = false;
#define HIGH_PORT (49151u)
#endif
+#if defined(__APPLE__) && defined(__arm__)
+static bool rand_initialized = false;
+
static inline uint16_t
get_random_port ()
{
if (!rand_initialized)
{
time_t seed = time(NULL);
-
+
rand_initialized = true;
srand(seed);
}
return (rand() % (HIGH_PORT - LOW_PORT)) + LOW_PORT;
}
-
+#endif
lldb_private::ConstString
ProcessGDBRemote::GetPluginNameStatic()
OpenPOWER on IntegriCloud