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

jingham at apple.com jingham at apple.com
Fri Mar 6 13:20:59 PST 2015


The way to understand this is since "value did change" really means "value did change since I last looked at it" you have to ask the question "what constitutes looking at something."   We have made the decision that when you make the value for a struct, you have only looked at the struct, NOT at its children.  It isn't till you poke at the children that you know what their values are - and then whether they change later on.

This is a fairly artificial definition of "when you look at a struct's children" but it is an important one, as Greg said.  If you imagine the Locals view of a debugger, which is going to show the top level view of all the locals, until the user actually chooses to disclose a struct (by some UI gesture that amounts to calling GetNumChildren & GetChildAtIndex) we don't want to pay the cost of realizing all its types, and getting all its potentially many children.

So the answers is that the "failure" you see in #1 is actually by design.  If you want to make the MI -var-update work correctly then when you hand out the variable you should get all the children internally at first.  Then it will behave as you expect it to.  But the fact that until you call GetNumChildren we don't do ANY work to fetch the children is by design, not a bug.

Jim


> On Mar 6, 2015, at 1:08 PM, Ilia K <ki.stfu at gmail.com> wrote:
> 
> 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")
>  self.frame().EvaluateExpression("c.inner.i=3")
>  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() 
>  self.frame().EvaluateExpression("c.inner.i=3")
>  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.
> 
> 
> http://reviews.llvm.org/D8103
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list