OSDN Git Service

* cppfiles.c (search_from): Special case the empty string.
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index 7bf8889..05a95a4 100644 (file)
@@ -1,6 +1,6 @@
 /* Output dbx-format symbol table information from GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -77,7 +77,6 @@ Boston, MA 02111-1307, USA.  */
 #include "regs.h"
 #include "insn-config.h"
 #include "reload.h"
-#include "defaults.h"
 #include "output.h" /* ASM_OUTPUT_SOURCE_LINE may refer to sdb functions.  */
 #include "dbxout.h"
 #include "toplev.h"
@@ -454,8 +453,6 @@ dbxout_init (asm_file, input_file_name, syms)
      and output them all, except for those already output.  */
 
   dbxout_typedefs (syms);
-
-  ggc_add_string_root ((char **) &lastfile, 1);
 }
 
 /* Output any typedef names for types described by TYPE_DECLs in SYMS,
@@ -559,7 +556,7 @@ dbxout_source_line (file, filename, lineno)
 #ifdef ASM_OUTPUT_SOURCE_LINE
   ASM_OUTPUT_SOURCE_LINE (file, lineno);
 #else
-  fprintf (file, "\t%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);
+  fprintf (file, "%s%d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);
 #endif
 }
 
@@ -844,7 +841,9 @@ dbxout_type_methods (type)
 
          last = fndecl;
 
-         if (DECL_IGNORED_P (fndecl))
+         /* Also ignore abstract methods; those are only interesting to
+            the DWARF backends.  */
+         if (DECL_IGNORED_P (fndecl) || DECL_ABSTRACT (fndecl))
            continue;
 
          if (flag_minimal_debug)
@@ -1043,7 +1042,7 @@ dbxout_type (type, full, show_arg_types)
          typevec
            = (struct typeinfo *) xrealloc (typevec,
                                            typevec_len * 2 * sizeof typevec[0]);
-         bzero ((char *) (typevec + typevec_len),
+         memset ((char *) (typevec + typevec_len), 0,
                 typevec_len * sizeof typevec[0]);
          typevec_len *= 2;
        }
@@ -2472,6 +2471,28 @@ dbxout_parms (parms)
            dbxout_finish_symbol (parms);
          }
        else if (GET_CODE (DECL_RTL (parms)) == MEM
+                && GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
+         {
+           /* Parm was passed via invisible reference, with the reference
+              living on the stack.  DECL_RTL looks like
+              (MEM (MEM (PLUS (REG ...) (CONST_INT ...)))) or it
+              could look like (MEM (MEM (REG))).  */
+           const char *decl_name = (DECL_NAME (parms)
+                                    ? IDENTIFIER_POINTER (DECL_NAME (parms))
+                                    : "(anon)");
+           if (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 0)) == REG)
+              current_sym_value = 0;
+           else
+             current_sym_value
+               = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
+           current_sym_addr = 0;
+             
+           FORCE_TEXT;
+           fprintf (asmfile, "%s\"%s:v", ASM_STABS_OP, decl_name);
+           dbxout_type (TREE_TYPE (parms), 0, 0);
+           dbxout_finish_symbol (parms);
+         }
+       else if (GET_CODE (DECL_RTL (parms)) == MEM
                 && XEXP (DECL_RTL (parms), 0) != const0_rtx
                 /* ??? A constant address for a parm can happen
                    when the reg it lives in is equiv to a constant in memory.
@@ -2479,22 +2500,14 @@ dbxout_parms (parms)
                 && ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
          {
            /* Parm was passed in registers but lives on the stack.  */
-           int aux_sym_value = 0;
 
            current_sym_code = N_PSYM;
            /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
               in which case we want the value of that CONST_INT,
-              or (MEM (REG ...)) or (MEM (MEM ...)),
+              or (MEM (REG ...)),
               in which case we use a value of zero.  */
            if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG)
              current_sym_value = 0;
-           else if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
-             {
-               /* Remember the location on the stack the parm is moved to */
-               aux_sym_value
-                 = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1));
-               current_sym_value = 0;
-             }
            else
                current_sym_value
                  = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
@@ -2534,17 +2547,6 @@ dbxout_parms (parms)
                                     XEXP (DECL_RTL (parms), 0));
            dbxout_type (TREE_TYPE (parms), 0, 0);
            dbxout_finish_symbol (parms);
-           if (aux_sym_value != 0)
-             {
-               /* Generate an entry for the stack location */
-
-               fprintf (asmfile, "%s\"%s:", ASM_STABS_OP,
-                        IDENTIFIER_POINTER (DECL_NAME (parms)));
-               current_sym_value = aux_sym_value;
-               current_sym_code = N_LSYM;
-               dbxout_type (build_reference_type (TREE_TYPE (parms)), 0, 0);
-               dbxout_finish_symbol (parms);
-             }
          }
       }
 }
@@ -2644,7 +2646,6 @@ dbxout_block (block, depth, args)
      tree args;
 {
   int blocknum = -1;
-  int ignored;
 
 #if DBX_BLOCKS_FUNCTION_RELATIVE
   const char *begin_label; 
@@ -2659,12 +2660,16 @@ dbxout_block (block, depth, args)
       /* Ignore blocks never expanded or otherwise marked as real.  */
       if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
        {
-#ifndef DBX_LBRAC_FIRST
+         int did_output;
+
+#ifdef DBX_LBRAC_FIRST
+         did_output = 1;
+#else
          /* In dbx format, the syms of a block come before the N_LBRAC.
             If nothing is output, we don't need the N_LBRAC, either. */
-         ignored = 1;
+         did_output = 0;
          if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
-           ignored = dbxout_syms (BLOCK_VARS (block));
+           did_output = dbxout_syms (BLOCK_VARS (block));
          if (args)
            dbxout_reg_parms (args);
 #endif
@@ -2673,7 +2678,7 @@ dbxout_block (block, depth, args)
             the block.  Use the block's tree-walk order to generate
             the assembler symbols LBBn and LBEn
             that final will define around the code in this block.  */
-         if (depth > 0 && !ignored)
+         if (depth > 0 && did_output)
            {
              char buf[20];
              blocknum = BLOCK_NUMBER (block);
@@ -2723,7 +2728,7 @@ dbxout_block (block, depth, args)
          dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
 
          /* Refer to the marker for the end of the block.  */
-         if (depth > 0 && !ignored)
+         if (depth > 0 && did_output)
            {
              char buf[20];
              ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);