From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11989 invoked by alias); 11 Mar 2008 21:32:29 -0000 Received: (qmail 11875 invoked by uid 22791); 11 Mar 2008 21:32:27 -0000 X-Spam-Check-By: sourceware.org Received: from el-out-1112.google.com (HELO el-out-1112.google.com) (209.85.162.178) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Mar 2008 21:32:09 +0000 Received: by el-out-1112.google.com with SMTP id z25so1619600ele.0 for ; Tue, 11 Mar 2008 14:32:07 -0700 (PDT) Received: by 10.115.78.1 with SMTP id f1mr5547077wal.100.1205271126179; Tue, 11 Mar 2008 14:32:06 -0700 (PDT) Received: by 10.114.110.12 with HTTP; Tue, 11 Mar 2008 14:32:06 -0700 (PDT) Message-ID: <5b7094580803111432j214ce562k42e7ca6bf148a857@mail.gmail.com> Date: Wed, 12 Mar 2008 09:14:00 -0000 From: "Brian Budge" To: "Michael Snyder" Subject: Re: breakpoints and symbol examination problems Cc: "Daniel Jacobowitz" , gdb@sourceware.org In-Reply-To: <5b7094580803111420i63cc6f89k900fab7b40bd4482@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> 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/msg00125.txt.bz2 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? > > > > > > > > > > > >