OSDN Git Service

x
authormerrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Nov 1996 07:14:08 +0000 (07:14 +0000)
committermerrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Nov 1996 07:14:08 +0000 (07:14 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13160 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-lex.c
gcc/config/mips/iris6.h
gcc/config/mips/mips.h
gcc/config/svr4.h
gcc/dwarf2out.c
gcc/dwarfout.c
gcc/final.c
gcc/flags.h
gcc/toplev.c
gcc/varasm.c

index 2bf9153..b9c2190 100644 (file)
@@ -434,12 +434,8 @@ check_newline ()
              && getc (finput) == 'e'
              && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
            {
              && getc (finput) == 'e'
              && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
            {
-#ifdef DWARF_DEBUGGING_INFO
-             if (c != '\n'
-                 && (debug_info_level == DINFO_LEVEL_VERBOSE)
-                 && (write_symbols == DWARF_DEBUG))
-               dwarfout_define (lineno, get_directive_line (finput));
-#endif /* DWARF_DEBUGGING_INFO */
+             if (c != '\n')
+               debug_define (lineno, get_directive_line (finput));
              goto skipline;
            }
        }
              goto skipline;
            }
        }
@@ -451,12 +447,8 @@ check_newline ()
              && getc (finput) == 'f'
              && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
            {
              && getc (finput) == 'f'
              && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
            {
-#ifdef DWARF_DEBUGGING_INFO
-             if (c != '\n'
-                 && (debug_info_level == DINFO_LEVEL_VERBOSE)
-                 && (write_symbols == DWARF_DEBUG))
-               dwarfout_undef (lineno, get_directive_line (finput));
-#endif /* DWARF_DEBUGGING_INFO */
+             if (c != '\n')
+               debug_undef (lineno, get_directive_line (finput));
              goto skipline;
            }
        }
              goto skipline;
            }
        }
@@ -608,16 +600,7 @@ linenum:
              p->name = input_filename;
              input_file_stack = p;
              input_file_stack_tick++;
              p->name = input_filename;
              input_file_stack = p;
              input_file_stack_tick++;
-#ifdef DBX_DEBUGGING_INFO
-             if (write_symbols == DBX_DEBUG)
-               dbxout_start_new_source_file (input_filename);
-#endif
-#ifdef DWARF_DEBUGGING_INFO
-             if (debug_info_level == DINFO_LEVEL_VERBOSE
-                 && write_symbols == DWARF_DEBUG)
-               dwarfout_start_new_source_file (input_filename);
-#endif /* DWARF_DEBUGGING_INFO */
-
+             debug_start_source_file (input_filename);
              used_up = 1;
            }
          else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
              used_up = 1;
            }
          else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
@@ -629,15 +612,7 @@ linenum:
                  input_file_stack = p->next;
                  free (p);
                  input_file_stack_tick++;
                  input_file_stack = p->next;
                  free (p);
                  input_file_stack_tick++;
-#ifdef DBX_DEBUGGING_INFO
-                 if (write_symbols == DBX_DEBUG)
-                   dbxout_resume_previous_source_file ();
-#endif
-#ifdef DWARF_DEBUGGING_INFO
-                 if (debug_info_level == DINFO_LEVEL_VERBOSE
-                     && write_symbols == DWARF_DEBUG)
-                   dwarfout_resume_previous_source_file (input_file_stack->line);
-#endif /* DWARF_DEBUGGING_INFO */
+                 debug_end_source_file (input_file_stack->line);
                }
              else
                error ("#-lines for entering and leaving files don't match");
                }
              else
                error ("#-lines for entering and leaving files don't match");
index 03cbf5f..c994b7f 100644 (file)
@@ -88,12 +88,11 @@ Boston, MA 02111-1307, USA.  */
 %{mabi=64: -D__mips64} \
 %{!mabi*: -D__mips64}"
 
 %{mabi=64: -D__mips64} \
 %{!mabi*: -D__mips64}"
 
-/* Irix 6 uses DWARF.  */
-#define DWARF_DEBUGGING_INFO
-#define DWARF_VERSION 2
+/* Irix 6 uses DWARF-2.  */
+#define DWARF2_DEBUGGING_INFO
 #define MIPS_DEBUGGING_INFO
 #undef PREFERRED_DEBUGGING_TYPE
 #define MIPS_DEBUGGING_INFO
 #undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
 /* The size in bytes of a DWARF field indicating an offset or length
    relative to a debug info section, specified to be 4 bytes in the DWARF-2
 
 /* The size in bytes of a DWARF field indicating an offset or length
    relative to a debug info section, specified to be 4 bytes in the DWARF-2
@@ -479,7 +478,7 @@ do {                                                                         \
 #define LINK_SPEC "\
 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
 %{bestGnum} %{shared} %{non_shared} \
 #define LINK_SPEC "\
 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
 %{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
+%{call_shared} %{no_archive} %{exact_version} %{w} \
 %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
 %{rpath} -init __do_global_ctors -fini __do_global_dtors \
 %{shared:-hidden_symbol __do_global_ctors,__do_global_dtors} \
 %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
 %{rpath} -init __do_global_ctors -fini __do_global_dtors \
 %{shared:-hidden_symbol __do_global_ctors,__do_global_dtors} \
index 624fdf7..112b658 100644 (file)
@@ -880,7 +880,7 @@ while (0)
 #define MIPS_DEBUGGING_INFO            /* MIPS specific debugging info */
 
 #ifndef PREFERRED_DEBUGGING_TYPE       /* assume SDB_DEBUGGING_INFO */
 #define MIPS_DEBUGGING_INFO            /* MIPS specific debugging info */
 
 #ifndef PREFERRED_DEBUGGING_TYPE       /* assume SDB_DEBUGGING_INFO */
-#define PREFERRED_DEBUGGING_TYPE ((len > 1 && !strncmp (str, "ggdb", len)) ? DBX_DEBUG : SDB_DEBUG)
+#define PREFERRED_DEBUGGING_TYPE ((!strncmp (str, "ggdb", 4)) ? DBX_DEBUG : SDB_DEBUG)
 #endif
 
 /* By default, turn on GDB extensions.  */
 #endif
 
 /* By default, turn on GDB extensions.  */
index 80997ee..506d1d1 100644 (file)
@@ -245,6 +245,10 @@ do {                                                               \
 
 #define DWARF_DEBUGGING_INFO
 
 
 #define DWARF_DEBUGGING_INFO
 
+/* All ELF targets can support DWARF-2.  */
+
+#define DWARF2_DEBUGGING_INFO
+
 /* The numbers used to denote specific machine registers in the System V
    Release 4 DWARF debugging information are quite likely to be totally
    different from the numbers used in BSD stabs debugging information
 /* The numbers used to denote specific machine registers in the System V
    Release 4 DWARF debugging information are quite likely to be totally
    different from the numbers used in BSD stabs debugging information
index 51c58ff..1a0836c 100644 (file)
@@ -21,10 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "config.h"
 
 
 #include "config.h"
 
-#ifndef DWARF_VERSION
-#define DWARF_VERSION 1
-#endif
-#if defined (DWARF_DEBUGGING_INFO) && (DWARF_VERSION == 2)
+#ifdef DWARF2_DEBUGGING_INFO
 #include <stdio.h>
 #include "dwarf2.h"
 #include "tree.h"
 #include <stdio.h>
 #include "dwarf2.h"
 #include "tree.h"
@@ -321,6 +318,8 @@ extern char *language_string;
 #define DWARF_OFFSET_SIZE 4
 #endif
 
 #define DWARF_OFFSET_SIZE 4
 #endif
 
+#define DWARF_VERSION 2
+
 /* Fixed size portion of the DWARF compilation unit header.  */
 #define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3)
 
 /* Fixed size portion of the DWARF compilation unit header.  */
 #define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3)
 
@@ -405,7 +404,7 @@ static unsigned file_table_in_use;
 #define FILE_TABLE_INCREMENT 64
 
 /* Local pointer to the name of the main input file.  Initialized in
 #define FILE_TABLE_INCREMENT 64
 
 /* Local pointer to the name of the main input file.  Initialized in
-   dwarfout_init.  */
+   dwarf2out_init.  */
 static char *primary_filename;
 
 /* For Dwarf output, we must assign lexical-blocks id numbers in the order in
 static char *primary_filename;
 
 /* For Dwarf output, we must assign lexical-blocks id numbers in the order in
@@ -5617,7 +5616,7 @@ add_location_or_const_value_attribute (die, decl)
      (at debug-time) will show the function as having been called with the
      *new* value rather than the value which was originally passed in.  This
      happens rarely enough that it is not a major problem, but it *is* a
      (at debug-time) will show the function as having been called with the
      *new* value rather than the value which was originally passed in.  This
      happens rarely enough that it is not a major problem, but it *is* a
-     problem, and I'd like to fix it.  A future version of dwarfout.c may
+     problem, and I'd like to fix it.  A future version of dwarf2out.c may
      generate two additional attributes for any given DW_TAG_formal_parameter 
      DIE which will describe the "passed type" and the "passed location" for
      the given formal parameter in addition to the attributes we now generate 
      generate two additional attributes for any given DW_TAG_formal_parameter 
      DIE which will describe the "passed type" and the "passed location" for
      the given formal parameter in addition to the attributes we now generate 
@@ -6197,7 +6196,7 @@ decl_start_label (decl)
 
 /* These routines generate the internnal representation of the DIE's for
    the compilation unit.  Debugging information is collected by walking
 
 /* These routines generate the internnal representation of the DIE's for
    the compilation unit.  Debugging information is collected by walking
-   the declaration trees passed in from dwarfout_file_scope_decl().  */
+   the declaration trees passed in from dwarf2out_file_scope_decl().  */
 
 static void
 gen_array_type_die (type, context_die)
 
 static void
 gen_array_type_die (type, context_die)
@@ -7626,7 +7625,7 @@ gen_decl_die (decl, context_die)
 \f
 /***************** Debug Information Generation Hooks ***********************/
 void
 \f
 /***************** Debug Information Generation Hooks ***********************/
 void
-dwarfout_file_scope_decl (decl, set_finalizing)
+dwarf2out_file_scope_decl (decl, set_finalizing)
      register tree decl;
      register int set_finalizing;
 {
      register tree decl;
      register int set_finalizing;
 {
@@ -7755,7 +7754,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
 /* Output a marker (i.e. a label) for the beginning of the generated code for
    a lexical block.  */
 void
 /* Output a marker (i.e. a label) for the beginning of the generated code for
    a lexical block.  */
 void
-dwarfout_begin_block (blocknum)
+dwarf2out_begin_block (blocknum)
      register unsigned blocknum;
 {
   function_section (current_function_decl);
      register unsigned blocknum;
 {
   function_section (current_function_decl);
@@ -7765,7 +7764,7 @@ dwarfout_begin_block (blocknum)
 /* Output a marker (i.e. a label) for the end of the generated code for a
    lexical block.  */
 void
 /* Output a marker (i.e. a label) for the end of the generated code for a
    lexical block.  */
 void
-dwarfout_end_block (blocknum)
+dwarf2out_end_block (blocknum)
      register unsigned blocknum;
 {
   function_section (current_function_decl);
      register unsigned blocknum;
 {
   function_section (current_function_decl);
@@ -7775,7 +7774,7 @@ dwarfout_end_block (blocknum)
 /* Output a marker (i.e. a label) at a point in the assembly code which
    corresponds to a given source level label.  */
 void
 /* Output a marker (i.e. a label) at a point in the assembly code which
    corresponds to a given source level label.  */
 void
-dwarfout_label (insn)
+dwarf2out_label (insn)
      register rtx insn;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
      register rtx insn;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
@@ -7791,7 +7790,7 @@ dwarfout_label (insn)
 /* Output a marker (i.e. a label) for the beginning of a function, before
    the prologue.  */
 void
 /* Output a marker (i.e. a label) for the beginning of a function, before
    the prologue.  */
 void
-dwarfout_begin_prologue ()
+dwarf2out_begin_prologue ()
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
   register dw_fde_ref fde;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
   register dw_fde_ref fde;
@@ -7825,7 +7824,7 @@ dwarfout_begin_prologue ()
    the real body of the function begins (after parameters have been moved to
    their home locations).  */
 void
    the real body of the function begins (after parameters have been moved to
    their home locations).  */
 void
-dwarfout_begin_function ()
+dwarf2out_begin_function ()
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
   register long int offset;
 {
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
   register long int offset;
@@ -7919,7 +7918,7 @@ dwarfout_begin_function ()
 /* Output a marker (i.e. a label) for the point in the generated code where
    the real body of the function ends (just before the epilogue code).  */
 void
 /* Output a marker (i.e. a label) for the point in the generated code where
    the real body of the function ends (just before the epilogue code).  */
 void
-dwarfout_end_function ()
+dwarf2out_end_function ()
 {
   dw_fde_ref fde;
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 {
   dw_fde_ref fde;
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
@@ -7935,7 +7934,7 @@ dwarfout_end_function ()
    for a function definition.  This gets called *after* the epilogue code has
    been generated.  */
 void
    for a function definition.  This gets called *after* the epilogue code has
    been generated.  */
 void
-dwarfout_end_epilogue ()
+dwarf2out_end_epilogue ()
 {
   dw_fde_ref fde;
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 {
   dw_fde_ref fde;
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
@@ -7948,7 +7947,7 @@ dwarfout_end_epilogue ()
 }
 
 /* Lookup a filename (in the list of filenames that we know about here in
 }
 
 /* Lookup a filename (in the list of filenames that we know about here in
-   dwarfout.c) and return its "index".  The index of each (known) filename is
+   dwarf2out.c) and return its "index".  The index of each (known) filename is
    just a unique number which is associated with only that one filename.
    We need such numbers for the sake of generating labels
    (in the .debug_sfnames section) and references to those
    just a unique number which is associated with only that one filename.
    We need such numbers for the sake of generating labels
    (in the .debug_sfnames section) and references to those
@@ -8007,7 +8006,7 @@ lookup_filename (file_name)
    and record information relating to this source line, in
    'line_info_table' for later output of the .debug_line section.  */
 void
    and record information relating to this source line, in
    'line_info_table' for later output of the .debug_line section.  */
 void
-dwarfout_line (filename, line)
+dwarf2out_line (filename, line)
      register char *filename;
      register unsigned line;
 {
      register char *filename;
      register unsigned line;
 {
@@ -8067,16 +8066,15 @@ dwarfout_line (filename, line)
 /* Record the beginning of a new source file, for later output
    of the .debug_macinfo section.  At present, unimplemented.  */
 void
 /* Record the beginning of a new source file, for later output
    of the .debug_macinfo section.  At present, unimplemented.  */
 void
-dwarfout_start_new_source_file (filename)
+dwarf2out_start_source_file (filename)
      register char *filename;
 {
 }
 
      register char *filename;
 {
 }
 
-/* Record the resumption of a source file, for later output
+/* Record the end of a source file, for later output
    of the .debug_macinfo section.  At present, unimplemented.  */
 void
    of the .debug_macinfo section.  At present, unimplemented.  */
 void
-dwarfout_resume_previous_source_file (lineno)
-     register unsigned lineno;
+dwarf2out_end_source_file ()
 {
 }
 
 {
 }
 
@@ -8084,14 +8082,14 @@ dwarfout_resume_previous_source_file (lineno)
    the tail part of the directive line, i.e. the part which is past the
    initial whitespace, #, whitespace, directive-name, whitespace part.  */
 void
    the tail part of the directive line, i.e. the part which is past the
    initial whitespace, #, whitespace, directive-name, whitespace part.  */
 void
-dwarfout_define (lineno, buffer)
+dwarf2out_define (lineno, buffer)
      register unsigned lineno;
      register char *buffer;
 {
   static int initialized = 0;
   if (!initialized)
     {
      register unsigned lineno;
      register char *buffer;
 {
   static int initialized = 0;
   if (!initialized)
     {
-      dwarfout_start_new_source_file (primary_filename);
+      dwarf2out_start_source_file (primary_filename);
       initialized = 1;
     }
 }
       initialized = 1;
     }
 }
@@ -8100,7 +8098,7 @@ dwarfout_define (lineno, buffer)
    the tail part of the directive line, i.e. the part which is past the
    initial whitespace, #, whitespace, directive-name, whitespace part.  */
 void
    the tail part of the directive line, i.e. the part which is past the
    initial whitespace, #, whitespace, directive-name, whitespace part.  */
 void
-dwarfout_undef (lineno, buffer)
+dwarf2out_undef (lineno, buffer)
      register unsigned lineno;
      register char *buffer;
 {
      register unsigned lineno;
      register char *buffer;
 {
@@ -8108,7 +8106,7 @@ dwarfout_undef (lineno, buffer)
 
 /* Set up for Dwarf output at the start of compilation.  */
 void
 
 /* Set up for Dwarf output at the start of compilation.  */
 void
-dwarfout_init (asm_out_file, main_input_filename)
+dwarf2out_init (asm_out_file, main_input_filename)
      register FILE *asm_out_file;
      register char *main_input_filename;
 {
      register FILE *asm_out_file;
      register char *main_input_filename;
 {
@@ -8185,7 +8183,7 @@ dwarfout_init (asm_out_file, main_input_filename)
 /* Output stuff that dwarf requires at the end of every file,
    and generate the DWARF-2 debugging info.  */
 void
 /* Output stuff that dwarf requires at the end of every file,
    and generate the DWARF-2 debugging info.  */
 void
-dwarfout_finish ()
+dwarf2out_finish ()
 {
   /* Traverse the DIE tree and add sibling attributes to those DIE's
      that have children.  */
 {
   /* Traverse the DIE tree and add sibling attributes to those DIE's
      that have children.  */
@@ -8266,4 +8264,4 @@ dwarfout_finish ()
       output_aranges ();
     }
 }
       output_aranges ();
     }
 }
-#endif /* DWARF_DEBUGGING_INFO  && DWARF_VERSION == 2 */
+#endif /* DWARF2_DEBUGGING_INFO */
index c1ea559..5206ebd 100644 (file)
@@ -21,10 +21,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 
 
 #include "config.h"
 
-#ifndef DWARF_VERSION
-#define DWARF_VERSION 1
-#endif
-#if defined (DWARF_DEBUGGING_INFO) && (DWARF_VERSION != 2)
+#ifdef DWARF_DEBUGGING_INFO
 #include <stdio.h>
 #include "dwarf.h"
 #include "tree.h"
 #include <stdio.h>
 #include "dwarf.h"
 #include "tree.h"
@@ -5734,4 +5731,4 @@ dwarfout_finish ()
     }
 }
 
     }
 }
 
-#endif /* DWARF_DEBUGGING_INFO && DWARF_VERSION != 2 */
+#endif /* DWARF_DEBUGGING_INFO */
index 54eb26b..107a893 100644 (file)
@@ -895,10 +895,10 @@ final_start_function (first, file, optimize)
     last_linenum = high_block_linenum = high_function_linenum
       = NOTE_LINE_NUMBER (first);
 
     last_linenum = high_block_linenum = high_function_linenum
       = NOTE_LINE_NUMBER (first);
 
-#if defined (DWARF_DEBUGGING_INFO) && DWARF_VERSION == 2
+#ifdef DWARF2_DEBUGGING_INFO
   /* Output DWARF definition of the function.  */
   /* Output DWARF definition of the function.  */
-  if (write_symbols == DWARF_DEBUG)
-    dwarfout_begin_prologue ();
+  if (write_symbols == DWARF2_DEBUG)
+    dwarf2out_begin_prologue ();
 #endif
 
   /* For SDB and XCOFF, the function beginning must be marked between
 #endif
 
   /* For SDB and XCOFF, the function beginning must be marked between
@@ -1066,6 +1066,11 @@ final_end_function (first, file, optimize)
     dwarfout_end_function ();
 #endif
 
     dwarfout_end_function ();
 #endif
 
+#ifdef DWARF2_DEBUGGING_INFO
+  if (write_symbols == DWARF2_DEBUG)
+    dwarf2out_end_function ();
+#endif
+
 #ifdef XCOFF_DEBUGGING_INFO
   if (write_symbols == XCOFF_DEBUG)
     xcoffout_end_function (file, high_function_linenum);
 #ifdef XCOFF_DEBUGGING_INFO
   if (write_symbols == XCOFF_DEBUG)
     xcoffout_end_function (file, high_function_linenum);
@@ -1087,6 +1092,11 @@ final_end_function (first, file, optimize)
     dwarfout_end_epilogue ();
 #endif
 
     dwarfout_end_epilogue ();
 #endif
 
+#ifdef DWARF2_DEBUGGING_INFO
+  if (write_symbols == DWARF2_DEBUG)
+    dwarf2out_end_epilogue ();
+#endif
+
 #ifdef XCOFF_DEBUGGING_INFO
   if (write_symbols == XCOFF_DEBUG)
     xcoffout_end_epilogue (file);
 #ifdef XCOFF_DEBUGGING_INFO
   if (write_symbols == XCOFF_DEBUG)
     xcoffout_end_epilogue (file);
@@ -1365,6 +1375,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
          if (write_symbols == DWARF_DEBUG)
            dwarfout_begin_function ();
 #endif
          if (write_symbols == DWARF_DEBUG)
            dwarfout_begin_function ();
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+         /* This outputs a marker where the function body starts, so it
+            must be after the prologue.  */
+         if (write_symbols == DWARF2_DEBUG)
+           dwarf2out_begin_function ();
+#endif
          break;
        }
       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
          break;
        }
       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
@@ -1377,11 +1393,8 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
          && (debug_info_level == DINFO_LEVEL_NORMAL
              || debug_info_level == DINFO_LEVEL_VERBOSE
       if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
          && (debug_info_level == DINFO_LEVEL_NORMAL
              || debug_info_level == DINFO_LEVEL_VERBOSE
-#ifdef DWARF_DEBUGGING_INFO
              || write_symbols == DWARF_DEBUG
              || write_symbols == DWARF_DEBUG
-#endif
-            )
-        )
+             || write_symbols == DWARF2_DEBUG))
        {
          /* Beginning of a symbol-block.  Assign it a sequence number
             and push the number onto the stack PENDING_BLOCKS.  */
        {
          /* Beginning of a symbol-block.  Assign it a sequence number
             and push the number onto the stack PENDING_BLOCKS.  */
@@ -1416,17 +1429,18 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
          if (write_symbols == DWARF_DEBUG)
            dwarfout_begin_block (next_block_index);
 #endif
          if (write_symbols == DWARF_DEBUG)
            dwarfout_begin_block (next_block_index);
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+         if (write_symbols == DWARF2_DEBUG)
+           dwarf2out_begin_block (next_block_index);
+#endif
 
          next_block_index++;
        }
       else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END
               && (debug_info_level == DINFO_LEVEL_NORMAL
                   || debug_info_level == DINFO_LEVEL_VERBOSE
 
          next_block_index++;
        }
       else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END
               && (debug_info_level == DINFO_LEVEL_NORMAL
                   || debug_info_level == DINFO_LEVEL_VERBOSE
-#ifdef DWARF_DEBUGGING_INFO
                   || write_symbols == DWARF_DEBUG
                   || write_symbols == DWARF_DEBUG
-#endif
-                 )
-             )
+                  || write_symbols == DWARF2_DEBUG))
        {
          /* End of a symbol-block.  Pop its sequence number off
             PENDING_BLOCKS and output debugging info based on that.  */
        {
          /* End of a symbol-block.  Pop its sequence number off
             PENDING_BLOCKS and output debugging info based on that.  */
@@ -1452,6 +1466,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
          if (write_symbols == DWARF_DEBUG && block_depth >= 0)
            dwarfout_end_block (pending_blocks[block_depth]);
 #endif
          if (write_symbols == DWARF_DEBUG && block_depth >= 0)
            dwarfout_end_block (pending_blocks[block_depth]);
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+         if (write_symbols == DWARF2_DEBUG && block_depth >= 0)
+           dwarf2out_end_block (pending_blocks[block_depth]);
+#endif
        }
       else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL
               && (debug_info_level == DINFO_LEVEL_NORMAL
        }
       else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL
               && (debug_info_level == DINFO_LEVEL_NORMAL
@@ -1461,6 +1479,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
           if (write_symbols == DWARF_DEBUG)
             dwarfout_label (insn);
 #endif
           if (write_symbols == DWARF_DEBUG)
             dwarfout_label (insn);
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+          if (write_symbols == DWARF2_DEBUG)
+            dwarf2out_label (insn);
+#endif
        }
       else if (NOTE_LINE_NUMBER (insn) > 0)
        /* This note is a line-number.  */
        }
       else if (NOTE_LINE_NUMBER (insn) > 0)
        /* This note is a line-number.  */
@@ -1537,6 +1559,10 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
       if (write_symbols == DWARF_DEBUG && LABEL_NAME (insn))
        dwarfout_label (insn);
 #endif
       if (write_symbols == DWARF_DEBUG && LABEL_NAME (insn))
        dwarfout_label (insn);
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+      if (write_symbols == DWARF2_DEBUG && LABEL_NAME (insn))
+       dwarf2out_label (insn);
+#endif
       if (app_on)
        {
          fprintf (file, ASM_APP_OFF);
       if (app_on)
        {
          fprintf (file, ASM_APP_OFF);
@@ -2156,6 +2182,11 @@ output_source_line (file, insn)
       if (write_symbols == DWARF_DEBUG)
        dwarfout_line (filename, NOTE_LINE_NUMBER (insn));
 #endif
       if (write_symbols == DWARF_DEBUG)
        dwarfout_line (filename, NOTE_LINE_NUMBER (insn));
 #endif
+
+#ifdef DWARF2_DEBUGGING_INFO
+      if (write_symbols == DWARF2_DEBUG)
+       dwarf2out_line (filename, NOTE_LINE_NUMBER (insn));
+#endif
     }
 }
 \f
     }
 }
 \f
index 222a675..df51e52 100644 (file)
@@ -27,6 +27,7 @@ enum debug_info_type
   DBX_DEBUG,       /* Write BSD .stabs for DBX (using dbxout.c).  */
   SDB_DEBUG,       /* Write COFF for (old) SDB (using sdbout.c).  */
   DWARF_DEBUG,     /* Write Dwarf debug info (using dwarfout.c).  */
   DBX_DEBUG,       /* Write BSD .stabs for DBX (using dbxout.c).  */
   SDB_DEBUG,       /* Write COFF for (old) SDB (using sdbout.c).  */
   DWARF_DEBUG,     /* Write Dwarf debug info (using dwarfout.c).  */
+  DWARF2_DEBUG,            /* Write Dwarf v2 debug info (using dwarf2out.c).  */
   XCOFF_DEBUG      /* Write IBM/Xcoff debug info (using dbxout.c).  */
 };
 
   XCOFF_DEBUG      /* Write IBM/Xcoff debug info (using dbxout.c).  */
 };
 
index 96fa07a..a08b598 100644 (file)
@@ -97,7 +97,7 @@ vms_fopen (fname, type)
    PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way. 
 
    This is one long line cause VAXC can't handle a \-newline.  */
    PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way. 
 
    This is one long line cause VAXC can't handle a \-newline.  */
-#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
+#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
 #ifndef PREFERRED_DEBUGGING_TYPE
 You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
 #endif /* no PREFERRED_DEBUGGING_TYPE */
 #ifndef PREFERRED_DEBUGGING_TYPE
 You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
 #endif /* no PREFERRED_DEBUGGING_TYPE */
@@ -112,6 +112,9 @@ You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
 #ifdef DWARF_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
 #endif
 #ifdef DWARF_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#endif
 #ifdef XCOFF_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
 #endif
 #ifdef XCOFF_DEBUGGING_INFO
 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
 #endif
@@ -2315,6 +2318,10 @@ compile_file (name)
   if (write_symbols == DWARF_DEBUG)
     TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
 #endif
   if (write_symbols == DWARF_DEBUG)
     TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+  if (write_symbols == DWARF2_DEBUG)
+    TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
+#endif
 
   /* Initialize yet another pass.  */
 
 
   /* Initialize yet another pass.  */
 
@@ -2523,6 +2530,16 @@ compile_file (name)
            && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
          TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
 #endif
            && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
          TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+       /* Output DWARF2 information for file-scope tentative data object
+          declarations, file-scope (extern) function declarations (which
+          had no corresponding body) and file-scope tagged type declarations
+          and definitions which have not yet been forced out.  */
+
+       if (write_symbols == DWARF2_DEBUG
+           && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
+         TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 1));
+#endif
       }
   }
 
       }
   }
 
@@ -2547,6 +2564,14 @@ compile_file (name)
             });
 #endif
 
             });
 #endif
 
+#ifdef DWARF2_DEBUGGING_INFO
+  if (write_symbols == DWARF2_DEBUG)
+    TIMEVAR (symout_time,
+            {
+              dwarf2out_finish ();
+            });
+#endif
+
   /* Output some stuff at end of file if nec.  */
 
   if (!output_bytecode)
   /* Output some stuff at end of file if nec.  */
 
   if (!output_bytecode)
@@ -2756,6 +2781,11 @@ rest_of_type_compilation (type, toplev)
   if (write_symbols == DWARF_DEBUG && toplev)
     TIMEVAR (symout_time, dwarfout_file_scope_decl (TYPE_STUB_DECL (type), 0));
 #endif
   if (write_symbols == DWARF_DEBUG && toplev)
     TIMEVAR (symout_time, dwarfout_file_scope_decl (TYPE_STUB_DECL (type), 0));
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+  /* Don't write out function-scope types here.  */
+  if (write_symbols == DWARF2_DEBUG && toplev)
+    TIMEVAR (symout_time, dwarf2out_file_scope_decl (TYPE_STUB_DECL (type), 0));
+#endif
 }
 
 /* This is called from finish_function (within yyparse)
 }
 
 /* This is called from finish_function (within yyparse)
@@ -2863,6 +2893,17 @@ rest_of_compilation (decl)
                  set_decl_abstract_flags (decl, 0);
                }
 #endif
                  set_decl_abstract_flags (decl, 0);
                }
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+             /* Generate the DWARF2 info for the "abstract" instance
+                of a function which we may later generate inlined and/or
+                out-of-line instances of.  */
+             if (write_symbols == DWARF2_DEBUG)
+               {
+                 set_decl_abstract_flags (decl, 1);
+                 TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 0));
+                 set_decl_abstract_flags (decl, 0);
+               }
+#endif
              TIMEVAR (integration_time, save_for_inline_nocopy (decl));
              RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
              goto exit_rest_of_compilation;
              TIMEVAR (integration_time, save_for_inline_nocopy (decl));
              RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
              goto exit_rest_of_compilation;
@@ -2885,6 +2926,18 @@ rest_of_compilation (decl)
              set_decl_abstract_flags (decl, 0);
            }
 #endif
              set_decl_abstract_flags (decl, 0);
            }
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+         /* Generate the DWARF2 info for the "abstract" instance of
+            a function which we will generate an out-of-line instance
+            of almost immediately (and which we may also later generate
+            various inlined instances of).  */
+         if (write_symbols == DWARF2_DEBUG)
+           {
+             set_decl_abstract_flags (decl, 1);
+             TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 0));
+             set_decl_abstract_flags (decl, 0);
+           }
+#endif
          saved_block_tree = DECL_INITIAL (decl);
          saved_arguments = DECL_ARGUMENTS (decl);
          TIMEVAR (integration_time, save_for_inline_copying (decl));
          saved_block_tree = DECL_INITIAL (decl);
          saved_arguments = DECL_ARGUMENTS (decl);
          TIMEVAR (integration_time, save_for_inline_copying (decl));
@@ -3376,6 +3429,11 @@ rest_of_compilation (decl)
     TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
 #endif
 
     TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
 #endif
 
+#ifdef DWARF2_DEBUGGING_INFO
+  if (write_symbols == DWARF2_DEBUG)
+    TIMEVAR (symout_time, dwarf2out_file_scope_decl (decl, 0));
+#endif
+
  exit_rest_of_compilation:
 
   /* In case the function was not output,
  exit_rest_of_compilation:
 
   /* In case the function was not output,
@@ -3818,8 +3876,6 @@ main (argc, argv, envp)
            }
          else if (str[0] == 'g')
            {
            }
          else if (str[0] == 'g')
            {
-             char *p = str + 1;
-             char *q;
              unsigned len;
              unsigned level;
              /* A lot of code assumes write_symbols == NO_DEBUG if the
              unsigned len;
              unsigned level;
              /* A lot of code assumes write_symbols == NO_DEBUG if the
@@ -3847,8 +3903,19 @@ main (argc, argv, envp)
                { "gstabs+", DBX_DEBUG, 1 },
 #endif
 #ifdef DWARF_DEBUGGING_INFO
                { "gstabs+", DBX_DEBUG, 1 },
 #endif
 #ifdef DWARF_DEBUGGING_INFO
+               { "gdwarf-1", DWARF_DEBUG, 0 },
+               { "gdwarf-1+", DWARF_DEBUG, 1 },
+#endif
+#ifdef DWARF2_DEBUGGING_INFO
+               { "gdwarf-2", DWARF2_DEBUG, 0 },
+#endif
+#if defined (DWARF_DEBUGGING_INFO) || defined (DWARF2_DEBUGGING_INFO)
+#if PREFERRED_DEBUGGING_TYPE == DWARF_DEBUG || !defined (DWARF2_DEBUGGING_INFO)
                { "gdwarf", DWARF_DEBUG, 0 },
                { "gdwarf+", DWARF_DEBUG, 1 },
                { "gdwarf", DWARF_DEBUG, 0 },
                { "gdwarf+", DWARF_DEBUG, 1 },
+#else
+               { "gdwarf", DWARF2_DEBUG, 0 },
+#endif
 #endif
 #ifdef XCOFF_DEBUGGING_INFO
                { "gxcoff", XCOFF_DEBUG, 0 },
 #endif
 #ifdef XCOFF_DEBUGGING_INFO
                { "gxcoff", XCOFF_DEBUG, 0 },
@@ -3861,36 +3928,38 @@ main (argc, argv, envp)
              };
              /* Indexed by enum debug_info_type.  */
              static char *debug_type_names[] = {
              };
              /* Indexed by enum debug_info_type.  */
              static char *debug_type_names[] = {
-               "none", "stabs", "coff", "dwarf", "xcoff"
+               "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
              };
 
              };
 
-             while (*p && (*p < '0' || *p > '9'))
-               p++;
-             len = p - str;
-             q = p;
-             while (*q && (*q >= '0' && *q <= '9'))
-               q++;
-             if (*p)
-               level = atoi (p);
-             else
-               level = 2;      /* default debugging info level */
-             if (*q || level > 3)
-               {
-                 warning ("invalid debug level specification in option: `-%s'",
-                          str);
-                 /* ??? This error message is incorrect in the case of
-                    -g4 -g.  */
-                 warning ("no debugging information will be generated");
-                 level = 0;
-               }
-
              /* Look up STR in the table.  */
              for (da = debug_args; da->arg; da++)
                {
              /* Look up STR in the table.  */
              for (da = debug_args; da->arg; da++)
                {
-                 if (! strncmp (str, da->arg, len))
+                 if (! strncmp (str, da->arg, strlen (da->arg)))
                    {
                      enum debug_info_type type = da->debug_type;
                    {
                      enum debug_info_type type = da->debug_type;
-                     /* ??? A few targets use STR and LEN in the
+                     char *p, *q;
+
+                     p = str + strlen (da->arg);
+                     if (*p && (*p < '0' || *p > '9'))
+                       continue;
+                     q = p;
+                     while (*q && (*q >= '0' && *q <= '9'))
+                       q++;
+                     if (*p)
+                       level = atoi (p);
+                     else
+                       level = 2;      /* default debugging info level */
+                     if (*q || level > 3)
+                       {
+                         warning ("invalid debug level specification in option: `-%s'",
+                                  str);
+                         /* ??? This error message is incorrect in the case of
+                            -g4 -g.  */
+                         warning ("no debugging information will be generated");
+                         level = 0;
+                       }
+
+                     /* ??? A few targets use STR in the
                         definition of PREFERRED_DEBUGGING_TYPE!  */
                      if (type == NO_DEBUG)
                        type = PREFERRED_DEBUGGING_TYPE;
                         definition of PREFERRED_DEBUGGING_TYPE!  */
                      if (type == NO_DEBUG)
                        type = PREFERRED_DEBUGGING_TYPE;
@@ -4233,3 +4302,90 @@ print_switch_values (file, pos, max, indent, sep, term)
 
   fprintf (file, "%s", term);
 }
 
   fprintf (file, "%s", term);
 }
+
+/* Record the beginning of a new source file, named FILENAME.  */
+
+void
+debug_start_source_file (filename)
+     register char *filename;
+{
+#ifdef DBX_DEBUGGING_INFO
+  if (write_symbols == DBX_DEBUG)
+    dbxout_start_new_source_file (filename);
+#endif
+#ifdef DWARF_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF_DEBUG)
+    dwarfout_start_new_source_file (filename);
+#endif /* DWARF_DEBUGGING_INFO */
+#ifdef DWARF2_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF2_DEBUG)
+    dwarf2out_start_source_file (filename);
+#endif /* DWARF2_DEBUGGING_INFO */  
+}
+
+/* Record the resumption of a source file.  LINENO is the line number in
+   the source file we are returning to.  */
+
+void
+debug_end_source_file (lineno)
+     register unsigned lineno;
+{
+#ifdef DBX_DEBUGGING_INFO
+  if (write_symbols == DBX_DEBUG)
+    dbxout_resume_previous_source_file ();
+#endif
+#ifdef DWARF_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF_DEBUG)
+    dwarfout_resume_previous_source_file (lineno);
+#endif /* DWARF_DEBUGGING_INFO */
+#ifdef DWARF2_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF2_DEBUG)
+    dwarf2out_end_source_file ();
+#endif /* DWARF2_DEBUGGING_INFO */
+}
+
+/* Called from check_newline in c-parse.y.  The `buffer' parameter contains
+   the tail part of the directive line, i.e. the part which is past the
+   initial whitespace, #, whitespace, directive-name, whitespace part.  */
+
+void
+debug_define (lineno, buffer)
+     register unsigned lineno;
+     register char *buffer;
+{
+#ifdef DWARF_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF_DEBUG)
+    dwarfout_define (lineno, buffer);
+#endif /* DWARF_DEBUGGING_INFO */
+#ifdef DWARF2_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF2_DEBUG)
+    dwarf2out_define (lineno, buffer);
+#endif /* DWARF2_DEBUGGING_INFO */
+}
+
+/* Called from check_newline in c-parse.y.  The `buffer' parameter contains
+   the tail part of the directive line, i.e. the part which is past the
+   initial whitespace, #, whitespace, directive-name, whitespace part.  */
+
+void
+debug_undef (lineno, buffer)
+     register unsigned lineno;
+     register char *buffer;
+{
+#ifdef DWARF_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF_DEBUG)
+    dwarfout_undef (lineno, buffer);
+#endif /* DWARF_DEBUGGING_INFO */
+#ifdef DWARF2_DEBUGGING_INFO
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && write_symbols == DWARF2_DEBUG)
+    dwarf2out_undef (lineno, buffer);
+#endif /* DWARF2_DEBUGGING_INFO */
+}
index 4659490..d746b71 100644 (file)
@@ -1180,6 +1180,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
              && DECL_CONTEXT (decl))
            dwarfout_file_scope_decl (decl, 0);
 #endif
              && DECL_CONTEXT (decl))
            dwarfout_file_scope_decl (decl, 0);
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+         if (write_symbols == DWARF2_DEBUG && top_level
+             && DECL_CONTEXT (decl))
+           dwarf2out_file_scope_decl (decl, 0);
+#endif
        }
 
       /* Only output DWARF debugging information for record-scope variables
        }
 
       /* Only output DWARF debugging information for record-scope variables
@@ -1308,6 +1313,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
          && DECL_CONTEXT (decl))
        dwarfout_file_scope_decl (decl, 0);
 #endif
          && DECL_CONTEXT (decl))
        dwarfout_file_scope_decl (decl, 0);
 #endif
+#ifdef DWARF2_DEBUGGING_INFO
+      if (write_symbols == DWARF2_DEBUG && top_level
+         && DECL_CONTEXT (decl))
+       dwarf2out_file_scope_decl (decl, 0);
+#endif
 
       /* Only output DWARF debugging information for record-scope variables
         here.  In the case of function-scope variables, the information
 
       /* Only output DWARF debugging information for record-scope variables
         here.  In the case of function-scope variables, the information