[Lldb-commits] [lldb] r124463 - /lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp

Jim Ingham jingham at apple.com
Thu Jan 27 18:21:37 PST 2011


Author: jingham
Date: Thu Jan 27 20:21:37 2011
New Revision: 124463

URL: http://llvm.org/viewvc/llvm-project?rev=124463&view=rev
Log:
The thread_info changes over the life of the thread, so you can't get it once and cache it, you have to fetch it every time you want to use it.

Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=124463&r1=124462&r2=124463&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Thu Jan 27 20:21:37 2011
@@ -672,11 +672,11 @@
 MachThread::GetIdentifierInfo ()
 {
 #ifdef THREAD_IDENTIFIER_INFO_COUNT
-    if (m_ident_info.thread_id == 0)
-    {
+        // Don't try to get the thread info once and cache it for the life of the thread.  It changes over time, for instance
+        // if the thread name changes, then the thread_handle also changes...  So you have to refetch it every time.
         mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
-        return ::thread_info (ThreadID(), THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count) == KERN_SUCCESS;
-    }
+        kern_return_t kret = ::thread_info (ThreadID(), THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count);
+        return kret == KERN_SUCCESS;
 #endif
 
     return false;





More information about the lldb-commits mailing list