summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ThreadList.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2015-11-06 22:45:57 +0000
committerJim Ingham <jingham@apple.com>2015-11-06 22:45:57 +0000
commit569aaf9e1a22df61f15ac7840fc8800f8c948de0 (patch)
tree859cd739de22586b97a2af9b349a938eeef005e9 /lldb/source/Target/ThreadList.cpp
parent3b0dfe5a89efa628f280adef658d4b7497401cdf (diff)
downloadbcm5719-llvm-569aaf9e1a22df61f15ac7840fc8800f8c948de0.tar.gz
bcm5719-llvm-569aaf9e1a22df61f15ac7840fc8800f8c948de0.zip
Another optimization to keep down gdb-remote traffic. If we have suspended a thread while
running, don't request the thread status when deciding why we stopped. llvm-svn: 252355
Diffstat (limited to 'lldb/source/Target/ThreadList.cpp')
-rw-r--r--lldb/source/Target/ThreadList.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp
index a342b8ae5f9..c06f7a6ccc4 100644
--- a/lldb/source/Target/ThreadList.cpp
+++ b/lldb/source/Target/ThreadList.cpp
@@ -257,7 +257,20 @@ ThreadList::ShouldStop (Event *event_ptr)
Mutex::Locker locker(GetMutex());
m_process->UpdateThreadListIfNeeded();
- threads_copy = m_threads;
+ for (lldb::ThreadSP thread_sp : m_threads)
+ {
+ // This is an optimization... If we didn't let a thread run in between the previous stop and this
+ // one, we shouldn't have to consult it for ShouldStop. So just leave it off the list we are going to
+ // inspect.
+ if (thread_sp->GetTemporaryResumeState () != eStateSuspended)
+ threads_copy.push_back(thread_sp);
+ }
+
+ // It is possible the threads we were allowing to run all exited and then maybe the user interrupted
+ // or something, then fall back on looking at all threads:
+
+ if (threads_copy.size() == 0)
+ threads_copy = m_threads;
}
collection::iterator pos, end = threads_copy.end();
@@ -265,7 +278,10 @@ ThreadList::ShouldStop (Event *event_ptr)
if (log)
{
log->PutCString("");
- log->Printf ("ThreadList::%s: %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size());
+ log->Printf ("ThreadList::%s: %" PRIu64 " threads, %" PRIu64 " unsuspended threads",
+ __FUNCTION__,
+ (uint64_t)m_threads.size(),
+ (uint64_t)threads_copy.size());
}
bool did_anybody_stop_for_a_reason = false;
OpenPOWER on IntegriCloud