dwarf2 vs -g1

Richard Henderson rth@redhat.com
Wed May 30 18:19:00 GMT 2001


The following was exposed by a gdb segfault.

If we're not going to put anything in the .debug_line section, then we
shouldn't reference it from .debug_info.  If we do so, then we will
cause debuggers to either (1) read the debug_line data for some other
object file or (2) read garbage from beyond the end of the section or
(3) complain about broken debug info.

I'd have preferred (3) over (2), but hey, it's still gcc's fault.  ;-)


r~


        * dwarf2out.c (dwarf2out_finish): Don't emit DW_AT_stmt_list at -g1.

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.242.2.18
diff -c -p -d -r1.242.2.18 dwarf2out.c
*** dwarf2out.c	2001/05/21 23:29:41	1.242.2.18
--- dwarf2out.c	2001/05/31 01:11:23
*************** dwarf2out_finish ()
*** 11292,11299 ****
        add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
      }
  
!   add_AT_lbl_offset (comp_unit_die, DW_AT_stmt_list,
! 		     debug_line_section_label);
  
  #if 0 /* unimplemented */
    if (debug_info_level >= DINFO_LEVEL_VERBOSE && primary)
--- 11332,11340 ----
        add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
      }
  
!   if (debug_info_level >= DINFO_LEVEL_NORMAL)
!     add_AT_lbl_offset (comp_unit_die, DW_AT_stmt_list,
! 		       debug_line_section_label);
  
  #if 0 /* unimplemented */
    if (debug_info_level >= DINFO_LEVEL_VERBOSE && primary)



More information about the Gcc-patches mailing list