This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

Generating self-referential typedefs in debug info


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

hello.tgz


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