This is the mail archive of the gcc-patches@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]

[PATCH]: Dwarf2 debug emitter don't output file table when source file is without any functions


If compiled file don't have any generated code output_line_info()
function will not be called when generating Dwarf2 debug info.
But we still may have declarations with coordinates, and file numbers
from there is index in table which is not generated in that case.
File table should be generated in the beginning of .debug_line section
in that case. That patch makes compiler call output_line_info() if
there was declaration with source coordinates.

ChangeLog ENTRY =======================================================

2000-09-10  Igor Shevlyakov  <igor@windriver.com>

        * dwarf2out.c added flag_file_table_needed
	(add_src_coords_attributes): set flag when declaration is with
        coordinates.
	(dwarf2out_init): reset the flag.
	(dwarf2out_finish): check the flag and call for output_line_info
	even if line table is empty. That will at least generate file
	table.

PATCH =================================================================

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.203
diff -c -3 -p -r1.203 dwarf2out.c
*** dwarf2out.c	2000/09/11 01:50:45	1.203
--- dwarf2out.c	2000/09/12 23:42:16
*************** static unsigned separate_line_info_table
*** 3220,3225 ****
--- 3220,3229 ----
  /* Number of elements in line_info_table currently in use.  */
  static unsigned line_info_table_in_use;

+ /* Flag given 1 when there was at least one declaration with
+    coordinates so we need to meit file table in .debug_line section */
+ static int flag_file_table_needed;
+
  /* Size (in elements) of increments by which we may expand the
     line_info_table.  */
  #define LINE_INFO_TABLE_INCREMENT 1024
*************** add_src_coords_attributes (die, decl)
*** 8332,8337 ****
--- 8336,8344 ----

    add_AT_unsigned (die, DW_AT_decl_file, file_index);
    add_AT_unsigned (die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
+
+   flag_file_table_needed = 1;
+
  }

  /* Add an DW_AT_name attribute and source coordinate attribute for the
*************** dwarf2out_init (asm_out_file, main_input
*** 10781,10786 ****
--- 10788,10796 ----
    /* Zero-th entry is allocated, but unused */
    line_info_table_in_use = 1;

+   /* Reset the flag */
+   flag_file_table_needed = 0;
+
    /* Generate the initial DIE for the .debug section.  Note that the
(string)
       value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE
       will (typically) be a relative pathname and that this pathname should
be
*************** dwarf2out_finish ()
*** 10888,10894 ****
  #endif

    /* Output the source line correspondence table.  */
!   if (line_info_table_in_use > 1 || separate_line_info_table_in_use)
      {
        if (! DWARF2_ASM_LINE_DEBUG_INFO)
  	{
--- 10898,10905 ----
  #endif

    /* Output the source line correspondence table.  */
!   if (line_info_table_in_use > 1 || flag_file_table_needed ||
!       separate_line_info_table_in_use)
      {
        if (! DWARF2_ASM_LINE_DEBUG_INFO)
  	{


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