-g and -ggdb
Mark Mitchell
mmitchell@usa.net
Sat Dec 6 18:32:00 GMT 1997
>>>>> "H" == H J Lu <hjl@lucon.org> writes:
>>
>>
>> Why doesn't -g generate DWARF2 output on Linux? I'd think that
>> -g should be synonymous with -ggdb on systems (like Linux)
>> where the usual debugger is gdb, but this does not seem to be
>> so. The documentation for -g produces debugging information in
>> the operating system's "native format". Any thoughts? I'd be
>> happy to fix this, if we have consensus on what to do. My
>> proposal:
>>
>> o Make the "native format" on Linux whatever -ggdb generates.
>>
H> Here is what is in gcc.info:
H> `-g' Produce debugging information in the operating system's
H> native format (stabs, COFF, XCOFF, or DWARF). GDB can work
H> with this debugging information.
H> `-ggdb' Produce debugging information for use by GDB. This
H> means to use the most expressive format available (DWARF 2,
H> stabs, or the native format if neither of those are supported),
H> including GDB extensions if at all possible.
Thanks, I read that too.
H> On Linux, the "native format" is stabs. gcc seems to work
H> according to the manual.
I'm not sure what you mean by "native format". On Solaris, for
instance, I would understand "native format" to mean the format used
in the system (vendor) compilation system; in particular, whatever
format is used by dbx. I would expect -g to generate this kind of
debugging info. And, I would expect -ggdb to use the most expressive
format, which might well be different.
However, on Linux, the "vendor" toolchain is GNU. So, the usual
debugger is gdb. So, the "native format" should be whatever works best
with gdb, IMO. That's what -ggdb. At present, on Linux, egcs -g
generates stabs, while -ggdb generates DWARF2.
I claim that this situation makes no sense. In particular, if GDB is
the usual debugger, then -g should be the same as -ggdb, so either -g
or -ggdb is currently doing the wrong thing.
But, perhaps I'm missing something: what do you mean that stabs are
the native format on Linux? Is there a meaning of native other than
the one I'm thinking of?
H> -- H.J. Lu (hjl@gnu.org)
--
Mark Mitchell mmitchell@usa.net
Stanford University http://www.stanford.edu
More information about the Gcc
mailing list