OSDN Git Service

Changes to distinguish typedef from original type in debug output.
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index f6a00bd..cb06b16 100644 (file)
@@ -1,5 +1,5 @@
 /* Output dbx-format symbol table information from GNU compiler.
-   Copyright (C) 1987, 88, 92, 93, 94, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -127,9 +127,20 @@ extern int errno;
 #endif
 
 /* Nonzero means if the type has methods, only output debugging
-   information if methods are actually written to the asm file.  */
+   information if methods are actually written to the asm file.  This
+   optimization only works if the debugger can detect the special C++
+   marker.  */
 
-static int flag_minimal_debug = 1;
+#define MINIMAL_DEBUG 1
+
+#ifdef NO_DOLLAR_IN_LABEL
+#ifdef NO_DOT_IN_LABEL
+#undef MINIMAL_DEBUG
+#define MINIMAL_DEBUG 0
+#endif
+#endif
+
+static int flag_minimal_debug = MINIMAL_DEBUG;
 
 /* Nonzero if we have actually used any of the GDB extensions
    to the debugging format.  The idea is that we use them for the
@@ -156,7 +167,7 @@ char *getpwd ();
 #define FORCE_TEXT
 #endif
 
-#if defined (USG) || defined (NO_STAB_H)
+#if defined (USG) || defined (NO_STAB_H) || defined (CROSS_COMPILE)
 #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
 #else
 #include <stab.h>  /* On BSD, use the system's stab.h.  */
@@ -898,7 +909,7 @@ dbxout_type_methods (type)
          /* This is the "mangled" name of the method.
             It encodes the argument types.  */
          char *debug_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl));
-         int destructor = 0;
+         int show_arg_types = 0;
 
          CONTIN;
 
@@ -909,10 +920,23 @@ dbxout_type_methods (type)
 
          if (flag_minimal_debug)
            {
+             char marker;
+
+             /* We can't optimize a method which uses an anonymous
+                 class, because the debugger will not be able to
+                 associate the arbitrary class name with the actual
+                 class.  */
+#ifndef NO_DOLLAR_IN_LABEL
+             marker = '$';
+#else
+             marker = '.';
+#endif
+             if (strchr (debug_name, marker))
+               show_arg_types = 1;
              /* Detect ordinary methods because their mangled names
                 start with the operation name.  */
-             if (!strncmp (IDENTIFIER_POINTER (name), debug_name,
-                           IDENTIFIER_LENGTH (name)))
+             else if (!strncmp (IDENTIFIER_POINTER (name), debug_name,
+                                IDENTIFIER_LENGTH (name)))
                {
                  debug_name += IDENTIFIER_LENGTH (name);
                  if (debug_name[0] == '_' && debug_name[1] == '_')
@@ -948,7 +972,7 @@ dbxout_type_methods (type)
                }
              /* The other alternative is a destructor.  */
              else
-               destructor = 1;
+               show_arg_types = 1;
 
              /* Output the operation name just once, for the first method
                 that we output.  */
@@ -960,7 +984,7 @@ dbxout_type_methods (type)
                }
            }
 
-         dbxout_type (TREE_TYPE (fndecl), 0, destructor);
+         dbxout_type (TREE_TYPE (fndecl), 0, show_arg_types);
 
          dbxout_type_method_1 (fndecl, debug_name);
        }
@@ -987,9 +1011,12 @@ dbxout_range_type (type)
     dbxout_type (type, 0, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */
   else
     {
-      /* This used to say `r1' and we used to take care
-        to make sure that `int' was type number 1.  */
-      dbxout_type_index (integer_type_node);
+      /* Traditionally, we made sure 'int' was type 1, and builtin types
+        were defined to be sub-ranges of int.  Unfortunately, this
+        does not allow us to distinguish true sub-ranges from integer
+        types.  So, instead we define integer (non-sub-range) types as
+        sub-ranges of themselves. */
+      dbxout_type_index (type);
     }
   if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
     fprintf (asmfile, ";%d", 
@@ -1030,7 +1057,8 @@ dbxout_type (type, full, show_arg_types)
      by assuming `int'.  */
   if (type == error_mark_node)
     type = integer_type_node;
-  else
+  else if (!(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+            && DECL_ORIGINAL_TYPE (TYPE_NAME (type))))
     {
       type = TYPE_MAIN_VARIANT (type);
       if (TYPE_NAME (type)
@@ -1128,6 +1156,13 @@ dbxout_type (type, full, show_arg_types)
 
   typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
 
+  if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+      && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
+    { 
+      dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0, 0);
+      return;
+    }
+
   switch (TREE_CODE (type))
     {
     case VOID_TYPE: