This is the mail archive of the mailing list for the GCC 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: When to emit C++ debug info?

I cannot resist replying to this...

namespace b_std
  class b_ostream {
    int foo;
    virtual void bar();
    b_ostream& operator << (const char *);

  extern b_ostream b_cout;

int main()
  b_std::b_cout << "Hello world";

> The question arises, what debug information should be emitted for this? 

Well, I suspect that somebody debugging this would want:

1) main
2) b_std::b_ostream that can be examined with 
   (gdb) p b_cout
   (or, in some future, better world)
   (gdb) p b_std::b_cout
3) b_std::b_ostream::operator<<(const char*) definition, if it existed

As you noticed, mainline g++ doesn't do this. (No difference between g++
-g, g++ -ggdb3, g++ -g3 -O0 -fno-eliminate-unused-debug-types). The fact
that a used variable (b_cout) doesn't have a DW_TAG_variable is a bug, I
think, and should be filed in bugzilla. I would think the structure_type
tag would fall out correctly if the variable tag was emitted.

The Bugzilla entry somewhat associated with this kind of thing involves
nested types. It's debug/11325, and was fixed by Scott Synder.

> The debug information is keyed to the vtable at the moment.

This will result in problems for libstdc++ templatized classes, because
of the "extern template" suppression of explicitly instantiated

> This means that, even now that GDB can handle trivial uses of namespace
> information, real-world examples are pretty much useless.

real world examples are "less than optimally" debugged.



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