Exemplo n.º 1
0
MachThread::MachThread (MachProcess *process, thread_t tid) :
    m_process (process),
    m_tid (tid),
    m_seq_id (GetSequenceID()),
    m_state (eStateUnloaded),
    m_state_mutex (PTHREAD_MUTEX_RECURSIVE),
    m_break_id (INVALID_NUB_BREAK_ID),
    m_suspend_count (0),
    m_stop_exception (),
    m_arch_ap (DNBArchProtocol::Create (this)),
    m_reg_sets (NULL),
    m_num_reg_sets (0)
#ifdef THREAD_IDENTIFIER_INFO_COUNT
    , m_ident_info(),
    m_proc_threadinfo(),
    m_dispatch_queue_name()
#endif
{
    nub_size_t num_reg_sets = 0;
    m_reg_sets = m_arch_ap->GetRegisterSetInfo (&num_reg_sets);
    m_num_reg_sets = num_reg_sets;

    // Get the thread state so we know if a thread is in a state where we can't
    // muck with it and also so we get the suspend count correct in case it was
    // already suspended
    GetBasicInfo();
    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%4.4x, seq_id = %u )", &m_process, m_tid, m_seq_id);
}
Exemplo n.º 2
0
MachThread::MachThread(MachProcess *process, bool is_64_bit,
                       uint64_t unique_thread_id, thread_t mach_port_num)
    : m_process(process), m_unique_id(unique_thread_id),
      m_mach_port_number(mach_port_num), m_seq_id(GetSequenceID()),
      m_state(eStateUnloaded), m_state_mutex(PTHREAD_MUTEX_RECURSIVE),
      m_suspend_count(0), m_stop_exception(),
      m_arch_ap(DNBArchProtocol::Create(this)), m_reg_sets(NULL),
      m_num_reg_sets(0), m_ident_info(), m_proc_threadinfo(),
      m_dispatch_queue_name(), m_is_64_bit(is_64_bit),
      m_pthread_qos_class_decode(nullptr) {
  nub_size_t num_reg_sets = 0;
  m_reg_sets = m_arch_ap->GetRegisterSetInfo(&num_reg_sets);
  m_num_reg_sets = num_reg_sets;

  m_pthread_qos_class_decode =
      (unsigned int (*)(unsigned long, int *, unsigned long *))dlsym(
          RTLD_DEFAULT, "_pthread_qos_class_decode");

  // Get the thread state so we know if a thread is in a state where we can't
  // muck with it and also so we get the suspend count correct in case it was
  // already suspended
  GetBasicInfo();
  DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE,
                   "MachThread::MachThread ( process = %p, tid = 0x%8.8" PRIx64
                   ", seq_id = %u )",
                   reinterpret_cast<void *>(&m_process), m_unique_id, m_seq_id);
}
Exemplo n.º 3
0
MachThread::MachThread (MachProcess *process, thread_t thread) :
    m_process (process),
    m_tid (thread),
    m_seq_id (GetSequenceID()),
    m_state (eStateUnloaded),
    m_state_mutex (PTHREAD_MUTEX_RECURSIVE),
    m_breakID (INVALID_NUB_BREAK_ID),
    m_suspendCount (0),
    m_arch_ap (DNBArchProtocol::Create (this)),
    m_reg_sets (m_arch_ap->GetRegisterSetInfo (&n_num_reg_sets))
{
    // Get the thread state so we know if a thread is in a state where we can't
    // muck with it and also so we get the suspend count correct in case it was
    // already suspended
    GetBasicInfo();
    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%4.4x, seq_id = %u )", &m_process, m_tid, m_seq_id);
}
Exemplo n.º 4
0
MachThread::MachThread (MachProcess *process, thread_t thread) :
    m_process(process),
    m_tid(thread),
    m_seq_id(GetSequenceID()),
    m_state(eStateUnloaded),
    m_state_mutex(PTHREAD_MUTEX_RECURSIVE),
    m_breakID(INVALID_NUB_BREAK_ID),
    m_suspendCount(0),
    m_arch(this),
    m_regSets()
{
    nub_size_t num_reg_sets = 0;
    const DNBRegisterSetInfo *regSetInfo = m_arch.GetRegisterSetInfo(&num_reg_sets);
    if (num_reg_sets > 0)
        m_regSets.assign(regSetInfo, regSetInfo + num_reg_sets);

    ::memset (&m_basicInfo, 0, sizeof (m_basicInfo));
    DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%4.4x, seq_id = %u )", &m_process, m_tid, m_seq_id);
}