include/opcode/
[deliverable/binutils-gdb.git] / gdb / stabsread.c
index 3b747b45bd4f5153f429ecbe1d6133d73e039291..e9580f948d7e34ff4feb2079dc651c7ff6ed78f0 100644 (file)
@@ -930,6 +930,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       SYMBOL_CLASS (sym) = LOC_ARG;
       SYMBOL_VALUE (sym) = valu;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
+      SYMBOL_IS_ARGUMENT (sym) = 1;
       add_symbol_to_list (sym, &local_symbols);
 
       if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
@@ -974,7 +975,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
     case 'R':
       /* Parameter which is in a register.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
-      SYMBOL_CLASS (sym) = LOC_REGPARM;
+      SYMBOL_CLASS (sym) = LOC_REGISTER;
+      SYMBOL_IS_ARGUMENT (sym) = 1;
       SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
       if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
                                  + gdbarch_num_pseudo_regs (current_gdbarch))
@@ -1039,7 +1041,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
                  && strcmp (DEPRECATED_SYMBOL_NAME (prev_sym),
                             DEPRECATED_SYMBOL_NAME (sym)) == 0)
                {
-                 SYMBOL_CLASS (prev_sym) = LOC_REGPARM;
+                 SYMBOL_CLASS (prev_sym) = LOC_REGISTER;
                  /* Use the type from the LOC_REGISTER; that is the type
                     that is actually in that register.  */
                  SYMBOL_TYPE (prev_sym) = SYMBOL_TYPE (sym);
@@ -1265,6 +1267,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       /* Reference parameter */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REF_ARG;
+      SYMBOL_IS_ARGUMENT (sym) = 1;
       SYMBOL_VALUE (sym) = valu;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
       add_symbol_to_list (sym, &local_symbols);
@@ -1274,6 +1277,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       /* Reference parameter which is in a register.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
+      SYMBOL_IS_ARGUMENT (sym) = 1;
       SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu);
       if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch)
                                + gdbarch_num_pseudo_regs (current_gdbarch))
@@ -1315,11 +1319,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
      register or on the stack) instead of the structure itself.  */
 
   if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym))
-      && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
+      && SYMBOL_IS_ARGUMENT (sym))
     {
-      /* We have to convert LOC_REGPARM to LOC_REGPARM_ADDR (for
+      /* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for
          variables passed in a register).  */
-      if (SYMBOL_CLASS (sym) == LOC_REGPARM)
+      if (SYMBOL_CLASS (sym) == LOC_REGISTER)
        SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
       /* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th
         and subsequent arguments on SPARC, for example).  */
@@ -4294,6 +4298,25 @@ cleanup_undefined_types_1 (void)
 {
   struct type **type;
 
+  /* Iterate over every undefined type, and look for a symbol whose type
+     matches our undefined type.  The symbol matches if:
+       1. It is a typedef in the STRUCT domain;
+       2. It has the same name, and same type code;
+       3. The instance flags are identical.
+     
+     It is important to check the instance flags, because we have seen
+     examples where the debug info contained definitions such as:
+
+         "foo_t:t30=B31=xefoo_t:"
+
+     In this case, we have created an undefined type named "foo_t" whose
+     instance flags is null (when processing "xefoo_t"), and then created
+     another type with the same name, but with different instance flags
+     ('B' means volatile).  I think that the definition above is wrong,
+     since the same type cannot be volatile and non-volatile at the same
+     time, but we need to be able to cope with it when it happens.  The
+     approach taken here is to treat these two types as different.  */
+
   for (type = undef_types; type < undef_types + undef_types_length; type++)
     {
       switch (TYPE_CODE (*type))
@@ -4329,7 +4352,10 @@ cleanup_undefined_types_1 (void)
                            && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
                            && (TYPE_CODE (SYMBOL_TYPE (sym)) ==
                                TYPE_CODE (*type))
-                           && strcmp (DEPRECATED_SYMBOL_NAME (sym), typename) == 0)
+                           && (TYPE_INSTANCE_FLAGS (*type) ==
+                               TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
+                           && strcmp (DEPRECATED_SYMBOL_NAME (sym),
+                                      typename) == 0)
                           replace_type (*type, SYMBOL_TYPE (sym));
                      }
                  }
This page took 0.025785 seconds and 4 git commands to generate.