[patch] gas dwarf2 debug emission

Nathan Sidwell nathan@codesourcery.com
Sat Jan 22 17:42:00 GMT 2005


Hi,
this patch fixes a problem with dwarf2 .debug_line emission.  The logic
in dwarf2_finish is incorrect and fails for empty C source files.

GCC will emit an empty .debug_info section for an empty source file,
as it needs to create a label in that section before it knows whether
the section will be empty or not.  This can happen for some files in
libgcc2 (in my case it was the clz file).  Gas would emit a .debug_line
section for the empty file, but not emit the associated .debug_info and
other sections.

* The check for the .debug_info section should verify that the section
is non-empty.

* It is not necessary to test for debug_type == DEBUG_DWARF2, as all_segs
will be non-null if there is any line information to emit (either implicitly
generated or explicitly via .loc/.file directives).

* I think the 'files_in_use == 0' check is an incorrect attempt to fix the
problem I observed.

Built and tested on i686-pc-linux-gnu, and on an unreleased port where I
observed the problem.  ok?

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050122/c4845859/attachment.ksh>


More information about the Binutils mailing list