This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: DWARF problem - newbie question
- From: Jim Blandy <jimb at redhat dot com>
- To: "Lev Assinovsky" <LAssinovsky at algorithm dot aelita dot com>
- Cc: <gdb at sources dot redhat dot com>
- Date: 01 May 2003 18:29:52 -0500
- Subject: Re: DWARF problem - newbie question
- References: <3F6F4712B759A34ABD453A8B39C10D6260DC97@bagman.edm.com>
"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.