From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5771 invoked by alias); 5 Dec 2006 21:32:37 -0000 Received: (qmail 5750 invoked by uid 22791); 5 Dec 2006 21:32:36 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Dec 2006 21:32:27 +0000 Received: (qmail 11196 invoked from network); 5 Dec 2006 21:32:25 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Dec 2006 21:32:25 -0000 To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: MI: fix base members in references References: <200611291555.42209.ghost@cs.msu.su> From: Jim Blandy Date: Tue, 05 Dec 2006 21:32:00 -0000 In-Reply-To: (Vladimir Prus's message of "Tue, 05 Dec 2006 16:23:16 +0300") 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-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00047.txt.bz2 Vladimir Prus writes: > *PING*? This is one-liner, and causes no regressions, so should be > non-controversial. (By the way --- it's handy to include a link to the post with the patch, or ideally the patch itself.) Here's the original patch: Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.62 diff -u -p -r1.62 varobj.c --- varobj.c 29 Nov 2006 06:41:13 -0000 1.62 +++ varobj.c 29 Nov 2006 12:51:53 -0000 @@ -2428,8 +2428,9 @@ cplus_value_of_child (struct varobj *par { struct value *temp = NULL; + /* No special processing for references is needed -- + value_cast below handles references. */ if (TYPE_CODE (value_type (parent->value)) == TYPE_CODE_PTR - || TYPE_CODE (value_type (parent->value)) == TYPE_CODE_REF) { if (!gdb_value_ind (parent->value, &temp)) return NULL; How should this behave if parent->value is a reference to a pointer? Shouldn't it follow the ref, and then behave the same as when it's a pointer? If so, then the fix would be something like this instead (not that I understand this code): *** varobj.c 29 Nov 2006 15:47:40 -0800 1.62 --- varobj.c 05 Dec 2006 13:31:51 -0800 *************** *** 2426,2441 **** /* Baseclass */ if (parent->value != NULL) { ! struct value *temp = NULL; ! if (TYPE_CODE (value_type (parent->value)) == TYPE_CODE_PTR ! || TYPE_CODE (value_type (parent->value)) == TYPE_CODE_REF) { ! if (!gdb_value_ind (parent->value, &temp)) return NULL; } - else - temp = parent->value; if (temp != NULL) { --- 2426,2439 ---- /* Baseclass */ if (parent->value != NULL) { ! struct value *temp = coerce_ref (parent->value); ! if (TYPE_CODE (value_type (temp)) == TYPE_CODE_PTR ! || TYPE_CODE (value_type (temp)) == TYPE_CODE_REF) { ! if (!gdb_value_ind (temp, &temp)) return NULL; } if (temp != NULL) {