* config/m88k/{tm-delta88.h,tm-delta88v4.h}, m88k-tdep.c:
[deliverable/binutils-gdb.git] / gdb / stabsread.c
index 4b97a608fe30354ab7013d3561cad63ea4d959b2..59a659c84f1e5892e5eeaa36732e4c579cf1df8c 100644 (file)
@@ -194,7 +194,8 @@ static int undef_types_length;
 /* Check for and handle cretinous stabs symbol name continuation!  */
 #define STABS_CONTINUE(pp)                             \
   do {                                                 \
-    if (**(pp) == '\\') *(pp) = next_symbol_text ();   \
+    if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \
+      *(pp) = next_symbol_text ();     \
   } while (0)
 
 \f
@@ -929,10 +930,7 @@ define_symbol (valu, string, desc, type, objfile)
          SYMBOL_VALUE (sym) = SP_REGNUM;  /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-      if (within_function
-         && REG_STRUCT_HAS_ADDR (processing_gcc_compilation)
-         && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
-             || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION))
+      if (within_function)
        {
          /* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same
             name to represent an argument passed in a register.
@@ -941,17 +939,19 @@ define_symbol (valu, string, desc, type, objfile)
 
             But we only do this in the REG_STRUCT_HAS_ADDR case, so that
             we can still get information about what is going on with the
-            stack (VAX for computing args_printed, possible future changes
-            to use stack slots instead of saved registers in backtraces,
-            etc.).
-            
+            stack (VAX for computing args_printed, using stack slots instead
+            of saved registers in backtraces, etc.).
+
             Note that this code illegally combines
               main(argc) struct foo argc; { register struct foo argc; }
             but this case is considered pathological and causes a warning
             from a decent compiler.  */
 
          if (local_symbols
-             && local_symbols->nsyms > 0)
+             && local_symbols->nsyms > 0
+             && REG_STRUCT_HAS_ADDR (processing_gcc_compilation)
+             && (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
+                 || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION))
            {
              struct symbol *prev_sym;
              prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
@@ -1191,7 +1191,7 @@ error_type (pp)
        }
 
       /* Check for and handle cretinous dbx symbol name continuation!  */
-      if ((*pp)[-1] == '\\')
+      if ((*pp)[-1] == '\\' || (*pp)[-1] == '?')
        {
          *pp = next_symbol_text ();
        }
@@ -1315,7 +1315,7 @@ read_type (pp, objfile)
        char *type_name;
        
        {
-         char *from, *to, *p;
+         char *from, *to, *p, *q1, *q2;
          
          /* Set the type code according to the following letter.  */
          switch ((*pp)[0])
@@ -1341,11 +1341,15 @@ read_type (pp, objfile)
              }
            }
           
+         q1 = strchr(*pp, '<');
          p = strchr(*pp, ':');
          if (p == NULL)
            return error_type (pp);
-         while (p[1] == ':')
+         while (q1 && p > q1 && p[1] == ':')
            {
+              q2 = strchr(q1, '>');
+              if (!q2 || q2 < p)
+                break;
               p += 2;
               p = strchr(p, ':');
               if (p == NULL)
@@ -1415,41 +1419,49 @@ read_type (pp, objfile)
     case '9':
     case '(':
 
-      (*pp)--;
-      if (read_type_number (pp, xtypenums) != 0)
-       return error_type (pp);
+      {
+       char *pp_saved;
 
-      if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
-       /* It's being defined as itself.  That means it is "void".  */
-       type = init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
-      else
-       {
-         struct type *xtype = *dbx_lookup_type (xtypenums);
+       (*pp)--;
+       pp_saved = *pp;
 
-         /* This can happen if we had '-' followed by a garbage character,
-            for example.  */
-         if (xtype == NULL)
-           return error_type (pp);
+       /* Peek ahead at the number to detect void.  */
+       if (read_type_number (pp, xtypenums) != 0)
+         return error_type (pp);
 
-         /* The type is being defined to another type.  So we copy the type.
-            This loses if we copy a C++ class and so we lose track of how
-            the names are mangled (but g++ doesn't output stabs like this
-            now anyway).  */
-
-         type = alloc_type (objfile);
-         memcpy (type, xtype, sizeof (struct type));
-
-         /* The idea behind clearing the names is that the only purpose
-            for defining a type to another type is so that the name of
-            one can be different.  So we probably don't need to worry much
-            about the case where the compiler doesn't give a name to the
-            new type.  */
-         TYPE_NAME (type) = NULL;
-         TYPE_TAG_NAME (type) = NULL;
-       }
-      if (typenums[0] != -1)
-       *dbx_lookup_type (typenums) = type;
-      break;
+       if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
+         /* It's being defined as itself.  That means it is "void".  */
+         type = init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
+       else
+         {
+           struct type *xtype;
+
+           /* Go back to the number and have read_type get it.  This means
+              that we can deal with something like t(1,2)=(3,4)=... which
+              the Lucid compiler uses.  */
+           *pp = pp_saved;
+           xtype = read_type (pp, objfile);
+
+           /* The type is being defined to another type.  So we copy the type.
+              This loses if we copy a C++ class and so we lose track of how
+              the names are mangled (but g++ doesn't output stabs like this
+              now anyway).  */
+
+           type = alloc_type (objfile);
+           memcpy (type, xtype, sizeof (struct type));
+
+           /* The idea behind clearing the names is that the only purpose
+              for defining a type to another type is so that the name of
+              one can be different.  So we probably don't need to worry much
+              about the case where the compiler doesn't give a name to the
+              new type.  */
+           TYPE_NAME (type) = NULL;
+           TYPE_TAG_NAME (type) = NULL;
+         }
+       if (typenums[0] != -1)
+         *dbx_lookup_type (typenums) = type;
+       break;
+      }
 
     /* In the following types, we must be sure to overwrite any existing
        type that the typenums refer to, rather than allocating a new one
@@ -2934,7 +2946,7 @@ read_enum_type (pp, type, objfile)
 
   /* Now fill in the fields of the type-structure.  */
 
-  TYPE_LENGTH (type) = sizeof (int);
+  TYPE_LENGTH (type) = TARGET_INT_BIT / HOST_CHAR_BIT;
   TYPE_CODE (type) = TYPE_CODE_ENUM;
   TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
   TYPE_NFIELDS (type) = nsyms;
This page took 0.025883 seconds and 4 git commands to generate.