[Lldb-commits] [lldb] r134081 - /lldb/trunk/source/API/SBValue.cpp

Greg Clayton gclayton at apple.com
Wed Jun 29 11:28:50 PDT 2011


Author: gclayton
Date: Wed Jun 29 13:28:50 2011
New Revision: 134081

URL: http://llvm.org/viewvc/llvm-project?rev=134081&view=rev
Log:
Fixed an issue that was checked in with the dynamic types and update point
changes that caused all SBValue objects to completely ignore the target
lock due to bad C++ scoping of the target Mutex::Locker variables.


Modified:
    lldb/trunk/source/API/SBValue.cpp

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=134081&r1=134080&r2=134081&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Wed Jun 29 13:28:50 2011
@@ -149,8 +149,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        result = m_opaque_sp->IsInScope ();
+            result = m_opaque_sp->IsInScope ();
+        }
     }
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -173,8 +175,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        cstr = m_opaque_sp->GetValueAsCString ();
+            cstr = m_opaque_sp->GetValueAsCString ();
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -226,8 +230,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        cstr = m_opaque_sp->GetObjectDescription ();
+            cstr = m_opaque_sp->GetObjectDescription ();
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -253,8 +259,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        result = m_opaque_sp->GetValueDidChange ();
+            result = m_opaque_sp->GetValueDidChange ();
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -276,8 +284,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        cstr = m_opaque_sp->GetSummaryAsCString();
+            cstr = m_opaque_sp->GetSummaryAsCString();
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -303,8 +313,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        cstr = m_opaque_sp->GetLocationAsCString();
+            cstr = m_opaque_sp->GetLocationAsCString();
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -330,8 +342,10 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        success = m_opaque_sp->SetValueFromCString (value_str);
+            success = m_opaque_sp->SetValueFromCString (value_str);
+        }
     }
     return success;
 }
@@ -351,16 +365,18 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
         
-        child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
-        if (use_dynamic != lldb::eNoDynamicValues)
-        {
-            if (child_sp)
+            child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
+            if (use_dynamic != lldb::eNoDynamicValues)
             {
-                lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic);
-                if (dynamic_sp)
-                    child_sp = dynamic_sp;
+                if (child_sp)
+                {
+                    lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic);
+                    if (dynamic_sp)
+                        child_sp = dynamic_sp;
+                }
             }
         }
     }
@@ -380,9 +396,11 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
         
-        idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
+            idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -412,15 +430,17 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
-            Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
-        child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
-        if (use_dynamic_value != lldb::eNoDynamicValues)
         {
-            if (child_sp)
+            Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+            child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
+            if (use_dynamic_value != lldb::eNoDynamicValues)
             {
-                lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value);
-                if (dynamic_sp)
-                    child_sp = dynamic_sp;
+                if (child_sp)
+                {
+                    lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value);
+                    if (dynamic_sp)
+                        child_sp = dynamic_sp;
+                }
             }
         }
     }
@@ -443,9 +463,11 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
 
-        num_children = m_opaque_sp->GetNumChildren();
+            num_children = m_opaque_sp->GetNumChildren();
+        }
     }
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -463,10 +485,12 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
 
-        Error error;
-        sb_value = m_opaque_sp->Dereference (error);
+            Error error;
+            sb_value = m_opaque_sp->Dereference (error);
+        }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
@@ -483,9 +507,11 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
 
-        is_ptr_type = m_opaque_sp->IsPointerType();
+            is_ptr_type = m_opaque_sp->IsPointerType();
+        }
     }
 
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -502,9 +528,11 @@
     if (m_opaque_sp)
     {
         if (m_opaque_sp->GetUpdatePoint().GetTarget())
+        {
             Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
 
-        return m_opaque_sp->GetClangType();
+            return m_opaque_sp->GetClangType();
+        }
     }
     return NULL;
 }





More information about the lldb-commits mailing list