From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22753 invoked by alias); 5 Feb 2008 20:43:13 -0000 Received: (qmail 22744 invoked by uid 22791); 5 Feb 2008 20:43:13 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Feb 2008 20:42:43 +0000 Received: from kahikatea.snap.net.nz (109.31.255.123.static.snap.net.nz [123.255.31.109]) by viper.snap.net.nz (Postfix) with ESMTP id 324B43D9F9C; Wed, 6 Feb 2008 09:42:40 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id A7A2D8FC6D; Wed, 6 Feb 2008 09:42:39 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18344.51774.858278.592849@kahikatea.snap.net.nz> Date: Tue, 05 Feb 2008 20:43:00 -0000 To: "Marc Khouzam" Cc: "Daniel Jacobowitz" , Subject: RE: [Patch] -var-evaluate-expression NAME [FORMAT] In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA04290E90@ecamlmw720.eamcs.ericsson.se> References: <18343.34335.642831.945359@kahikatea.snap.net.nz> <6D19CA8D71C89C43A057926FE0D4ADAA04290E90@ecamlmw720.eamcs.ericsson.se> X-Mailer: VM 7.19 under Emacs 22.1.50.23 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00113.txt.bz2 > > What happens if you just use value_get_print_value (var->value, > > var->format) directly in mi_cmd_var_evaluate_expression instead of > > varobj_get_value (var)? > > This won't work, because it bypassed all the logic done between the call to > varobj_get_value() and the one to value_get_print_value(); such things as > returning "{...}" for structs and unions, returning "[numChildren]" for > arrays; it would also bypass the checks for var->value == NULL, and > value_lazy(), etc. I didn't mean use value_get_print_value in all cases but something like: if (formatFound && varobj_value_is_changeable_p (var)) ui_out_field_string (uiout, "value", value_get_print_value (varobj_get_struct_value (var), format)); else ui_out_field_string (uiout, "value", varobj_get_value (var)); where varobj_get_struct_value is defined in varobj.c as: struct value * varobj_get_struct_value (struct varobj *var) { return var->value; } I've not checked all the details and it might need tweaking. If var->value == NULL, I think you just get a null string: -var-evaluate-expression var1 ^done,value="" If varobj_value_is_changeable_p is t and the value not NULL, I don't think the value can be lazy etc. -- Nick http://www.inet.net.nz/~nickrob