From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21383 invoked by alias); 8 May 2006 17:27:23 -0000 Received: (qmail 21368 invoked by uid 22791); 8 May 2006 17:27:22 -0000 X-Spam-Check-By: sourceware.org Received: from intranet.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.6) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 08 May 2006 17:27:20 +0000 Received: (qmail 13031 invoked from network); 8 May 2006 17:27:18 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 May 2006 17:27:18 -0000 To: Nick Roberts Cc: gdb-patches@sources.redhat.com, Vladimir Prus Subject: Re: [PATCH] -var-update [was Re: Variable objects: references formatting] References: <17497.14121.225320.477428@farnswood.snap.net.nz> <200605041100.09748.ghost@cs.msu.su> <17497.43822.261192.673547@farnswood.snap.net.nz> <200605041610.16153.ghost@cs.msu.su> <17503.15435.371371.707494@farnswood.snap.net.nz> From: Jim Blandy Date: Mon, 08 May 2006 17:27:00 -0000 In-Reply-To: <17503.15435.371371.707494@farnswood.snap.net.nz> (Nick Roberts's message of "Tue, 9 May 2006 00:40:43 +1200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00155.txt.bz2 Nick Roberts writes: > > > However, do you see the problem with references that I mentioned earlier > > > (that they don't seem to disappear from the changelist with -var-update)? > > > This seems to be the case for any variable object made from a reference. > > > > Yes, I see that for variable object created from reference, -var-update * > > always mentions that. Looking at this under debugger, it seems that the call > > to my_value_equal in varobj_update compares the value of *reference* to the > > value of new *referenced-to* object. This happens in my_value_equal > > (varobj.c): > > > > static int > > my_value_equal (struct value *val1, struct value *volatile val2, int > > *error2) > > ... > > > ...Alas, quick attempt to do that results in segfault, and I'm out of > > time for today. Feel free to beat me to it ;-) > > I think this patch works. My reasoning is one of symmetry: whatever is done to > val2 should also be done to val1, and that you probably don't want to change > the contents of val1 (hence val3). I don't know exactly what coerce_array > does, apart from convert the type from TYPE_CODE_REF to TYPE_CODE_INT or > TYPE_CODE_FLOAT or whatever, so the comment might not be quite > right. Is there any reason you declared a new variable instead of just saying: val1 = coerce_array (val1) ? That would make the symmetry more apparent. (I don't know enough about the context to review the patch more substantially.)