This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH]: MI -var-set-format
> > 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.
That often happens already. I don't see a real problem: the null string
gets returned and nothing gets printed for the value.
> - 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.
I don't know what the reason would be. However, the value is printed via
varobj_get_value for many other MI commands e.g -var-evaluate-expression,
-var-list-children --all-values, -var-update --all-values -- and I've
not seen it call an error yet
> 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.
Eventually I guess it might be a good idea to distinguish between a
NULL pointer and a string that has the value NULL, but I presume any
such changes would be to varobj_get_value and so are orthogonal to my
patch.
--
Nick http://www.inet.net.nz/~nickrob