Generating self-referential typedefs in debug info

Daniel Berlin dberlin@redhat.com
Sun Jul 23 20:21:00 GMT 2000


Someone sent me a simple hello world program, that when compiled with
the latest gcc using DWARF2 debug info, crashes gdb when gdb tries to
load it, overflowing the stack, because of an infinite recursion.

The cause of the infinite recursion is this:
<1><16cf3>: Abbrev Number: 19 (DW_TAG_typedef)
     DW_AT_name        : streampos      
     DW_AT_decl_file   : 7      
     DW_AT_decl_line   : 49     
     DW_AT_type        : <16cf3>     <--- Wrong. Notice it's referring
                                                 to itself


It's actually generating self-referential typedefs for a lot of
types after that, but this is the first one we hit, and thus, we crash
on it.
But it's not an isolated problem, just on the same page i see:
<1><16d04>: Abbrev Number: 19 (DW_TAG_typedef)
     DW_AT_name        : wstreampos     
     DW_AT_decl_file   : 7      
     DW_AT_decl_line   : 51     
     DW_AT_type        : <16d04>    
...
<1><16d4b>: Abbrev Number: 41 (DW_TAG_typedef)
     DW_AT_name        : streambuf      
     DW_AT_decl_file   : 27     
     DW_AT_decl_line   : 444    
     DW_AT_type        : <16d4b>    

I don't have preprocessed source due to the fact that I wasn't sent
it. 

This is with GNU C++ 2.96 20000719.

I've attached a tar containing the hello world program, with the
dwarf2 debug info, and the hello.cc file that generate it.



--Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.tgz
Type: application/x-gzip
Size: 37892 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20000723/7c6c0046/attachment.bin>


More information about the Gcc-bugs mailing list