This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: When to emit C++ debug info?
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: "B. Kosnik" <bkoz at nabi dot net>
- Cc: snyder at fnal dot gov, gcc at gcc dot gnu dot org
- Date: Sat, 3 Jan 2004 13:12:56 -0500
- Subject: Re: When to emit C++ debug info?
- References: <20040103120250.07ec0449.bkoz@nabi.net>
On Sat, Jan 03, 2004 at 12:02:50PM -0600, B. Kosnik wrote:
>
> I cannot resist replying to this...
>
> namespace b_std
> {
> class b_ostream {
> public:
> 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.
I'm not sure if it's a bug or deliberate. But even if it's fixed,
debug info for the structure type won't fall out - we'll get a
declaration only. That's what used to happen.
I agree with you that it's wrong. I wanted some feedback before I
tried to fix it, because:
(A) I hate this bit of code; I get lost for weeks at a time in it
(B) It may make our generated DWARF-2 a _lot_ bigger (but more useful)
Thanks for the feedback.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer