[Lldb-commits] [lldb] r243367 - Second attempt at the fix for the recursion in ValueObjectChild::CanUpdateWithInvalidExecutionContext()

Enrico Granata egranata at apple.com
Mon Jul 27 18:45:23 PDT 2015


Author: enrico
Date: Mon Jul 27 20:45:23 2015
New Revision: 243367

URL: http://llvm.org/viewvc/llvm-project?rev=243367&view=rev
Log:
Second attempt at the fix for the recursion in ValueObjectChild::CanUpdateWithInvalidExecutionContext()

This one should prevent the previous issues, and be the one true fix for rdar://21949558


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=243367&r1=243366&r2=243367&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Mon Jul 27 20:45:23 2015
@@ -861,7 +861,7 @@ public:
     bool
     NeedsUpdating ()
     {
-        const bool accept_invalid_exe_ctx = CanUpdateWithInvalidExecutionContext();
+        const bool accept_invalid_exe_ctx = (CanUpdateWithInvalidExecutionContext() == eLazyBoolYes);
         return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
     }
     
@@ -1172,10 +1172,10 @@ protected:
     virtual bool
     UpdateValue () = 0;
 
-    virtual bool
+    virtual LazyBool
     CanUpdateWithInvalidExecutionContext ()
     {
-        return false;
+        return eLazyBoolCalculate;
     }
     
     virtual void

Modified: lldb/trunk/include/lldb/Core/ValueObjectChild.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectChild.h?rev=243367&r1=243366&r2=243367&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectChild.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectChild.h Mon Jul 27 20:45:23 2015
@@ -16,6 +16,8 @@
 // Project includes
 #include "lldb/Core/ValueObject.h"
 
+#include "llvm/ADT/Optional.h"
+
 namespace lldb_private {
 
 //----------------------------------------------------------------------
@@ -84,7 +86,7 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual bool
+    virtual LazyBool
     CanUpdateWithInvalidExecutionContext ();
 
     virtual ClangASTType
@@ -101,6 +103,7 @@ protected:
     uint8_t m_bitfield_bit_offset;
     bool m_is_base_class;
     bool m_is_deref_of_parent;
+    llvm::Optional<LazyBool> m_can_update_with_invalid_exe_ctx;
 
 //
 //  void

Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=243367&r1=243366&r2=243367&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Mon Jul 27 20:45:23 2015
@@ -109,10 +109,10 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual bool
+    virtual LazyBool
     CanUpdateWithInvalidExecutionContext ()
     {
-        return true;
+        return eLazyBoolYes;
     }
     
     virtual lldb::DynamicValueType

Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=243367&r1=243366&r2=243367&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Mon Jul 27 20:45:23 2015
@@ -156,10 +156,10 @@ protected:
     virtual bool
     UpdateValue ();
     
-    virtual bool
+    virtual LazyBool
     CanUpdateWithInvalidExecutionContext ()
     {
-        return true;
+        return eLazyBoolYes;
     }
     
     virtual ClangASTType

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=243367&r1=243366&r2=243367&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Mon Jul 27 20:45:23 2015
@@ -44,7 +44,8 @@ ValueObjectChild::ValueObjectChild
     m_bitfield_bit_size (bitfield_bit_size),
     m_bitfield_bit_offset (bitfield_bit_offset),
     m_is_base_class (is_base_class),
-    m_is_deref_of_parent (is_deref_of_parent)
+    m_is_deref_of_parent (is_deref_of_parent),
+    m_can_update_with_invalid_exe_ctx()
 {
     m_name = name;
     SetAddressTypeOfChildren(child_ptr_or_ref_addr_type);
@@ -109,12 +110,20 @@ ValueObjectChild::GetDisplayTypeName()
     return display_name;
 }
 
-bool
+LazyBool
 ValueObjectChild::CanUpdateWithInvalidExecutionContext ()
 {
+    if (m_can_update_with_invalid_exe_ctx.hasValue())
+        return m_can_update_with_invalid_exe_ctx.getValue();
     if (m_parent)
-        return m_parent->CanUpdateWithInvalidExecutionContext();
-    return this->ValueObject::CanUpdateWithInvalidExecutionContext();
+    {
+        ValueObject *opinionated_parent = m_parent->FollowParentChain([] (ValueObject* valobj) -> bool {
+            return (valobj->CanUpdateWithInvalidExecutionContext() == eLazyBoolCalculate);
+        });
+        if (opinionated_parent)
+            return (m_can_update_with_invalid_exe_ctx = opinionated_parent->CanUpdateWithInvalidExecutionContext()).getValue();
+    }
+    return (m_can_update_with_invalid_exe_ctx = this->ValueObject::CanUpdateWithInvalidExecutionContext()).getValue();
 }
 
 bool





More information about the lldb-commits mailing list