OSDN Git Service

Add missing docs for feature added by Richard Henderson.
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index 33bbd71..caff4f2 100644 (file)
@@ -16,8 +16,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 
 /* Output dbx-format symbol table data.
@@ -241,13 +241,6 @@ static GTY(()) int scope_labelno;
 
 static GTY(()) int dbxout_source_line_counter;
 
-/* Nonzero if we have actually used any of the GDB extensions
-   to the debugging format.  The idea is that we use them for the
-   first time only if there's a strong reason, but once we have done that,
-   we use them whenever convenient.  */
-
-static GTY(()) int have_used_extensions = 0;
-
 /* Number for the next N_SOL filename stabs label.  The number 0 is reserved
    for the N_SO filename stabs label.  */
 
@@ -863,7 +856,7 @@ dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code,
       obstack_1grow (&stabstr_ob, '\0');
 
       len = obstack_object_size (&stabstr_ob);
-      chunk = str = obstack_finish (&stabstr_ob);
+      chunk = str = XOBFINISH (&stabstr_ob, char *);
 
       /* Within the buffer are a sequence of NUL-separated strings,
         each of which is to be written out as a separate stab
@@ -896,7 +889,7 @@ dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code,
         comma than to do a two-character fputs.  */
       obstack_grow (&stabstr_ob, "\",", 2);
       len = obstack_object_size (&stabstr_ob);
-      str = obstack_finish (&stabstr_ob);
+      str = XOBFINISH (&stabstr_ob, char *);
       
       fwrite (str, 1, len, asm_out_file);
       DBX_FINISH_STABS (sym, code, line, addr, label, number);
@@ -938,8 +931,6 @@ dbxout_function_end (tree decl)
 #else
   if (flag_reorder_blocks_and_partition)
     {
-      struct function *cfun = DECL_STRUCT_FUNCTION (decl);
-
       dbxout_begin_empty_stabs (N_FUN);
       dbxout_stab_value_label_diff (cfun->hot_section_end_label, 
                                    cfun->hot_section_label);
@@ -980,6 +971,8 @@ get_lang_number (void)
     return N_SO_PASCAL;
   else if (strcmp (language_string, "GNU Objective-C") == 0)
     return N_SO_OBJC;
+  else if (strcmp (language_string, "GNU Objective-C++") == 0)
+    return N_SO_OBJCPLUS;
   else
     return 0;
 
@@ -1407,14 +1400,14 @@ dbxout_type_fields (tree type)
 
       /* Omit here local type decls until we know how to support them.  */
       if (TREE_CODE (tem) == TYPE_DECL
+         /* Omit here the nameless fields that are used to skip bits.  */
+         || DECL_IGNORED_P (tem)
          /* Omit fields whose position or size are variable or too large to
             represent.  */
          || (TREE_CODE (tem) == FIELD_DECL
              && (! host_integerp (bit_position (tem), 0)
                  || ! DECL_SIZE (tem)
-                 || ! host_integerp (DECL_SIZE (tem), 1)))
-         /* Omit here the nameless fields that are used to skip bits.  */
-          || DECL_IGNORED_P (tem))
+                 || ! host_integerp (DECL_SIZE (tem), 1))))
        continue;
 
       else if (TREE_CODE (tem) != CONST_DECL)
@@ -1432,7 +1425,6 @@ dbxout_type_fields (tree type)
              && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
                  || TREE_CODE (tem) != FIELD_DECL))
            {
-             have_used_extensions = 1;
              stabstr_C ('/');
              stabstr_C (DECL_ACCESSIBILITY_CHAR (tem));
            }
@@ -1447,7 +1439,6 @@ dbxout_type_fields (tree type)
                {
                  tree name = DECL_ASSEMBLER_NAME (tem);
 
-                 have_used_extensions = 1;
                  stabstr_C (':');
                  stabstr_I (name);
                  stabstr_C (';');
@@ -1655,11 +1646,15 @@ dbxout_type (tree type, int full)
   tree tem;
   tree main_variant;
   static int anonymous_type_number = 0;
+  bool vector_type = false;
 
   if (TREE_CODE (type) == VECTOR_TYPE)
-    /* The frontend feeds us a representation for the vector as a struct
-       containing an array.  Pull out the array type.  */
-    type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
+    {
+      /* The frontend feeds us a representation for the vector as a struct
+        containing an array.  Pull out the array type.  */
+      type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
+      vector_type = true;
+    }
 
   /* If there was an input error and we don't really have a type,
      avoid crashing and write something that is at least valid
@@ -1858,7 +1853,6 @@ dbxout_type (tree type, int full)
          if (use_gnu_debug_info_extensions
              && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
            {
-             have_used_extensions = 1;
              stabstr_S ("@s");
              stabstr_D (TYPE_PRECISION (type));
              stabstr_C (';');
@@ -1875,7 +1869,6 @@ dbxout_type (tree type, int full)
          if (use_gnu_debug_info_extensions
              && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
            {
-             have_used_extensions = 1;
              stabstr_S ("@s");
              stabstr_D (TYPE_PRECISION (type));
              stabstr_C (';');
@@ -1922,7 +1915,6 @@ dbxout_type (tree type, int full)
     case CHAR_TYPE:
       if (use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_S ("@s");
          stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
          stabstr_S (";-20;");
@@ -1940,7 +1932,6 @@ dbxout_type (tree type, int full)
     case BOOLEAN_TYPE:
       if (use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_S ("@s");
          stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
          stabstr_S (";-16;");
@@ -1986,7 +1977,6 @@ dbxout_type (tree type, int full)
       /* Make arrays of packed bits look like bitstrings for chill.  */
       if (TYPE_PACKED (type) && use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_S ("@s");
          stabstr_D (BITS_PER_UNIT * int_size_in_bytes (type));
          stabstr_S (";@S;S");
@@ -1994,6 +1984,9 @@ dbxout_type (tree type, int full)
          break;
        }
 
+      if (use_gnu_debug_info_extensions && vector_type)
+       stabstr_S ("@V;");
+
       /* Output "a" followed by a range type definition
         for the index type of the array
         followed by a reference to the target-type.
@@ -2002,7 +1995,6 @@ dbxout_type (tree type, int full)
         different from an array of characters.  */
       if (TYPE_STRING_FLAG (type) && use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_S ("@S;");
        }
       tem = TYPE_DOMAIN (type);
@@ -2066,13 +2058,12 @@ dbxout_type (tree type, int full)
          {
            int i;
            tree child;
-           VEC (tree) *accesses = BINFO_BASE_ACCESSES (binfo);
+           VEC(tree,gc) *accesses = BINFO_BASE_ACCESSES (binfo);
            
            if (use_gnu_debug_info_extensions)
              {
                if (BINFO_N_BASE_BINFOS (binfo))
                  {
-                   have_used_extensions = 1;
                    stabstr_C ('!');
                    stabstr_U (BINFO_N_BASE_BINFOS (binfo));
                    stabstr_C (',');
@@ -2085,13 +2076,13 @@ dbxout_type (tree type, int full)
 
                if (use_gnu_debug_info_extensions)
                  {
-                   have_used_extensions = 1;
                    stabstr_C (BINFO_VIRTUAL_P (child) ? '1' : '0');
                    stabstr_C (access == access_public_node ? '2' :
                                   access == access_protected_node
                                   ? '1' :'0');
                    if (BINFO_VIRTUAL_P (child)
-                       && strcmp (lang_hooks.name, "GNU C++") == 0)
+                       && (strcmp (lang_hooks.name, "GNU C++") == 0
+                           || strcmp (lang_hooks.name, "GNU Objective-C++") == 0))
                      /* For a virtual base, print the (negative)
                         offset within the vtable where we must look
                         to find the necessary adjustment.  */
@@ -2130,7 +2121,6 @@ dbxout_type (tree type, int full)
       dbxout_type_fields (type);
       if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE)
        {
-         have_used_extensions = 1;
          dbxout_type_methods (type);
        }
 
@@ -2140,7 +2130,6 @@ dbxout_type (tree type, int full)
          /* Avoid the ~ if we don't really need it--it confuses dbx.  */
          && TYPE_VFIELD (type))
        {
-         have_used_extensions = 1;
 
          /* We need to write out info about what field this class
             uses as its "main" vtable pointer field, because if this
@@ -2171,7 +2160,6 @@ dbxout_type (tree type, int full)
       if (use_gnu_debug_info_extensions
          && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
        {
-         have_used_extensions = 1;
          stabstr_S ("@s");
          stabstr_D (TYPE_PRECISION (type));
          stabstr_C (';');
@@ -2207,7 +2195,6 @@ dbxout_type (tree type, int full)
     case METHOD_TYPE:
       if (use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_C ('#');
 
          /* Write the argument types out longhand.  */
@@ -2225,7 +2212,6 @@ dbxout_type (tree type, int full)
     case OFFSET_TYPE:
       if (use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_C ('@');
          dbxout_type (TYPE_OFFSET_BASETYPE (type), 0);
          stabstr_C (',');
@@ -2239,7 +2225,6 @@ dbxout_type (tree type, int full)
     case REFERENCE_TYPE:
       if (use_gnu_debug_info_extensions)
        {
-         have_used_extensions = 1;
          stabstr_C ('&');
        }
       else
@@ -2515,7 +2500,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
                 || TREE_CODE (type) == UNION_TYPE
                 || TREE_CODE (type) == QUAL_UNION_TYPE)
                && TYPE_NAME (type) == decl
-               && !(use_gnu_debug_info_extensions && have_used_extensions)
+               && !use_gnu_debug_info_extensions
                && !TREE_ASM_WRITTEN (TYPE_NAME (type))
                /* Distinguish the implicit typedefs of C++
                   from explicit ones that might be found in C.  */
@@ -2541,11 +2526,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
 
            dbxout_begin_complex_stabs ();
 
-           /* Output leading class/struct qualifiers.
-              ??? why not set have_used_extensions here ... because
-              then the test of it below would always be true, I
-              guess.  But it's not clear to me why we shouldn't do
-              that always in extended mode.  */
+           /* Output leading class/struct qualifiers.  */
            if (use_gnu_debug_info_extensions)
              dbxout_class_name_qualifiers (decl);
 
@@ -2562,7 +2543,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
                   from explicit ones that might be found in C.  */
                && DECL_ARTIFICIAL (decl))
              {
-               if (use_gnu_debug_info_extensions && have_used_extensions)
+               if (use_gnu_debug_info_extensions)
                  {
                    stabstr_C ('T');
                    TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1;