Compile this testcase (from Ben Kosnik) with -g: #include <sstream> int main() { std::stringstream s; // (gdb) p s return 0; } Look in the debug info for information about stringstream. In DWARF-2 (the problem is also visible in stabs+) this is all there is: <3><ef9>: Abbrev Number: 17 (DW_TAG_typedef) DW_AT_name : (indirect string, offset: 0xddd): stringstream DW_AT_decl_file : 3 DW_AT_decl_line : 144 DW_AT_type : <f13> <1><f13>: Abbrev Number: 13 (DW_TAG_structure_type) DW_AT_name : (indirect string, offset: 0x7b9): basic_stringstream<char,std::char_traits<char>,std::allocator<char> > DW_AT_declaration : 1 i.e just a declaration. Also in 3.4, the typedef is emitted in the DW_TAG_lexical_block associated with main. That doesn't make a whole lot of sense and will eventually confuse GDB. Release: 3.4 20030308, 3.3 cvs, 3.2.3 Environment: i686-pc-linux-gnu How-To-Repeat: Compile above testcase with -g
Fix: The debug information for the body of basic_stringstream needs to be emitted.
I see the crash with gdb (5.1.90CVS-3) but with gdb 2003-07-04-cvs, I get the output: {<basic_iostream<char,std::char_traits<char> >> = {<basic_istream< char,std::char_traits<char> >> = {<basic_ios<char,std::char_traits<char> >> = <invalid address>, _vptr.basic_istream = 0x10, _M_gcount = 139083320}, <basic_ostream< char,std::char_traits<char> >> = {_vptr.basic_ostream = 0x813c9c0}, <No data fields>}, _M_stringbuf = {<basic_streambuf<char,std::char_traits<char> >> = {_vptr.basic_streambuf = 0x50, _M_in_beg = 0x11 <Address 0x11 out of bounds>, _M_in_cur = 0x851f948 <Address 0x851f948 out of bounds>, _M_in_end = 0x86dd6f8 <Address 0x86dd6f8 out of bounds>, _M_out_beg = 0x10 <Address 0x10 out of bounds>, _M_out_cur = 0x10 <Address 0x10 out of bounds>, _M_out_end = 0x4212df00 "", _M_buf_locale = {static none = 0, static ctype = 1, static numeric = 2, static collate = 4, static time = 8, static monetary = 16, static messages = 32, static all = 63, _M_impl = 0x4212dfa8, static _S_classic = 0x400c6b9c, static _S_global = 0x400c6b9c, static _S_categories = 0x400b3ab0, static _S_categories_size = 6}}, _M_mode = 796225127, _M_string = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<No data fields>}, _M_p = 0x11 <Address 0x11 out of bounds>}}}} This is with the mainline gcc (20030705). I will attach the output of readelf. Can you look at the output and tell me if this bug still exists?
Created attachment 4349 [details] readelf --debug-dump output
Subject: Re: [3.3, 3.4] Debug information for some C++ headers is missing classes (template specific?) On Sat, Jul 05, 2003 at 02:55:08PM -0000, pinskia at physics dot uc dot edu wrote: > Can you look at the output and tell me if this bug still exists? What's the debugging output you put in the bug log from? There's no basic_iostream in this testcase at all. From the readelf output, the bug is still there.
I had forgot to copy and paste the "$1 = " in front of output (see the '{'). I see how you got confused. I also see how to detect the problem now in the "readelf --debug-dump" output. It still exists on the mainline (20030724).
Not a regression.
Maybe related to PR 12385.
*** Bug 51873 has been marked as a duplicate of this bug. ***
With gcc 7.5 and gcc 13.2 I see (gdb) p/r s $3 = <incomplete type> (gdb) ptype s type = std::stringstream and the python pretty-printers "ICE" like (gdb) p s Python Exception <class 'IndexError'>: list index out of range The DW_TAG_typedef is still as reported, to a DW_AT_declaration, and the variable DIE only refers to the typedef DIE. So - reconfirmed. Might be also a C++ frontend representation issue.