OSDN Git Service

Make args to jump_optimize symbolic
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index 7fa9139..cb0220c 100644 (file)
@@ -1,5 +1,5 @@
 /* Output dbx-format symbol table information from GNU compiler.
-   Copyright (C) 1987, 88, 92-96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1987, 88, 92-97, 1998 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -68,17 +68,7 @@ Boston, MA 02111-1307, USA.  */
    For more on data type definitions, see `dbxout_type'.  */
 
 #include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
+#include "system.h"
 
 #include "tree.h"
 #include "rtl.h"
@@ -89,10 +79,6 @@ Boston, MA 02111-1307, USA.  */
 #include "defaults.h"
 #include "output.h" /* ASM_OUTPUT_SOURCE_LINE may refer to sdb functions.  */
 
-#ifndef errno
-extern int errno;
-#endif
-
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"
 #endif
@@ -162,8 +148,6 @@ static int have_used_extensions = 0;
 
 static int source_label_number = 1;
 
-static int scope_labelno = 0;
-
 char *getpwd ();
 
 /* Typical USG systems don't have stab.h, and they also have
@@ -333,7 +317,9 @@ void dbxout_types ();
 void dbxout_args ();
 void dbxout_symbol ();
 
+#if defined(ASM_OUTPUT_SECTION_NAME)
 static void dbxout_function_end                PROTO((void));
+#endif
 static void dbxout_typedefs            PROTO((tree));
 static void dbxout_type_index          PROTO((tree));
 static void dbxout_continue            PROTO((void));
@@ -352,9 +338,11 @@ static void dbxout_finish_symbol   PROTO((tree));
 static void dbxout_block               PROTO((tree, int, tree));
 static void dbxout_really_begin_function PROTO((tree));
 \f
+#if defined(ASM_OUTPUT_SECTION_NAME)
 static void
 dbxout_function_end ()
 {
+  static int scope_labelno = 0;
   char lscope_label_name[100];
   /* Convert Ltext into the appropriate format for local labels in case
      the system doesn't insert underscores in front of user generated
@@ -371,6 +359,7 @@ dbxout_function_end ()
   assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
   fprintf (asmfile, "\n");
 }
+#endif /* ! NO_DBX_FUNCTION_END */
 
 /* At the beginning of compilation, start writing the symbol table.
    Initialize `typevec' and output the standard data types of C.  */
@@ -657,7 +646,9 @@ dbxout_type_fields (type)
          /* Continue the line if necessary,
             but not before the first field.  */
          if (tem != TYPE_FIELDS (type))
-           CONTIN;
+           {
+             CONTIN;
+           }
 
          if (use_gnu_debug_info_extensions
              && flag_minimal_debug
@@ -671,8 +662,10 @@ dbxout_type_fields (type)
              dbxout_type (DECL_FCONTEXT (tem), 0, 0);
              fprintf (asmfile, ":");
              dbxout_type (TREE_TYPE (tem), 0, 0);
-             fprintf (asmfile, ",%d;",
+             fputc (',', asmfile);
+             fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                       TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
+             fputc (';', asmfile);
              continue;
            }
 
@@ -721,9 +714,13 @@ dbxout_type_fields (type)
            }
          else if (TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
            {
-             fprintf (asmfile, ",%d,%d;",
-                      TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)),
+             fputc (',', asmfile);
+             fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+                      TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
+             fputc (',', asmfile);
+             fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                       TREE_INT_CST_LOW (DECL_SIZE (tem)));
+             fputc (';', asmfile);
            }
          CHARS (23);
        }
@@ -768,8 +765,9 @@ dbxout_type_method_1 (decl, debug_name)
         - (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))));
   if (DECL_VINDEX (decl))
     {
-      fprintf (asmfile, "%d;",
+      fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
               TREE_INT_CST_LOW (DECL_VINDEX (decl)));
+      fputc (';', asmfile);
       dbxout_type (DECL_CONTEXT (decl), 0, 0);
       fprintf (asmfile, ";");
       CHARS (8);
@@ -824,7 +822,7 @@ dbxout_type_methods (type)
 
   sprintf(formatted_type_identifier_length, "%d", type_identifier_length);
 
-  if (TREE_CODE (methods) == FUNCTION_DECL)
+  if (TREE_CODE (methods) != TREE_VEC)
     fndecl = methods;
   else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
     fndecl = TREE_VEC_ELT (methods, 0);
@@ -958,14 +956,21 @@ dbxout_range_type (type)
       dbxout_type_index (type);
     }
   if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
-    fprintf (asmfile, ";%d", 
-            TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)));
+    {
+      fputc (';', asmfile);
+      fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+              TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)));
+    }
   else
     fprintf (asmfile, ";0");
   if (TYPE_MAX_VALUE (type) 
       && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST)
-    fprintf (asmfile, ";%d;", 
-            TREE_INT_CST_LOW (TYPE_MAX_VALUE (type)));
+    {
+      fputc (';', asmfile);
+      fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+              TREE_INT_CST_LOW (TYPE_MAX_VALUE (type)));
+      fputc (';', asmfile);
+    }
   else
     fprintf (asmfile, ";-1;");
 }
@@ -1137,9 +1142,12 @@ dbxout_type (type, full, show_arg_types)
          dbxout_type_index (type);
          fprintf (asmfile, ";0;127;");
        }
+      /* This used to check if the type's precision was more than
+        HOST_BITS_PER_WIDE_INT.  That is wrong since gdb uses a
+        long (it has no concept of HOST_BITS_PER_WIDE_INT).  */
       else if (use_gnu_debug_info_extensions
               && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
-                  || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT))
+                  || TYPE_PRECISION (type) >= HOST_BITS_PER_LONG))
        {
          /* This used to say `r1' and we used to take care
             to make sure that `int' was type number 1.  */
@@ -1161,14 +1169,20 @@ dbxout_type (type, full, show_arg_types)
         to make sure that `int' was type number 1.  */
       fprintf (asmfile, "r");
       dbxout_type_index (integer_type_node);
-      fprintf (asmfile, ";%d;0;", int_size_in_bytes (type));
+      fputc (';', asmfile);
+      fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (type));
+      fputs (";0;", asmfile);
       CHARS (13);
       break;
 
     case CHAR_TYPE:
       if (use_gnu_debug_info_extensions)
-       fprintf (asmfile, "@s%d;-20;",
-                BITS_PER_UNIT * int_size_in_bytes (type));
+       {
+         fputs ("@s", asmfile);
+         fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+                  BITS_PER_UNIT * int_size_in_bytes (type));
+         fputs (";-20;", asmfile);
+       }
       else
        {
          /* Output the type `char' as a subrange of itself.
@@ -1182,8 +1196,12 @@ dbxout_type (type, full, show_arg_types)
 
     case BOOLEAN_TYPE:
       if (use_gnu_debug_info_extensions)
-       fprintf (asmfile, "@s%d;-16;",
-                BITS_PER_UNIT * int_size_in_bytes (type));
+       {
+         fputs ("@s", asmfile);
+         fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+                  BITS_PER_UNIT * int_size_in_bytes (type));
+         fputs (";-16;", asmfile);
+       }
       else /* Define as enumeral type (False, True) */
        fprintf (asmfile, "eFalse:0,True:1,;");
       CHARS (17);
@@ -1202,15 +1220,18 @@ dbxout_type (type, full, show_arg_types)
        {
          fprintf (asmfile, "r");
          dbxout_type_index (type);
-         fprintf (asmfile, ";%d;0;",
+         fputc (';', asmfile);
+         fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                   int_size_in_bytes (TREE_TYPE (type)));
+         fputs (";0;", asmfile);
          CHARS (12);           /* The number is probably incorrect here.  */
        }
       else
        {
          /* Output a complex integer type as a structure,
             pending some other way to do it.  */
-         fprintf (asmfile, "s%d", int_size_in_bytes (type));
+         fputc ('s', asmfile);
+         fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (type));
 
          fprintf (asmfile, "real:");
          CHARS (10);
@@ -1232,8 +1253,10 @@ dbxout_type (type, full, show_arg_types)
       if (use_gnu_debug_info_extensions)
        {
          have_used_extensions = 1;
-         fprintf (asmfile, "@s%d;",
+         fputs ("@s", asmfile);
+         fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                   BITS_PER_UNIT * int_size_in_bytes (type));
+         fputc (';', asmfile);
          /* Check if a bitstring type, which in Chill is
             different from a [power]set.  */
          if (TYPE_STRING_FLAG (type))
@@ -1319,7 +1342,8 @@ dbxout_type (type, full, show_arg_types)
          }
 
        /* Identify record or union, and print its size.  */
-       fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "s%d" : "u%d",
+       fputc (((TREE_CODE (type) == RECORD_TYPE) ? 's' : 'u'), asmfile);
+       fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                 int_size_in_bytes (type));
 
        if (use_gnu_debug_info_extensions)
@@ -1343,8 +1367,9 @@ dbxout_type (type, full, show_arg_types)
                putc (TREE_VIA_PUBLIC (child) ? '2'
                      : '0',
                      asmfile);
-               fprintf (asmfile, "%d,",
+               fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                         TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
+               fputc (',', asmfile);
                CHARS (15);
                dbxout_type (BINFO_TYPE (child), 0, 0);
                putc (';', asmfile);
@@ -1356,9 +1381,13 @@ dbxout_type (type, full, show_arg_types)
                dbxout_type_name (BINFO_TYPE (child));
                putc (':', asmfile);
                dbxout_type (BINFO_TYPE (child), full, 0);
-               fprintf (asmfile, ",%d,%d;",
-                        TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT,
+               fputc (',', asmfile);
+               fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+                        TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
+               fputc (',', asmfile);
+               fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
                         TREE_INT_CST_LOW (DECL_SIZE (TYPE_NAME (BINFO_TYPE (child)))) * BITS_PER_UNIT);
+               fputc (';', asmfile);
                CHARS (20);
              }
          }
@@ -1427,18 +1456,20 @@ dbxout_type (type, full, show_arg_types)
        {
          fprintf (asmfile, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
          if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == 0)
-           fprintf (asmfile, "%lu",
-                    (unsigned long) TREE_INT_CST_LOW (TREE_VALUE (tem)));
+           fprintf (asmfile, HOST_WIDE_INT_PRINT_UNSIGNED,
+                    TREE_INT_CST_LOW (TREE_VALUE (tem)));
          else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1
                   && TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0)
-           fprintf (asmfile, "%ld",
-                    (long) TREE_INT_CST_LOW (TREE_VALUE (tem)));
+           fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
+                    TREE_INT_CST_LOW (TREE_VALUE (tem)));
          else
            print_int_cst_octal (TREE_VALUE (tem));
          fprintf (asmfile, ",");
          CHARS (20 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem)));
          if (TREE_CHAIN (tem) != 0)
-           CONTIN;
+           {
+             CONTIN;
+           }
        }
       putc (';', asmfile);
       CHARS (1);
@@ -1567,7 +1598,7 @@ print_int_cst_octal (c)
                  << (HOST_BITS_PER_WIDE_INT / 3 * 3))
                 - 1);
 
-      fprintf (asmfile, "%o%01o", beg, middle);
+      fprintf (asmfile, "%o%01o", (int)beg, (int)middle);
       print_octal (end, HOST_BITS_PER_WIDE_INT / 3);
     }
 }
@@ -1580,7 +1611,7 @@ print_octal (value, digits)
   int i;
 
   for (i = digits - 1; i >= 0; i--)
-    fprintf (asmfile, "%01o", ((value >> (3 * i)) & 7));
+    fprintf (asmfile, "%01o", (int)((value >> (3 * i)) & 7));
 }
 
 /* Output the name of type TYPE, with no punctuation.
@@ -1860,8 +1891,10 @@ dbxout_symbol (decl, local)
 #ifdef DBX_OUTPUT_CONSTANT_SYMBOL
                  DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival);
 #else
-                 fprintf (asmfile, "%s \"%s:c=i%d\",0x%x,0,0,0\n",
-                          ASM_STABS_OP, name, ival, N_LSYM);
+                 fprintf (asmfile, "%s \"%s:c=i", ASM_STABS_OP, name);
+
+                 fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, ival);
+                 fprintf (asmfile, "\",0x%x,0,0,0\n", N_LSYM);
 #endif
                  return;
                }