summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ThreadList.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-08-25 21:59:59 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-08-25 21:59:59 +0000
commit943ddb730bc81dd7cfc3ade33aea46261df9fd1b (patch)
treea7c38ca91a5f87f2e40d212ef72e083d71cf3641 /lldb/source/Target/ThreadList.cpp
parent689053770b636c68c1534abb4cd619958601ca15 (diff)
downloadbcm5719-llvm-943ddb730bc81dd7cfc3ade33aea46261df9fd1b.tar.gz
bcm5719-llvm-943ddb730bc81dd7cfc3ade33aea46261df9fd1b.zip
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. llvm-svn: 138591
Diffstat (limited to 'lldb/source/Target/ThreadList.cpp')
-rw-r--r--lldb/source/Target/ThreadList.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp
index 2b5a10d8c15..79df0f2184e 100644
--- a/lldb/source/Target/ThreadList.cpp
+++ b/lldb/source/Target/ThreadList.cpp
@@ -545,9 +545,13 @@ ThreadSP
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
OpenPOWER on IntegriCloud