PATCH: Output dwarf debug info only when needed

H . J . Lu hjl@lucon.org
Tue Jun 11 14:46:00 GMT 2002


On Tue, Jun 11, 2002 at 02:07:43PM -0700, Richard Henderson wrote:
> On Tue, Jun 11, 2002 at 01:59:43PM -0700, H . J . Lu wrote:
> >    /* If no debug information was recorded, nothing to do.  */
> > -  if (all_segs == NULL && files_in_use <= 1)
> > +  if (all_segs == NULL
> > +      && (debug_type != DEBUG_DWARF2 || files_in_use <= 1))
> 
> This is wrong.  When the compiler is emitting .file and .loc
> directives, debug_type == DEBUG_NONE.
> 

I don't know what I was thinking :-). How about this patch?


H.J.
-------------- next part --------------
2002-06-11  H.J. Lu <hjl@gnu.org>

	* dwarf2dbg.c (dwarf2_finish): Output dwarf debug info only
	when needed.

--- gas/dwarf2dbg.c.dwarf	Tue Jun 11 14:29:36 2002
+++ gas/dwarf2dbg.c	Tue Jun 11 14:41:25 2002
@@ -1244,8 +1244,11 @@ dwarf2_finish ()
   segT line_seg;
   struct line_seg *s;
 
-  /* If no debug information was recorded, nothing to do.  */
-  if (all_segs == NULL && files_in_use <= 1)
+  /* If no debug information was recorded, nothing to do. Don't
+     emit dwarf debug info for one ".file" directive only unless
+     we are generating DWARF2 debugging info.  */
+  if (debug_type != DEBUG_DWARF2 && all_segs == NULL
+      && files_in_use <= 2)
     return;
 
   /* Calculate the size of an address for the target machine.  */


More information about the Binutils mailing list