[PATCH] inconsistent DWARF2 sections generated by --gdwarf2

Nick Clifton nickc@redhat.com
Thu Nov 18 08:39:00 GMT 2004


Hi Alan, Hi Bob,

>>probably harmless for GDB, but it breaks readelf, which expects a 
>>one-to-one correspondence between .debug_info and .debug_line sections.  

> I would say that this is a readelf bug.  The only reason that readelf
> needs .debug_info when dumping .debug_line is to find the size of
> addresses.  readelf could guess that some other way.

I do not think so - the DWARF standard does specify that there there 
should be a correspondence between the compilation units in the 
.debug_info section and the compilation units in the .debug_line section:

   From "Section 6.2 Line number Information":

   As mentioned in Section 3.1.1, the line number information
   generated for a compilation unit is represented in the
   .debug_line section of an object file and is referenced by
   corresponding compilation unit debugging information entry
   in the .debug_info section.

As for the patch itself - I am not so sure.  It looks to me like there 
might be problems when -gdwarf2 is not specified on the command line. 
ie GAS might still generate dwarf2 debug sections.  I would need to have 
a look at this and I am really swamped at the moment. :-(   Bob - could 
you try a few more tests of your patch please ?  Say with various 
different -gxxx command line switches specified ?

Cheers
   Nick



More information about the Binutils mailing list