[Lldb-commits] [lldb] r237714 - A previous patch made it so that ValueObjects could update themselves even in the face of an invalid execution context (which was required for the dynamic and synthetic values of const objects)

Enrico Granata egranata at apple.com
Tue May 19 11:53:13 PDT 2015


Author: enrico
Date: Tue May 19 13:53:13 2015
New Revision: 237714

URL: http://llvm.org/viewvc/llvm-project?rev=237714&view=rev
Log:
A previous patch made it so that ValueObjects could update themselves even in the face of an invalid execution context (which was required for the dynamic and synthetic values of const objects)

It turns out, child values also need similar provisions

This patch simplifies things a bit allowing ValueObject subclasses to just declare whether they can accept an invalid context at update time, and letting the update machinery in the EvaluationPoint to the rest
Also, this lets ValueObjectChild proclaim that its parent chooses whether such blank-slate updates are possible


Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/include/lldb/Core/ValueObjectChild.h
    lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
    lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
    lldb/trunk/source/Core/ValueObjectChild.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=237714&r1=237713&r2=237714&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue May 19 13:53:13 2015
@@ -858,10 +858,10 @@ public:
         return m_update_point.IsConstant();
     }
     
-    virtual bool
+    bool
     NeedsUpdating ()
     {
-        const bool accept_invalid_exe_ctx = false;
+        const bool accept_invalid_exe_ctx = CanUpdateWithInvalidExecutionContext();
         return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
     }
     
@@ -1137,6 +1137,7 @@ protected:
                         m_did_calculate_complete_objc_class_type:1,
                         m_is_synthetic_children_generated:1;
     
+    friend class ValueObjectChild;
     friend class ClangExpressionDeclMap;  // For GetValue
     friend class ClangExpressionVariable; // For SetName
     friend class Target;                  // For SetName
@@ -1171,6 +1172,12 @@ protected:
     virtual bool
     UpdateValue () = 0;
 
+    virtual bool
+    CanUpdateWithInvalidExecutionContext ()
+    {
+        return false;
+    }
+    
     virtual void
     CalculateDynamicValue (lldb::DynamicValueType use_dynamic);
     

Modified: lldb/trunk/include/lldb/Core/ValueObjectChild.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectChild.h?rev=237714&r1=237713&r2=237714&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectChild.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectChild.h Tue May 19 13:53:13 2015
@@ -83,6 +83,9 @@ public:
 protected:
     virtual bool
     UpdateValue ();
+    
+    virtual bool
+    CanUpdateWithInvalidExecutionContext ();
 
     virtual ClangASTType
     GetClangTypeImpl ()

Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=237714&r1=237713&r2=237714&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Tue May 19 13:53:13 2015
@@ -62,13 +62,6 @@ public:
         return false;
     }
     
-    virtual bool
-    NeedsUpdating ()
-    {
-        const bool accept_invalid_exe_ctx = true;
-        return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
-    }
-    
     virtual ValueObject *
     GetParent()
     {
@@ -116,6 +109,12 @@ protected:
     virtual bool
     UpdateValue ();
     
+    virtual bool
+    CanUpdateWithInvalidExecutionContext ()
+    {
+        return true;
+    }
+    
     virtual lldb::DynamicValueType
     GetDynamicValueTypeImpl ()
     {

Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=237714&r1=237713&r2=237714&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Tue May 19 13:53:13 2015
@@ -145,14 +145,7 @@ public:
     {
         return false;
     }
-    
-    virtual bool
-    NeedsUpdating ()
-    {
-        const bool accept_invalid_exe_ctx = true;
-        return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
-    }
-    
+
     virtual bool
     SetValueFromCString (const char *value_str, Error& error);
     
@@ -163,6 +156,12 @@ protected:
     virtual bool
     UpdateValue ();
     
+    virtual bool
+    CanUpdateWithInvalidExecutionContext ()
+    {
+        return true;
+    }
+    
     virtual ClangASTType
     GetClangTypeImpl ();
     

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=237714&r1=237713&r2=237714&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Tue May 19 13:53:13 2015
@@ -110,6 +110,14 @@ ValueObjectChild::GetDisplayTypeName()
 }
 
 bool
+ValueObjectChild::CanUpdateWithInvalidExecutionContext ()
+{
+    if (m_parent)
+        return m_parent->CanUpdateWithInvalidExecutionContext();
+    return this->ValueObject::CanUpdateWithInvalidExecutionContext();
+}
+
+bool
 ValueObjectChild::UpdateValue ()
 {
     m_error.Clear();





More information about the lldb-commits mailing list