Re: Variable objects laziness

Nick Roberts
2006-11-29T04:14:15Z

> > Also -var-update only reports a change when the address changes and not
> > the value. Variable objects were broken before but in a different way
> > (-var-assign worked but -var-update always reported that the reference
> > value had changed).
>
> Just so we're all on the same page, could you post a compilable test
> case? I don't need a dejagnu-ified one, just some C++.

Any C++ program with references (I've never used them in earnest) would do e.g

1: main()
2: {
3: int x = 4;
4: int& rx = x;
5: x = 7;
6: }

1) Do -var-create * - rx before line 4.

2) -var-update --all-values after line 4 picks up the change of address.

3) -var-update --all-values after line 5 doesn't pick up the change of value.

4) -var-assign var1 generates an internal error.

> > I think a further call to coerce_array is needed and the output to -var-update
> > should look like:
> >
> >
> > -var-update --all-values var1
> > ^done,changelist=[{name="var1",value="4",in_scope="true",type_chan ged="false"}]
> >
> > i.e the address shouldn't appear in the value field.
>
> Is that what it did before? I guess it's not surprising.

No, before it would give the address too:

^done,changelist=[{name="var1",value="@0xbff72ebc: 4",in_scope="true",type_chan ged="false"}]

like now, but all the time e.g if you issued -var-update twice without doing
anything in between.

--
Nick http://www.inet.net.nz/~nickrob