[Lldb-commits] [PATCH] Fix ValueObject::GetValueDidChange; Improve test for it

Greg Clayton clayborg at gmail.com
Fri Mar 6 13:23:44 PST 2015

I believe the test is flawed. GetValueDidChange() will only work if you have gotten the value and then later ask if it changed. See my inline comments above.

We can document that we GetValueDidChange() is only valid if GetValue() was previously called on a SBValue. So fix the test and remove all other code.

Comment at: source/Core/ValueObjectVariable.cpp:46-60
@@ -42,2 +45,17 @@
+ValueObjectVariable::UpdateValueObjectAndChildren(lldb::ValueObjectSP &valobj_sp)
+    valobj_sp->UpdateValueIfNeeded();
+    if (!valobj_sp->IsPointerOrReferenceType())
+    {
+        const size_t valobj_child_num = valobj_sp->GetNumChildren();
+        for (size_t i = 0; i < valobj_child_num; ++i)
+        {
+            lldb::ValueObjectSP child = valobj_sp->GetChildAtIndex(i, true);
+            UpdateValueObjectAndChildren(child);
+        }
+    }
We can not do this. An array with 1000000 entries will cause this to slow ways down. What if you have:

struct foo
   // Define a very large structure here

struct foo[1000][1000][1000] foo_vector;

Now you single step and we delay for a few minutes when this variable is in your function. 

This can't go in.

Comment at: test/python_api/value_var_update/TestValueVarUpdate.py:55
@@ -54,2 +54,3 @@
         i_val = i.GetValueAsUnsigned(0)
+        c = self.frame().FindVariable("c")
You will need to get the value you want to check for changes before you can ask if it has changed below. Add the following code here:

# Get any values from the SBValue objecst so we can ask them if they changed after a continue
value = i.GetValue()
value = c.GetChildAtIndex(1).GetValue()
value = c.GetChildAtIndex(0).GetChildAtIndex(0).GetValue()



More information about the lldb-commits mailing list