From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7993 invoked by alias); 12 Mar 2008 22:31:46 -0000 Received: (qmail 7982 invoked by uid 22791); 12 Mar 2008 22:31:45 -0000 X-Spam-Check-By: sourceware.org Received: from wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.173) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 12 Mar 2008 22:31:15 +0000 Received: by wf-out-1314.google.com with SMTP id 29so3099367wff.24 for ; Wed, 12 Mar 2008 15:31:13 -0700 (PDT) Received: by 10.143.166.18 with SMTP id t18mr3941036wfo.175.1205361073886; Wed, 12 Mar 2008 15:31:13 -0700 (PDT) Received: by 10.142.194.18 with HTTP; Wed, 12 Mar 2008 15:31:13 -0700 (PDT) Message-ID: <5b7094580803121531l1ecb2cdbyb917c98683313e0e@mail.gmail.com> Date: Wed, 12 Mar 2008 23:02:00 -0000 From: "Brian Budge" To: gdb@sourceware.org Subject: Re: breakpoints and symbol examination problems In-Reply-To: <5b7094580803121314t1e869571lf94029facedf0498@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> <5b7094580803121314t1e869571lf94029facedf0498@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/msg00135.txt.bz2 Lest anyone think this could be a 64 bit issue, this also happens on my i686 laptop with gdb 6.3.3. Should I submit a bug to the gdb bug database? Or could it be this bug?: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27017. Or is it another bug, but should be filed in gcc's bug database? Just for fun, I have tested with many different gcc debug flags (dwarf-2, gdb, stabs, stabs+ all with various LEVELs), and while gdb doesn't always report the same error message when I try to examine locals, it always reports an error message. Thanks, Brian On Wed, Mar 12, 2008 at 1:14 PM, Brian Budge wrote: > > 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? > > > > > > > > > > > > > > > > > > > > > > > > >