This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH]: MI -var-set-format
- From: Daniel Jacobowitz <drow at false dot org>
- To: Nick Roberts <nickrob at snap dot net dot nz>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 5 May 2006 14:11:11 -0400
- Subject: Re: [PATCH]: MI -var-set-format
- References: <17494.64020.26176.277202@farnswood.snap.net.nz>
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