m_send_acks = true;
m_supports_not_sending_acks = eLazyBoolNo;
+ // This is the first real packet that we'll send in a debug session and it may take a little
+ // longer than normal to receive a reply. Wait at least 6 seconds for a reply to this packet.
+
+ const uint32_t minimum_timeout = 6;
+ uint32_t old_timeout = GetPacketTimeoutInMicroSeconds() / lldb_private::TimeValue::MicroSecPerSec;
+ SetPacketTimeout (std::max (old_timeout, minimum_timeout));
+
StringExtractorGDBRemote response;
- if (SendPacketAndWaitForResponse("QStartNoAckMode", response, false) == PacketResult::Success)
+ PacketResult packet_send_result = SendPacketAndWaitForResponse("QStartNoAckMode", response, false);
+ SetPacketTimeout (old_timeout);
+
+ if (packet_send_result == PacketResult::Success)
{
if (response.IsOKResponse())
{
#include <vector>
#include <libproc.h>
+#if defined (__APPLE__)
+#include <pthread.h>
+#include <sched.h>
+#endif
+
#define TRY_KQUEUE 1
#ifdef TRY_KQUEUE
{
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)
{
{
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);
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <unistd.h>
+#include <pthread.h>
#include "MacOSX/CFUtils.h"
#include "SysSignal.h"
MachProcess *proc = (MachProcess*) arg;
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s ( arg = %p ) thread starting...", __FUNCTION__, arg);
+#if defined (__APPLE__)
+ pthread_setname_np ("stdio monitoring thread");
+#endif
+
// We start use a base and more options so we can control if we
// are currently using a timeout on the mach_msg. We do this to get a
// bunch of related exceptions on our exception port so we can process
MachProcess *proc = (MachProcess*) arg;
DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s ( arg = %p ) thread starting...", __FUNCTION__, arg);
+#if defined (__APPLE__)
+ pthread_setname_np ("performance profiling thread");
+#endif
+
while (proc->IsProfilingEnabled())
{
nub_state_t state = proc->GetState();
#include <mach/mach_vm.h>
#import <sys/sysctl.h>
+#if defined (__APPLE__)
+#include <pthread.h>
+#include <sched.h>
+#endif
+
// C++ Includes
#include <iomanip>
#include <sstream>
MachTask::StartExceptionThread(DNBError &err)
{
DNBLogThreadedIf(LOG_EXCEPTIONS, "MachTask::%s ( )", __FUNCTION__);
+
task_t task = TaskPortForProcessID(err);
if (MachTask::IsValid(task))
{
MachProcess *mach_proc = mach_task->Process();
DNBLogThreadedIf(LOG_EXCEPTIONS, "MachTask::%s ( arg = %p ) starting thread...", __FUNCTION__, arg);
+#if defined (__APPLE__)
+ pthread_setname_np ("exception monitoring 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
+
// We keep a count of the number of consecutive exceptions received so
// we know to grab all exceptions without a timeout. We do this to get a
// bunch of related exceptions on our exception port so we can process
#include <sys/stat.h>
#include <sstream>
+#if defined (__APPLE__)
+#include <pthread.h>
+#include <sched.h>
+#endif
+
#include "RNBRemote.h"
#include "DNB.h"
#include "DNBLog.h"
nub_process_t pid = ctx.ProcessID();
DNBLogThreadedIf(LOG_RNB_PROC, "RNBContext::%s (arg=%p, pid=%4.4x): thread starting...", __FUNCTION__, arg, pid);
ctx.Events().SetEvents (RNBContext::event_proc_thread_running);
+
+#if defined (__APPLE__)
+ pthread_setname_np ("child process status watcher 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
+
bool done = false;
while (!done)
{
#include <sys/stat.h>
#include <sys/sysctl.h>
+#if defined (__APPLE__)
+#include <pthread.h>
+#include <sched.h>
+#endif
+
#include "DNB.h"
#include "DNBDataRef.h"
#include "DNBLog.h"
RNBRemoteSP remoteSP(g_remoteSP);
if (remoteSP.get() != NULL)
{
+
+#if defined (__APPLE__)
+ pthread_setname_np ("read gdb-remote packets 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
+
RNBRemote* remote = remoteSP.get();
PThreadEvent& events = remote->Context().Events();
events.SetEvents (RNBContext::event_read_thread_running);
#include <sys/types.h>
#include <crt_externs.h> // for _NSGetEnviron()
+#if defined (__APPLE__)
+#include <sched.h>
+#endif
+
#include "CFString.h"
#include "DNB.h"
#include "DNBLog.h"
{
const char *argv_sub_zero = argv[0]; // save a copy of argv[0] for error reporting post-launch
+#if defined (__APPLE__)
+ pthread_setname_np ("main 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
+
g_isatty = ::isatty (STDIN_FILENO);
// ::printf ("uid=%u euid=%u gid=%u egid=%u\n",