Increase the gdb-remote packet timeout for the first packet we send
to the remote side (QStartNoAckMode) - it may take a little longer
than normal to get a reply.
In debugserver, hardcode the priority for several threads so they
aren't de-prioritized when a user app is using system resources.
Also, set the names of the threads.
<rdar://problem/17509866>
llvm-svn: 213828
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index abd1661..304c655 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -26,6 +26,11 @@
#include <vector>
#include <libproc.h>
+#if defined (__APPLE__)
+#include <pthread.h>
+#include <sched.h>
+#endif
+
#define TRY_KQUEUE 1
#ifdef TRY_KQUEUE
@@ -141,6 +146,19 @@
{
int kq_id = (int) (intptr_t) arg;
+#if defined (__APPLE__)
+ pthread_setname_np ("kqueue thread");
+#if defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
+ struct sched_param thread_param;
+ int thread_sched_policy;
+ if (pthread_getschedparam(pthread_self(), &thread_sched_policy, &thread_param) == 0)
+ {
+ thread_param.sched_priority = 47;
+ pthread_setschedparam(pthread_self(), thread_sched_policy, &thread_param);
+ }
+#endif
+#endif
+
struct kevent death_event;
while (1)
{
@@ -265,6 +283,20 @@
{
const pid_t pid = (pid_t)(intptr_t)arg;
int status;
+
+#if defined (__APPLE__)
+ pthread_setname_np ("waitpid thread");
+#if defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
+ struct sched_param thread_param;
+ int thread_sched_policy;
+ if (pthread_getschedparam(pthread_self(), &thread_sched_policy, &thread_param) == 0)
+ {
+ thread_param.sched_priority = 47;
+ pthread_setschedparam(pthread_self(), thread_sched_policy, &thread_param);
+ }
+#endif
+#endif
+
while (1)
{
pid_t child_pid = waitpid(pid, &status, 0);