Re: [PATCH]: MI -var-set-format

Daniel Jacobowitz
2006-05-05T18:11:16Z

On Tue, May 02, 2006 at 06:20:04PM +1200, Nick Roberts wrote:
>
> Currently:
>
> -var-evaluate-expression var1
> ^done,value="18"
>
> -var-set-format var1 hexadecimal
> ^done,format="hexadecimal"
>
> -var-set-format just repeats the format that has been set which is not
> very useful since presumably the front end sent it in the first place.
>
> I would like to add the value in the (new) current format, which I find
> much more useful:
>
> -var-set-format var1 hexadecimal
> ^done,format="hexadecimal",value="0x12"
>
> OK to apply if I update the testsuite accordingly?

This seems reasonable; I doubt anyone will object.

I was wondering how to handle potential error conditions. I see at
least two:

- The return of varobj_get_value can be NULL. You should check for
that.
- common_val_print might fail to transform the struct value * into
a string for some reason. I believe it may call error() if that
happens.

Should -var-set-format fail in those cases, or should it omit the
value, or should it supply a default value string (e.g. <error>)? It
will have changed the varobj's settings, so I don't think ^error
is appropriate.

--
Daniel Jacobowitz
CodeSourcery