https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65669

            Bug ID: 65669
           Summary: Don't emit debug info for fake_ostream version of cerr
                    (and others)
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at google dot com

While trying to debug a massive gdb performance issue with printing std::cerr
I'm wasting time trying to create a good testcase. In one program std::cerr is
a typedef of ostream (which I expect and need) and in my testcase I'm always
getting a typedef of fake_ostream.  I think the reason is due to differences in
how the testcase is built and gdb is just happening to pick up the fake_ostream
version from the symbol table.

>From reading src/c++98/globals_io.cc I can appreciate the need for something
like this, but is there a reason to emit debug info for the fake_ostream
version?

If I manually strip out the debug info for globals_io.o, rebuild libstdc++.so,
and reinstall, then I get the proper definition.
[
Although I have to work around a gdb bug to do it:
(gdb) p std::cerr
No symbol "cerr" in namespace "std".
(gdb) mt flush-sym
(gdb) mt expand ios_init.cc
(gdb) p std::cerr
$1 = ...
]

With the fake_ostream version I see a char array, which isn't very helpful. :-)

Repro:

#include <iostream>

int
main ()
{
  std::cerr << "Yikes!\n";
  return 0;
}

bash$ gdb a.out
(gdb) start
(gdb) p std::cerr

Reply via email to