g++, I'm not able to produce debug info for some classes

Ian Lance Taylor iant@google.com
Wed Jan 26 16:22:00 GMT 2011


"Vyacheslav V. Yurkov" <uvv.mail@gmail.com> writes:

>> I don't fully grasp your comment about objdump.  A type like class X
>> would not have an address.  The objdump program does not dump debugging
>> information.
>>    
> It does, objdump with -g option displays debug information from object file.

Well, OK, but that doesn't work for DWARF, and everybody these days
should be using DWARF.  Actually I would like that option to work for
DWARF but nobody has implemented it.

>> Note that in general you need to have a variable of type X before gdb
>> can tell you anything about it.
>>
> Actually I have one, but I don't need to.
> Gdb must be able to display class members without a variable of this class.

But gcc won't generate debugging information for a class if there are no
actual instances of the class.  Otherwise C++ .o files would be
gargantuan, since they would have to contain debug info for every class
defined in every included .h file.

Ian



More information about the Gcc-help mailing list