From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27403 invoked by alias); 5 Feb 2008 20:55:13 -0000 Received: (qmail 27394 invoked by uid 22791); 5 Feb 2008 20:55:12 -0000 X-Spam-Check-By: sourceware.org Received: from imr1.ericy.com (HELO imr1.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Feb 2008 20:54:47 +0000 Received: from eusrcmw751.eamcs.ericsson.se (eusrcmw751.exu.ericsson.se [138.85.77.51]) by imr1.ericy.com (8.13.1/8.13.1) with ESMTP id m15KsdYi019800; Tue, 5 Feb 2008 14:54:39 -0600 Received: from ecamlmw720.eamcs.ericsson.se ([142.133.1.72]) by eusrcmw751.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Feb 2008 14:54:39 -0600 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [Patch] -var-evaluate-expression NAME [FORMAT] Date: Tue, 05 Feb 2008 20:55:00 -0000 Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA04290E99@ecamlmw720.eamcs.ericsson.se> In-Reply-To: <18344.51774.858278.592849@kahikatea.snap.net.nz> From: "Marc Khouzam" To: "Nick Roberts" Cc: "Daniel Jacobowitz" , 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/msg00114.txt.bz2 You don't like my new patch? :-) I feels less risky (and it's cleaner than my orginal one.) My hesitation with your suggestion is that it seems more risky to forget a case, and that it is not as future-proof because it duplicates some logic in mi-var-cmd and varobj. Marc -----Original Message----- From: Nick Roberts [mailto:nickrob@snap.net.nz] Sent: Tuesday, February 05, 2008 3:43 PM To: Marc Khouzam Cc: Daniel Jacobowitz; gdb-patches@sourceware.org Subject: RE: [Patch] -var-evaluate-expression NAME [FORMAT] > > 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)? >=20 > 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 =3D=3D 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 =3D=3D NULL, I think you just get a null string: -var-evaluate-expression var1 ^done,value=3D"" If varobj_value_is_changeable_p is t and the value not NULL, I don't think = the value can be lazy etc. --=20 Nick http://www.inet.net.nz/~nick= rob