[Lldb-commits] [lldb] r138591 - /lldb/trunk/source/Target/ThreadList.cpp

Johnny Chen johnny.chen at apple.com
Thu Aug 25 15:00:00 PDT 2011


Author: johnny
Date: Thu Aug 25 16:59:59 2011
New Revision: 138591

URL: http://llvm.org/viewvc/llvm-project?rev=138591&view=rev
Log:
Modify the impl of ThreadList::GetSelectedThread() so that it tries to fetch the
m_selected_tid thread first, check to see if it is valid (might be null if the
thread just exited), and if not select/return the 0th thread instead.

Modified:
    lldb/trunk/source/Target/ThreadList.cpp

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=138591&r1=138590&r2=138591&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Thu Aug 25 16:59:59 2011
@@ -545,9 +545,13 @@
 ThreadList::GetSelectedThread ()
 {
     Mutex::Locker locker(m_threads_mutex);
-    if (m_selected_tid == LLDB_INVALID_THREAD_ID)
-        SetSelectedThreadByID(m_threads[0]->GetID());
-    return FindThreadByID(m_selected_tid);
+    ThreadSP thread_sp = FindThreadByID(m_selected_tid);
+    if (!thread_sp.get())
+    {
+        m_selected_tid = m_threads[0]->GetID();
+        thread_sp = m_threads[0];
+    }
+    return thread_sp;
 }
 
 bool





More information about the lldb-commits mailing list