This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DWARF problem - newbie question


"Lev Assinovsky" <LAssinovsky@algorithm.aelita.com> writes:

> Hi!
> I use gcc 3.2 and gdb+dejagnu-20030228.
> Compile my code with -ggdb option which promises 
> the most expressive extra debug info.
> But when in gdb I request "info macro M"
> I get:
> GDB has no preprocessor macro information for that code, though
> I do have macro M defined in my source.
> 
> What am I doing wrong?

At the moment, to get macro information, you need to:
- use the Dwarf 2 debugging format, and
- pass GCC the -g3 flag, to ask it to include macro information.

You don't say which platform you're using.  On i686-pc-linux-gnu, GCC
3.2 defaults to using Dwarf 2.  You can check for sure by running
'readelf -S foo.o' on one of your .o files, compiled with plain -g:
- If it has a section named '.debug_info', then that's Dwarf 2.
- If it has a section named '.stab', then that's STABS.

If Dwarf 2 isn't the default, then you can request it with -gdwarf-2.
So altogether, you'd need to say '-gdwarf-2 -g3'.

I don't really know how -ggdb decides which format is 'the most
expressive'.  I think it's better to spell out what you want than to
use that flag.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]