From f2c6ccf0431b8fe4abdef29a2485d5ffd608474c Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 28 Jan 2011 02:21:37 +0000 Subject: [PATCH] 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. llvm-svn: 124463 --- lldb/tools/debugserver/source/MacOSX/MachThread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp index e61d2800287e..ca2dca9d91b9 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp @@ -672,11 +672,11 @@ bool 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;