Re: Variable objects laziness

Nick Roberts
2006-11-29T02:08:45Z

With the new changes to varobj.c, -var-assign doesn't work for references.

(gdb)
-var-create - * rx
^done,name="var1",numchild="0",type="int &"

...
(gdb)
-var-update --all-values var1
^done,changelist=[{name="var1",value="@0xbff72ebc: 4",in_scope="true",type_chan ged="false"}]
(gdb)
-var-evaluate-expression var1
^done,value="@0xbff72ebc: 4"
(gdb)
--var-assign var1 8
~"varobj.c:2143: internal-error: c_value_of_variable: Assertion `!value_lazy (v ar->value)' failed.\n"
~"A problem internal to GDB has been detected,\n"
~"further debugging may prove unreliable.\n"
~"Quit this debugging session? (y or n) "
~"\n"

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).

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.

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