[Lldb-commits] [lldb] r152245 - in /lldb/trunk: include/lldb/Target/ThreadSpec.h source/Target/Target.cpp source/Target/Thread.cpp source/Target/ThreadSpec.cpp

Jim Ingham jingham at apple.com
Wed Mar 7 14:03:05 PST 2012


Author: jingham
Date: Wed Mar  7 16:03:04 2012
New Revision: 152245

URL: http://llvm.org/viewvc/llvm-project?rev=152245&view=rev
Log:
When comparing a Thread against a ThreadSpec, don't fetch the Thread's Name or QueueName if the ThreadSpec doesn't specify them.

Modified:
    lldb/trunk/include/lldb/Target/ThreadSpec.h
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadSpec.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadSpec.h?rev=152245&r1=152244&r2=152245&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadSpec.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadSpec.h Wed Mar  7 16:03:04 2012
@@ -89,6 +89,9 @@
         else
             return thread_id == m_tid;
     }
+        
+    bool
+    TIDMatches (Thread &thread) const;
     
     bool 
     IndexMatches (uint32_t index) const
@@ -100,6 +103,9 @@
     }
     
     bool 
+    IndexMatches (Thread &thread) const;
+    
+    bool 
     NameMatches (const char *name) const
     {
         if (m_name.empty())
@@ -111,6 +117,9 @@
     }
     
     bool 
+    NameMatches (Thread &thread) const;
+    
+    bool 
     QueueNameMatches (const char *queue_name) const
     {
         if (m_queue_name.empty())
@@ -121,8 +130,11 @@
             return m_queue_name == queue_name;
     }
     
+    bool 
+    QueueNameMatches (Thread &thread) const;
+    
     bool
-    ThreadPassesBasicTests (Thread *thread) const;
+    ThreadPassesBasicTests (Thread &thread) const;
     
     bool
     HasSpecification () const;

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=152245&r1=152244&r2=152245&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Mar  7 16:03:04 2012
@@ -1902,7 +1902,7 @@
             if ((cur_hook_sp->GetSpecifier () == NULL 
                   || cur_hook_sp->GetSpecifier()->SymbolContextMatches(sym_ctx_with_reasons[i]))
                 && (cur_hook_sp->GetThreadSpecifier() == NULL
-                    || cur_hook_sp->GetThreadSpecifier()->ThreadPassesBasicTests(exc_ctx_with_reasons[i].GetThreadPtr())))
+                    || cur_hook_sp->GetThreadSpecifier()->ThreadPassesBasicTests(exc_ctx_with_reasons[i].GetThreadRef())))
             {
                 if (!hooks_ran)
                 {

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=152245&r1=152244&r2=152245&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Wed Mar  7 16:03:04 2012
@@ -542,7 +542,7 @@
     if (spec == NULL)
         return true;
         
-    return spec->ThreadPassesBasicTests(this);    
+    return spec->ThreadPassesBasicTests(*this);
 }
 
 void

Modified: lldb/trunk/source/Target/ThreadSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadSpec.cpp?rev=152245&r1=152244&r2=152245&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadSpec.cpp (original)
+++ lldb/trunk/source/Target/ThreadSpec.cpp Wed Mar  7 16:03:04 2012
@@ -58,22 +58,58 @@
 }
 
 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;





More information about the lldb-commits mailing list