[Lldb-commits] [lldb] r176141 - Fix one remaining mach port number/globally unique thread ID mixup which prevented queue names
Jason Molenda
jmolenda at apple.com
Tue Feb 26 15:58:01 PST 2013
Author: jmolenda
Date: Tue Feb 26 17:58:00 2013
New Revision: 176141
URL: http://llvm.org/viewvc/llvm-project?rev=176141&view=rev
Log:
Fix one remaining mach port number/globally unique thread ID mixup which prevented queue names
from being fetched correctly. <rdar://problem/13290877>
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h?rev=176141&r1=176140&r2=176141&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.h Tue Feb 26 17:58:00 2013
@@ -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;
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=176141&r1=176140&r2=176141&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Tue Feb 26 17:58:00 2013
@@ -73,8 +73,10 @@ MachThreadList::GetThreadStoppedReason(n
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::GetThreadIDByMachPortNum
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
{
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h?rev=176141&r1=176140&r2=176141&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h Tue Feb 26 17:58:00 2013
@@ -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;
More information about the lldb-commits
mailing list