Add support for defering line number table construction to assembler.
authorJim Wilson <wilson@cygnus.com>
Fri, 27 Aug 1999 02:37:40 +0000 (02:37 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 27 Aug 1999 02:37:40 +0000 (19:37 -0700)
* dwarf2out.c (DWARF2_ASM_LINE_DEBUG_INFO): Add default definition.
(debug_dwarf): Add DWARF2_ASM_LINE_DEBUG_INFO support.
(dwarf2out_line, dwarf2out_finish): Likewise.
* tm.texi (DWARF2_ASM_LINE_DEBUG_INFO): Add documetation.

From-SVN: r28910

gcc/ChangeLog
gcc/dwarf2out.c
gcc/tm.texi

index e1debc0cbc0084ff7e3a60f0fdc36091d4df8b4d..85b24a5f07a27e225c9e190b0a61de963d1c6527 100644 (file)
@@ -1,3 +1,10 @@
+Thu Aug 26 19:33:23 1999  Jim Wilson  <wilson@cygnus.com>
+
+       * dwarf2out.c (DWARF2_ASM_LINE_DEBUG_INFO): Add default definition.
+       (debug_dwarf): Add DWARF2_ASM_LINE_DEBUG_INFO support.
+       (dwarf2out_line, dwarf2out_finish): Likewise.
+       * tm.texi (DWARF2_ASM_LINE_DEBUG_INFO): Add documetation.
+
 Thu Aug 26 16:10:56 1999  Gavin Romig-Koch  <gavin@cygnus.com>
 
        * tree.c (lang_unsave_expr_now) : Correct return type.
index bcb94762fac2f1f25c026077b17cb2cc488335b8..81792b56490ae6abefc59b63b2fc4c202530fe8f 100644 (file)
@@ -2237,6 +2237,11 @@ extern char *language_string;
 #define DWARF_ARANGES_HEADER_SIZE \
   (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, PTR_SIZE * 2) - DWARF_OFFSET_SIZE)
 
+/* The default is to have gcc emit the line number tables.  */
+#ifndef DWARF2_ASM_LINE_DEBUG_INFO
+#define DWARF2_ASM_LINE_DEBUG_INFO 0
+#endif
+
 /* Define the architecture-dependent minimum instruction length (in bytes).
    In this implementation of DWARF, this field is used for information
    purposes only.  Since GCC generates assembly language, we have
@@ -4446,7 +4451,8 @@ debug_dwarf ()
 {
   print_indent = 0;
   print_die (comp_unit_die, stderr);
-  print_dwarf_line_table (stderr);
+  if (! DWARF2_ASM_LINE_DEBUG_INFO)
+    print_dwarf_line_table (stderr);
 }
 \f
 /* Traverse the DIE, and add a sibling attribute if it may have the
@@ -9850,7 +9856,27 @@ dwarf2out_line (filename, line)
     {
       function_section (current_function_decl);
 
-      if (DECL_SECTION_NAME (current_function_decl))
+      if (DWARF2_ASM_LINE_DEBUG_INFO)
+       {
+         static char *lastfile;
+
+         /* Emit the .file and .loc directives understood by GNU as.  */
+         if (lastfile == 0 || strcmp (filename, lastfile))
+           {
+             fprintf (asm_out_file, "\t.file 0 \"%s\"\n", filename);
+             lastfile = filename;
+           }
+
+         fprintf (asm_out_file, "\t.loc 0 %d 0\n", line);
+
+         /* Indicate that line number info exists.  */
+         ++line_info_table_in_use;
+
+         /* Indicate that multiple line number tables exist.  */
+         if (DECL_SECTION_NAME (current_function_decl))
+           ++separate_line_info_table_in_use;
+       }
+      else if (DECL_SECTION_NAME (current_function_decl))
        {
          register dw_separate_line_info_ref line_info;
          ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, SEPARATE_LINE_CODE_LABEL,
@@ -10097,9 +10123,12 @@ dwarf2out_finish ()
   /* Output the source line correspondence table.  */
   if (line_info_table_in_use > 1 || separate_line_info_table_in_use)
     {
-      fputc ('\n', asm_out_file);
-      ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
-      output_line_info ();
+      if (! DWARF2_ASM_LINE_DEBUG_INFO)
+       {
+         fputc ('\n', asm_out_file);
+         ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION);
+         output_line_info ();
+       }
 
       /* We can only use the low/high_pc attributes if all of the code
         was in .text.  */
index ed286fe20103c605270fafe641b6e934ba39e95b..c3e3c271f6851edd48c944146300d7e7b772549d 100644 (file)
@@ -6943,6 +6943,12 @@ label to mark the beginning of the text section.  If it is better simply
 to use the name of the text section itself, rather than an explicit label,
 to indicate the beginning of the text section, define this macro to zero.
 
+@findex DWARF2_ASM_LINE_DEBUG_INFO
+@item DWARF2_ASM_LINE_DEBUG_INFO
+Define this macro to be a nonzero value if the assembler can generate Dwarf 2
+line debug info sections.  This will result in much more compact line number
+tables, and hence is desirable if it works.
+
 @findex PUT_SDB_@dots{}
 @item PUT_SDB_@dots{}
 Define these macros to override the assembler syntax for the special