[Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions

sgjohnston at yahoo dot com gcc-bugzilla@gcc.gnu.org
Fri Sep 26 07:04:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12385



------- Additional Comments From sgjohnston at yahoo dot com  2003-09-26 05:19 -------
This happens with gdb 5.3. I agree that gdb should never end up in an infinite
recursion, that's definately a bug... although that specifically only happens in
an esoteric situation with namespaces. But I still think the dwarf2 output is
incorrect (or maybe less than optimal?) based on two factors:

1. if no virtual functions are present, gcc behaves perfectly and emits the full
class.
2. if virual functions are present, then there are circumstances where parts of
the class would never have debugging info emitted, depending on compilation unit
structure. for example:

file1.cc:

class C {
   virtual void fn1();
   virtual void fn2();
};

C::fn1() {stuff...}

file2.cc:

class C {
   virtual void fn1();
   virtual void fn2();
};

C::fn2() {stuff...}

As far as I can tell, no dies would be emitted for fn1 or fn2 (or any of the
implicit functions like operator=()). Given that the class has been fully
defined between the two files, at the least the two files output should contain
all the dies between them. I actually think it's better (and neccesary for gdb!)
for the entire class die to be written with each file, as it is if no virtual
functions are used.

I looked brieflt at the dwarf2 standard, it says that AT_declaration should be
set if a structure is incomplete. I'm not sure what the definition of incomplete
is here... I'll look more carefully at it shortly.

Thanks
Stuart



More information about the Gcc-bugs mailing list