From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4792 invoked by alias); 5 Dec 2006 13:23:49 -0000 Received: (qmail 4782 invoked by uid 22791); 5 Dec 2006 13:23:48 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Dec 2006 13:23:39 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GraGf-0003X6-4N for gdb-patches@sources.redhat.com; Tue, 05 Dec 2006 14:23:29 +0100 Received: from 73-198.umostel.ru ([82.179.73.198]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Dec 2006 14:23:29 +0100 Received: from ghost by 73-198.umostel.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Dec 2006 14:23:29 +0100 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: MI: fix base members in references Date: Tue, 05 Dec 2006 13:23:00 -0000 Message-ID: References: <200611291555.42209.ghost@cs.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.10.2 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/msg00030.txt.bz2 Vladimir Prus wrote: > > A KDevelop user reported the following bug. If you have C++ reference > variable that refers to a class type, and that class has bases, gdb is not > able to show the values of any fields of bases. The trimmed down example > is this: > > struct S { int i; int j; }; > struct S2 : S {}; > > int foo(S2& s) > { > return s.i; > } > > int main() > { > S2 s; > s.i = 1; > s.j = 2; > return foo(s); > } > > If you are in 'foo' and try to create MI variable objects for s, and > navigate it, the varobjs for 'i' and 'j' members of the base class will > have no value. > > The problem happens when creating varobj for the base object. MI sees that > it's reference and tries to pass it via value_ind. The latter immediately > removes top-level reference and rightly refuses to deference a structure. > > MI should just do nothing about references -- the value_cast function used > to obtain base handles references just fine. > > The attached patch fixed the problem, no regression. I'll write a testcase > for it as soon as my previous references patch is reviewed -- I don't want > to pile too many testcases in as-yet-uncommitted file. > > OK? > > If this patch is fine, can I also commit it to 6.6 branch? The bug in > question is quite problematic for C++ code. *PING*? This is one-liner, and causes no regressions, so should be non-controversial. - Volodya