From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8666 invoked by alias); 15 May 2006 17:06:46 -0000 Received: (qmail 8658 invoked by uid 22791); 15 May 2006 17:06:45 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 15 May 2006 17:06:42 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FfgWm-0000DL-AI; Mon, 15 May 2006 13:06:40 -0400 Date: Mon, 15 May 2006 17:07:00 -0000 From: Daniel Jacobowitz To: Nick Roberts Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH]: MI -var-set-format Message-ID: <20060515170640.GB385@nevyn.them.org> Mail-Followup-To: Nick Roberts , gdb-patches@sources.redhat.com References: <17494.64020.26176.277202@farnswood.snap.net.nz> <20060505181111.GI31029@nevyn.them.org> <17499.57333.952984.589237@farnswood.snap.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17499.57333.952984.589237@farnswood.snap.net.nz> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00338.txt.bz2 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 , but hey, things will work out OK. Could you resubmit the patch including any necessary testsuite changes, please? -- Daniel Jacobowitz CodeSourcery