From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22267 invoked by alias); 21 Nov 2007 06:59:30 -0000 Received: (qmail 22258 invoked by uid 22791); 21 Nov 2007 06:59:29 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 21 Nov 2007 06:59:23 +0000 Received: from zps75.corp.google.com (zps75.corp.google.com [172.25.146.75]) by smtp-out.google.com with ESMTP id lAL6xITH011785 for ; Tue, 20 Nov 2007 22:59:18 -0800 Received: from ug-out-1314.google.com (ugfj3.prod.google.com [10.66.186.3]) by zps75.corp.google.com with ESMTP id lAL6xHYI017132 for ; Tue, 20 Nov 2007 22:59:18 -0800 Received: by ug-out-1314.google.com with SMTP id j3so38161ugf for ; Tue, 20 Nov 2007 22:59:17 -0800 (PST) Received: by 10.66.219.20 with SMTP id r20mr1498514ugg.1195628356858; Tue, 20 Nov 2007 22:59:16 -0800 (PST) Received: by 10.67.21.14 with HTTP; Tue, 20 Nov 2007 22:59:16 -0800 (PST) Message-ID: Date: Wed, 21 Nov 2007 06:59:00 -0000 From: "Douglas Evans" To: "Peng Yu" Subject: Re: gdb does not print the reference to the base class members Cc: gdb@sourceware.org In-Reply-To: <366c6f340711202055t1cfce2f6i4974f14386ada2d9@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <366c6f340711181635x47116762nf7ec620eb5801dd2@mail.gmail.com> <366c6f340711202055t1cfce2f6i4974f14386ada2d9@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00203.txt.bz2 Hi. The bug is in gcc, not gdb, so no change in gdb version is going to fix this. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27574 for details of the bug. On Nov 20, 2007 8:55 PM, Peng Yu wrote: > Hi, > > This is the version that I'm using. Will the problem be solved if I > upgrade to the latest version, GDB version 6.7.1? > > Thanks, > Peng > > $ gdb --version > GNU gdb 6.6-debian > Copyright (C) 2006 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you are > welcome to change it and/or distribute copies of it under certain conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for details. > This GDB was configured as "i386-linux". > > > > On Nov 19, 2007 2:39 AM, Douglas Evans wrote: > > I believe this is gcc bug 27574. > > > > > > On Nov 18, 2007 4:35 PM, Peng Yu wrote: > > > Hi, > > > > > > I try to print reference x for the following problem. But gdb does not > > > print the one in class B refered to class A? Do you know how to print > > > its value? > > > > > > Thanks, > > > Peng > > > > > > (gdb) b 22 > > > Breakpoint 1 at 0x8048694: file main.cc, line 22. > > > (gdb) b 14 > > > Breakpoint 2 at 0x8048706: file main.cc, line 14. > > > (gdb) r > > > Failed to read a valid object file image from memory. > > > > > > Breakpoint 1, main () at main.cc:22 > > > 22 B b(10); > > > (gdb) p x > > > $1 = (int &) @0xbffd86cc: 5 > > > (gdb) c > > > > > > Breakpoint 2, B (this=0xbffd86c8, a=10) at main.cc:14 > > > 14 std::cout << x << std::endl; > > > (gdb) p x > > > No symbol "x" in current context. > > > > > > > > > > > > #include > > > > > > class A { > > > public: > > > A(int a) : _a(a) { } > > > protected: > > > int _a; > > > }; > > > > > > class B : public A { > > > public: > > > B(int a) : A(a) { > > > int &x = A::_a;//can not print from gdb, Line 12 > > > std::cout << x << std::endl; > > > } > > > }; > > > > > > > > > int main(){ > > > int a = 5; > > > int &x = a;//this one can be printed in gdb, Line 22 > > > B b(10); > > > std::cout << x << std::endl; > > > } > > > > > >