public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Bogus DWARF line#/address
@ 2004-12-08 23:38 Allen Hopkins
  2004-12-09 14:56 ` Eljay Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Allen Hopkins @ 2004-12-08 23:38 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bogus DWARF line#/address
  2004-12-08 23:38 Bogus DWARF line#/address Allen Hopkins
@ 2004-12-09 14:56 ` Eljay Love-Jensen
  2004-12-09 16:59   ` Allen Hopkins
  0 siblings, 1 reply; 3+ messages in thread
From: Eljay Love-Jensen @ 2004-12-09 14:56 UTC (permalink / raw)
  To: Allen Hopkins, gcc-help

Hi Allen,

Was the code compiled with -O0?

--Eljay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bogus DWARF line#/address
  2004-12-09 14:56 ` Eljay Love-Jensen
@ 2004-12-09 16:59   ` Allen Hopkins
  0 siblings, 0 replies; 3+ messages in thread
From: Allen Hopkins @ 2004-12-09 16:59 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: gcc-help

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 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-09 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-08 23:38 Bogus DWARF line#/address Allen Hopkins
2004-12-09 14:56 ` Eljay Love-Jensen
2004-12-09 16:59   ` Allen Hopkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).