This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Bogus DWARF line#/address
- From: Allen Hopkins <allenh at eecs dot berkeley dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 08 Dec 2004 15:38:22 -0800
- Subject: Bogus DWARF line#/address
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