This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Sat, May 06, 2006 at 11:29:57AM +1200, Nick Roberts wrote:
>  > > 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.

So ui_out_field_string will handle a NULL string OK.  I didn't realize
that.  I see that it seems to be true, though I couldn't see even any
comments to that effect - but both the CLI and MI output routines do
check, so you're right.

>  >   - 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

There were plenty of reasons - we were talking about this in another
thread at the same time :-)  For instance, it might try to read from
inaccessible memory to dereference a bad pointer.  DEREF_REF was set in
this call.

But, I've just changed that.  Now it won't error any more after the
patch I just committed.  So, I suppose your patch is now OK.

It's a little disconcerting that in some cases it will omit value and
in others print a <message>, but hey, things will work out OK.

Could you resubmit the patch including any necessary testsuite changes,
please?

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]