This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [MI] lvalues and variable_editable
On Wednesday 11 July 2007 15:57, Nick Roberts wrote:
> > I think you misunderstand the meaning of varobj_value_is_changeable_p. It
> > does not indicate if the object itself may be changed, by the programming
> > language or by gdb user. It indicates if the value of varobj, as printed by
> > -var-evaluate-expression, may change. As shown above, in current gdb, the
> > value of varobj having type 'function' can change just fine, in a meaningful
> > way.
>
> It shows I misunderstood the concept of the value of a function. I'll
> change that also, which means varobj_editable_p can't be easily derived
> from varobj_changeable_p.
Well, current varobj_changeable_p answers the question "do we need to store
a non-lazy value inside varobj, so that after -var-update we can detect that
the value has changed". It follows that -var-evaluate-expression should print
some static string for such varobjs.
As for editability, two approaches are possible:
1. If static string is printed as value, it makes no sense to assign anything.
In that case, using varobj_changeable_p by varobj_editable_p is reasonable.
2. Why not allow assigning "{1,2}" to a varobj of expression type? That might
be good feature to user, but I'm not sure how hard it will be to implement.
So for now I think we can take (1), and then use varobj_changeable_p from
varobj_editable_p. Should that become problematic, we can always make
the functions completely independent.
- Volodya