Fix one remaining mach port number/globally unique thread ID mixup which prevented queue names

from being fetched correctly.  <rdar://problem/13290877> 

llvm-svn: 176141
This commit is contained in:
Jason Molenda 2013-02-26 23:58:00 +00:00
parent e528efd734
commit 07c446baf4
3 changed files with 20 additions and 3 deletions

View File

@ -133,11 +133,9 @@ protected:
std::auto_ptr<DNBArchProtocol> m_arch_ap; // Arch specific information for register state and more
const DNBRegisterSetInfo * m_reg_sets; // Register set information for this thread
nub_size_t m_num_reg_sets;
#ifdef THREAD_IDENTIFIER_INFO_COUNT
thread_identifier_info_data_t m_ident_info;
struct proc_threadinfo m_proc_threadinfo;
std::string m_dispatch_queue_name;
#endif
private:
friend class MachThreadList;

View File

@ -73,8 +73,10 @@ MachThreadList::GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInf
bool
MachThreadList::GetIdentifierInfo (nub_thread_t tid, thread_identifier_info_data_t *ident_info)
{
thread_t mach_port_number = GetMachPortNumberByThreadID (tid);
mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
return ::thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t)ident_info, &count) == KERN_SUCCESS;
return ::thread_info (mach_port_number, THREAD_IDENTIFIER_INFO, (thread_info_t)ident_info, &count) == KERN_SUCCESS;
}
void
@ -144,6 +146,22 @@ MachThreadList::GetThreadIDByMachPortNumber (thread_t mach_port_number) const
return INVALID_NUB_THREAD;
}
thread_t
MachThreadList::GetMachPortNumberByThreadID (nub_thread_t globally_unique_id) const
{
PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
MachThreadSP thread_sp;
const size_t num_threads = m_threads.size();
for (size_t idx = 0; idx < num_threads; ++idx)
{
if (m_threads[idx]->ThreadID() == globally_unique_id)
{
return m_threads[idx]->MachPortNumber();
}
}
return 0;
}
bool
MachThreadList::GetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value ) const
{

View File

@ -58,6 +58,7 @@ public:
MachThreadSP GetThreadByMachPortNumber (thread_t mach_port_number) const;
nub_thread_t GetThreadIDByMachPortNumber (thread_t mach_port_number) const;
thread_t GetMachPortNumberByThreadID (nub_thread_t globally_unique_id) const;
protected:
typedef std::vector<MachThreadSP> collection;