From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16114 invoked by alias); 4 Jul 2007 03:04:26 -0000 Received: (qmail 16100 invoked by uid 22791); 4 Jul 2007 03:04:24 -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; Wed, 04 Jul 2007 03:04:20 +0000 Received: from kahikatea.snap.net.nz (24.62.255.123.dynamic.snap.net.nz [123.255.62.24]) by viper.snap.net.nz (Postfix) with ESMTP id 942F93D9C42; Wed, 4 Jul 2007 15:04:16 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 5BC838FBF6; Wed, 4 Jul 2007 15:04:12 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18059.3627.269075.427280@kahikatea.snap.net.nz> Date: Wed, 04 Jul 2007 03:04:00 -0000 To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org Subject: Re: [MI] lvalues and variable_editable In-Reply-To: <20070703161533.GF2868@caradoc.them.org> References: <18048.64048.398970.186217@kahikatea.snap.net.nz> <20070703161533.GF2868@caradoc.them.org> X-Mailer: VM 7.19 under Emacs 22.1.50.10 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: 2007-07/txt/msg00080.txt.bz2 > > Here are two experimental patches: > > > > 1) varobj.c: Test if the value of variable object is an lvalue. I think > > this can only occur for root values. > > I'm still a bit confused but I think this is because I read "lvalue" > and think of the C language meaning. An lvalue is something which can > occur on the left hand side of an assignment. So it can happen for > children too, for instance. AFAIK lvalue isn't a language specific context. Here's how to specify an lvalue for a root variable: -var-create - * "i1 + i2" Can you give an example of how you would specify an lvalue for children? > Right now a value is "changeable" unless it is a fake child > (e.g. "public"), a struct, a union, or an array. This makes some > sense since the value we print out for those cases is not useful for > editing. For instance "{...}". Their children will, I believe, be > changeable. > > A value is editable in C unless it is a struct, union, array, > function, or method. C++ adds the fake access children again. Yes. varobj_value_is_changeable_p uses the test "if (CPLUS_FAKE_CHILD (var))" in a language independent way, so variable_editable could also. > So the only things which are editable but not changeable are functions > and methods. That doesn't seem like a useful distinction. > > Back in revision 1.1, fake children and structs and unions were not > changeable. Those and arrays, functions, methods, and members were > not editable. That doesn't make considerably more sense to me either. > > The difference in usage seems to be that we forbid attempts to modify > non-editable variables, and we omit reporting changes for > non-changeable variables. > > > It would seem sensible to define variable_editable using > > varobj_value_is_changeable_p and I don't think language dependent versions > > aren't needed. > > I agree. But is there anything which should be one and not the other? My initial premise was: "a value is only changeable but not editable when it's an lvalue." > Maybe we can dispense with changeable entirely. I don't think so. The attribute changeable tells GDB whether it needs to check if the value has changed. The attribute editable tells the frontend whether the user should be allowed to try to edit the value, which was the source of Sascha Radike's bug report (BUG: MI reporting wrong attributes for casted variables). -- Nick http://www.inet.net.nz/~nickrob