Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH]: MI -var-set-format
Date: Mon, 15 May 2006 17:07:00 -0000	[thread overview]
Message-ID: <20060515170640.GB385@nevyn.them.org> (raw)
In-Reply-To: <17499.57333.952984.589237@farnswood.snap.net.nz>

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


  reply	other threads:[~2006-05-15 17:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-02  6:19 Nick Roberts
2006-05-05 18:11 ` Daniel Jacobowitz
2006-05-05 23:30   ` Nick Roberts
2006-05-15 17:07     ` Daniel Jacobowitz [this message]
2006-05-16  3:46       ` Nick Roberts
2008-01-22 20:13         ` Daniel Jacobowitz
2008-01-23  3:25           ` Nick Roberts
2008-01-23  3:48             ` Daniel Jacobowitz
2008-01-23  6:24               ` Nick Roberts
2008-01-23 13:17                 ` Daniel Jacobowitz
2008-01-23 21:17                   ` Nick Roberts
2008-01-23 21:24                     ` Daniel Jacobowitz
2008-01-23 22:30                       ` Nick Roberts
2008-01-24 21:49 Marc Khouzam
2008-01-25 10:38 ` Eli Zaretskii
2008-01-25 15:46   ` Marc Khouzam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060515170640.GB385@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=nickrob@snap.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox