Bogus DWARF line#/address
Allen Hopkins
allenh@eecs.berkeley.edu
Thu Dec 9 16:59:00 GMT 2004
No, no optimization options. Just -ggdb, -Wno-deprecated.
I understand the "-O0" (oh-zero) is the same as no -O at all.
But I'll try it. I'm pretty desparate for ideas.
-Allen
Eljay Love-Jensen wrote:
> Hi Allen,
>
> Was the code compiled with -O0?
>
> --Eljay
>
> > I'm trying to use gdb to debug code compiled with g++
> > (3.4.3) from .cpp source files that have, in turn, been
> > compiled from higher-level source code by a special
> > compiler we're developing here called Metropolis.
> >
> > Metropolis source files have .mmm extensions, and there is
> > a .cpp file generated for each one. #line directives are
> > inserted in the .cpp files so gdb can display the .mmm
> > source, and breakpoints can be set in terms of lines in the
> > .mmm files.
> >
> > The problem: Sometimes setting a breakpoint at a .mmm file
> > line results in a breakpoint at an absurd place, unrelated
> > to the desired line.
> >
> > I ran "readelf -wl" on the executable to see what addresses
> > are being associated with what lines of code in the DWARF-2
> > output. The results are interesting:
> >
> > readelf shows that line 42 of P.mmm, where I want to set my
> > breakpoint & can't, first gets one address associated
> > with it (the wrong one, where my breakpoint really ends up).
> > Then, further down in the output, it shows it getting the
> > right one. (The wrong one is the address of the destructor
> > of some class in the application.)
> >
> > I've posted the relevant files here, at
> > http://www.eecs.berkeley.edu/~allenh/bogus_dwarf.
> > READ_ME.txt tells what to look for & where.
> >
> > Any help or suggestions with this would be greatly
> > appreciated. I don't understand how g++ works enough to
> > make sense of it.
> >
> > g++ is version 3.4.3
> > uname -a says:
> > Linux hig.eecs.berkeley.edu 2.6.7-1.494.2.2smp #1 SMP Tue Aug 3 09:59:49 EDT 2004 i686 i686 i386 GNU/Linux
> >
> > -Allen Hopkins
More information about the Gcc-help
mailing list