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

Ilia K ki.stfu at gmail.com
Fri Mar 6 13:08:38 PST 2015

In http://reviews.llvm.org/D8103#135594, @clayborg wrote:

> I believe this will cause serious performance issues. GetValueDidChange() is not trying to figure out if any children have changed, but if the current SBValue or ValueObject has changed. A structure with 1000000 items doesn't have a value itself, and there is no way we should be checking all 1000000 children and asking them if anything changed.

It seems that we do not understand each other. I don't check children on GetValueDidChange(). As I said in Summary, the GetValueDidChange() checks previous checksum and if it is empty the GetValueDidChange() can't determine whether the value was changed or not. Because of this reason, the -var-update doesn't work even if I recursively check all children using the GetValueDidChange().

**I expanded a test (see changes made in test/python_api/value_var_update) and now it doesn't work without these changes.**

Also this bug happens in the following example:

1. If we consider the following variable:

  struct complex_type {
    struct { int i; } inner;
  } c = { { 1 } };

2. then this will not work (but should):

  c = self.frame().FindVariable("c")
  assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()) # ERROR

3. BUT if I update this child before EvaluateExpression() it will work:

  c = self.frame().FindVariable("c")
  c.GetChildAtIndex(0).GetChildAtIndex(0).GetNumChildren() # It always will return 0, but the main goal of this line is to
                                                           # update the "c.inner.i" VariableObject using the UpdateValueIfNeeded() 
  assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()) # OK

How I should fix it by another way?

In my previous message I supposed that we can create ValueObject::Complete() method to complete it. The Complete() will be called once at the creation of the variable for which we will call GetValueDidChange() in the future. It will help us to fix -var-update and the described test above.



More information about the lldb-commits mailing list