This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [Patch] -var-evaluate-expression NAME [FORMAT]
> My patch no longer works with the patch Vladimir applied
> http://sourceware.org/ml/gdb/2008-02/msg00006.html
> The reason is that Vladimir's patch has c_value_of_variable()
> always use the stored print_value which is formatted based on the
> current display format (and not the one specified as an option
> to -var-evaluate-expression.) I think that is a good way to do it.
>
> One solution is to revert c_value_of_variable:
> - return xstrdup (var->print_value);
> + return value_get_print_value (var->value, var->format);
>
> Although this is very easy, personally, I don't like that too much.
>
> Another option is to not only temporarily set var->format
> but also var->print_value (by calling varobj_set_display_format).
> I like this even less.
>
> I think a solution based on
> http://sourceware.org/ml/gdb-patches/2008-01/msg00531.html
> is probably the cleanest. Can I have an educated opinion on
> this decision?
This also uses value_get_print_value in c_value_of_variable. I can't seem
to apply your earlier patch as I get spurious characters when I save it
(= -> =3D, \n -> =20\n, etc) but I wonder if we've made things too complicated.
What happens if you just use value_get_print_value (var->value, var->format)
directly in mi_cmd_var_evaluate_expression instead of varobj_get_value (var)?
--
Nick http://www.inet.net.nz/~nickrob