This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [MI] lvalues and variable_editable
> - Why do variable_editable_p and varobj_value_is_changeable_p have to
> be different? That is, do we need varobj_value_is_changeable_p to be
> true for any non-lvals. If not, we can eliminate one of them.
Taking my earlier example:
-var-create - * "i1 + i2"
As it's not an lvalue it's not editable (variable_editable_p returns 0)
but it's value can surely change (variable_changeable_p returns 1). So GDB
has to check for this and report any change when -var-update is issued.
While
int m[10]
-var-create - * m
is not editable and not changeable.
Does this show that variable_editable_p and varobj_value_is_changeable_p
are necessarily different? (One is used to tell the user he can't edit the
value, the other to tell GDB not to bother check for a change in value.)
> - Why do you need to re-evaluate the expression? I think we can use
> var->value, and report anything with a NULL value as non-editable.
> No point editing it if we can't save it somewhere.
Perhaps you don't. Currently you can do things like:
(gdb)
-var-create - * 1/0
^done,name="var1",numchild="0",value="",type="int"
(gdb)
-var-create - * 0/0
^done,name="var2",numchild="0",value="",type="int"
I was just being cautious, and cut and pasting.
> Also, I think varobj_value_is_changeable_p was missing from your
> changelog (if I've correctly understood where one hunk of that patch
> goes),
OK.
> and the patch had "variable_editable_pv" in it.
Sticky fingers, sorry about that. My version of varobj.c compiles and doesn't
have this, of course.
--
Nick http://www.inet.net.nz/~nickrob