[Lldb-commits] [lldb] r236769 - Make it so that changing formats on a synthetic value object causes children to be invalidated and refetched when needed

Enrico Granata egranata at apple.com
Thu May 7 13:33:31 PDT 2015


Author: enrico
Date: Thu May  7 15:33:31 2015
New Revision: 236769

URL: http://llvm.org/viewvc/llvm-project?rev=236769&view=rev
Log:
Make it so that changing formats on a synthetic value object causes children to be invalidated and refetched when needed

This is required for supporting vector types formatting


Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
    lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
    lldb/trunk/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=236769&r1=236768&r2=236769&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu May  7 15:33:31 2015
@@ -1133,6 +1133,7 @@ protected:
     friend class ClangExpressionVariable; // For SetName
     friend class Target;                  // For SetName
     friend class ValueObjectConstResultImpl;
+    friend class ValueObjectSynthetic;    // For ClearUserVisibleData
 
     //------------------------------------------------------------------
     // Constructors and Destructors

Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=236769&r1=236768&r2=236769&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Thu May  7 15:33:31 2015
@@ -144,12 +144,7 @@ public:
     SetValueFromCString (const char *value_str, Error& error);
     
     virtual void
-    SetFormat (lldb::Format format)
-    {
-        if (m_parent)
-            m_parent->SetFormat(format);
-        this->ValueObject::SetFormat(format);
-    }
+    SetFormat (lldb::Format format);
     
 protected:
     virtual bool

Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=236769&r1=236768&r2=236769&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Thu May  7 15:33:31 2015
@@ -304,3 +304,15 @@ ValueObjectSynthetic::SetValueFromCStrin
 {
     return m_parent->SetValueFromCString(value_str, error);
 }
+
+void
+ValueObjectSynthetic::SetFormat (lldb::Format format)
+{
+    if (m_parent)
+    {
+        m_parent->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
+        m_parent->SetFormat(format);
+    }
+    this->ValueObject::SetFormat(format);
+    this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
+}

Modified: lldb/trunk/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py?rev=236769&r1=236768&r2=236769&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py Thu May  7 15:33:31 2015
@@ -71,6 +71,15 @@ class VectorTypesFormattingTestCase(Test
         
         self.expect("expr -f int16_t[] -- v", substrs=['[0] = 0', '[1] = 16288', '[2] = 0', '[3] = 16288', '[4] = 0', '[5] = 16416', '[6] = 0', '[7] = 16416'])
         self.expect("expr -f uint128_t[] -- v", substrs=['[0] = 85236745249553456609335044694184296448'])
+        
+        oldValue = v.GetChildAtIndex(0).GetValue()
+        v.SetFormat(lldb.eFormatHex)
+        newValue = v.GetChildAtIndex(0).GetValue()
+        self.assertFalse(oldValue == newValue, "values did not change along with format")
+        
+        v.SetFormat(lldb.eFormatVectorOfFloat32)
+        oldValueAgain = v.GetChildAtIndex(0).GetValue()
+        self.assertTrue(oldValue == oldValueAgain, "same format but different values")
 
 if __name__ == '__main__':
     import atexit





More information about the lldb-commits mailing list