From 3d90292297690de3878cab4fd40f52d102cdc66b Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 7 Mar 2012 22:03:04 +0000 Subject: When comparing a Thread against a ThreadSpec, don't fetch the Thread's Name or QueueName if the ThreadSpec doesn't specify them. llvm-svn: 152245 --- lldb/source/Target/ThreadSpec.cpp | 46 ++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'lldb/source/Target/ThreadSpec.cpp') diff --git a/lldb/source/Target/ThreadSpec.cpp b/lldb/source/Target/ThreadSpec.cpp index 07abf595c8d..fda54546186 100644 --- a/lldb/source/Target/ThreadSpec.cpp +++ b/lldb/source/Target/ThreadSpec.cpp @@ -58,22 +58,58 @@ ThreadSpec::GetQueueName () const } bool -ThreadSpec::ThreadPassesBasicTests (Thread *thread) const +ThreadSpec::TIDMatches (Thread &thread) const +{ + if (m_tid == LLDB_INVALID_THREAD_ID) + return true; + + lldb::tid_t thread_id = thread.GetID(); + return TIDMatches (thread_id); +} +bool +ThreadSpec::IndexMatches (Thread &thread) const +{ + if (m_index == UINT32_MAX) + return true; + uint32_t index = thread.GetIndexID(); + return IndexMatches (index); +} +bool +ThreadSpec::NameMatches (Thread &thread) const +{ + if (m_name.empty()) + return true; + + const char *name = thread.GetName(); + return NameMatches (name); +} +bool +ThreadSpec::QueueNameMatches (Thread &thread) const +{ + if (m_queue_name.empty()) + return true; + + const char *queue_name = thread.GetQueueName(); + return QueueNameMatches (queue_name); +} + +bool +ThreadSpec::ThreadPassesBasicTests (Thread &thread) const { if (!HasSpecification()) return true; - if (!TIDMatches(thread->GetID())) + if (!TIDMatches(thread)) return false; - if (!IndexMatches(thread->GetIndexID())) + if (!IndexMatches(thread)) return false; - if (!NameMatches (thread->GetName())) + if (!NameMatches (thread)) return false; - if (!QueueNameMatches (thread->GetQueueName())) + if (!QueueNameMatches (thread)) return false; return true; -- cgit v1.2.3