From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4683 invoked by alias); 12 Mar 2008 20:15:11 -0000 Received: (qmail 4665 invoked by uid 22791); 12 Mar 2008 20:15:10 -0000 X-Spam-Check-By: sourceware.org Received: from rn-out-0910.google.com (HELO rn-out-0910.google.com) (64.233.170.188) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 12 Mar 2008 20:14:48 +0000 Received: by rn-out-0910.google.com with SMTP id i6so1974586rng.2 for ; Wed, 12 Mar 2008 13:14:46 -0700 (PDT) Received: by 10.142.241.10 with SMTP id o10mr3912104wfh.165.1205352885466; Wed, 12 Mar 2008 13:14:45 -0700 (PDT) Received: by 10.142.194.18 with HTTP; Wed, 12 Mar 2008 13:14:45 -0700 (PDT) Message-ID: <5b7094580803121314t1e869571lf94029facedf0498@mail.gmail.com> Date: Wed, 12 Mar 2008 22:31:00 -0000 From: "Brian Budge" To: gdb@sourceware.org Subject: Fwd: breakpoints and symbol examination problems In-Reply-To: <5b7094580803121306v7da4475dy5f91be7c7d8753e0@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5b7094580803101705m7bc6e8ffqa480a74d9b0ab548@mail.gmail.com> <20080311003238.GA14908@caradoc.them.org> <1205196740.19253.809.camel@localhost.localdomain> <5b7094580803110824t3808df2erf37df1dea91401a2@mail.gmail.com> <5b7094580803111420i63cc6f89k900fab7b40bd4482@mail.gmail.com> <5b7094580803111432j214ce562k42e7ca6bf148a857@mail.gmail.com> <5b7094580803121306v7da4475dy5f91be7c7d8753e0@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: 2008-03/txt/msg00134.txt.bz2 Hi all - This problem reproduces on my other system (opteron), which is running 6.7.1. How can I tell if this is lack of debug info from gcc or if this is a gdb problem? Thanks, Brian On Tue, Mar 11, 2008 at 2:32 PM, Brian Budge wrote: > So here is a minimal repro case on my system: > > foo.h > --------------------------------------------- > template > struct Class1 { > joe a; > > Class1(int b) : a(b) {} > }; > > template > struct Class2 { > joe a; > > Class2(const Class1 &rhs) { > a = 0; > for(int i = 0; i < 10; ++i) { > a += rhs.a; > } > } > }; > > ---------------------------------------------------- > foo.cpp > -------------------------------------------------- > #include > #include "foo.h" > > int main() { > > Class1 c1(15); > > Class2 c2(c1); > > std::cout << "value is " << c2.a << std::endl; > > return 0; > } > -------------------------------------------------------------- > > I'm compiling foo.cpp with > > g++ -g foo.cpp > > Here's my gdb session: > > GNU gdb 6.7.90.20080311-cvs > Copyright Stuff (removed for brevity) > This GDB was configured as "x86_64-unknown-linux-gnu"... > (gdb) b 8 > Breakpoint 1 at 0x40093b: file foo.cpp, line 8. > (gdb) run > Starting program: /home/budge/projects/rt_suite/apps/RtBatch/a.out > > Breakpoint 1, main () at foo.cpp:8 > 8 Class2 c2(c1); > (gdb) s > Class2 (this=0x7fff23e32c20, rhs=@0x7fff23e32c30) at foo.h:13 > 13 a = 0; > (gdb) n > 14 for(int i = 0; i < 10; ++i) { > (gdb) > 15 a += rhs.a; > (gdb) p i > No symbol "i" in current context. > > > g++ reports version "Gentoo 4.1.1-r3". I'm running on amd64. > > Hopefully that will help a little in figuring out what is happening. > > Thanks, > Brian > > > > > On Tue, Mar 11, 2008 at 2:20 PM, Brian Budge wrote: > > Hi Michael, Daniel, all - > > > > I built gdb from CVS gdb_6_8-branch, and indeed it fixed my breakpoint > > problem. Unfortunately, I still can't examine local variables. I get > > this interaction, for example: > > > > 207 vector< dopVertex > tmpVerts; > > (gdb) > > 208 vector< dopEdge > tmpEdges; > > (gdb) p tmpVerts > > No symbol "tmpVerts" in current context. > > > > Needless to say, not being able to examine your local variable makes > > debugging fairly tricky ;) > > > > So, one down, one to go... not too shabby. Any more ideas? > > > > Thanks, > > Brian > > > > > > > > On Tue, Mar 11, 2008 at 8:24 AM, Brian Budge wrote: > > > Actually, this is already with -O0... at least I think. I'm not > > > passing any optimization flags. For debug symbols I'm passing -ggdb. > > > > > > I'll try the CVS current top of tree a bit later today. > > > > > > Thanks, > > > Brian > > > > > > > > > > > > On Mon, Mar 10, 2008 at 5:52 PM, Michael Snyder wrote: > > > > On Mon, 2008-03-10 at 20:32 -0400, Daniel Jacobowitz wrote: > > > > > On Mon, Mar 10, 2008 at 05:05:17PM -0700, Brian Budge wrote: > > > > > > > > > > > > > > > Additionally, I can't seem to examine any "stack" variables once in > > > > > > these template functions. I can see member variables, global > > > > > > variables, and function parameters. > > > > > > > > > > This may be fixed, or it may be a compiler bug. GCC is not very good > > > > > about emitting local variable information in optimized code. > > > > > > > > Can you compile with -O0? > > > > > > > > > > > > > > > > > >