Mips-specific bug-fix (for stabs-in-ecoff), and style fix. See ChangeLog.
authorPer Bothner <per@bothner.com>
Wed, 5 Feb 1992 02:14:31 +0000 (02:14 +0000)
committerPer Bothner <per@bothner.com>
Wed, 5 Feb 1992 02:14:31 +0000 (02:14 +0000)
gdb/ChangeLog
gdb/mipsread.c
gdb/tm-mips.h

index f3dfb34a79152c374fefd5fc9e6a9d0de35fb701..900e7859c427ac37e05d2f6b3b586aa093f9eacc 100644 (file)
@@ -1,3 +1,17 @@
+Tue Feb  4 18:05:44 1992  Per Bothner  (bothner at cygnus.com)
+
+       * mipsread.c:  Use (FP0_REGNUM-32) instead of magic number 6.
+       (This is just for clarity - and one day permitting us to
+        change FP0_REGNUM from 38 to 32, which would make more sense.)
+       * tm-mips.h:  Added STAB_REG_TO_REGNUM macro, so that
+       register numbers in stabs-in-ecoff get handled correctly.
+
+Sat Feb  1 04:45:10 1992  Stu Grossman  (grossman at cygnus.com)
+
+       * xm-vax.h, xm-vaxult.h, xm-vaxbsd.h, config/mh-vaxult,
+       config/mh-vaxbsd, configure.in:  Split up config stuff for Vaxen
+       into BSD and Ultrix.
+
 Sat Feb  1 04:39:41 1992  John Gilmore  (gnu at cygnus.com)
 
        * dbxread.c (dbx_symfile_init):  Call malloc, not xmalloc.
index 27601e134a936e66bf214a01246724965c0a2218..923d25e7b7b68fc13b2f08f59caf26b985cf6e43 100644 (file)
@@ -782,6 +782,33 @@ free_numargs()
        numargs_list = 0;
 }
 
+char*
+prepend_tag_kind(tag_name, type_code)
+     char *tag_name;
+     int type_code;
+{
+    char *prefix;
+    char *result;
+    switch (type_code) {
+      case TYPE_CODE_ENUM:
+       prefix = "enum ";
+       break;
+      case TYPE_CODE_STRUCT:
+       prefix = "struct ";
+       break;
+      case TYPE_CODE_UNION:
+       prefix = "union ";
+       break;
+      default:
+       prefix = "";
+    }
+
+    result = (char*)obstack_alloc (symbol_obstack,
+                                  strlen(prefix) + strlen(tag_name) + 1);
+    sprintf(result, "%s%s", prefix, tag_name);
+    return result;
+}
+
 \f
 /* Parsing Routines proper. */
 
@@ -830,7 +857,7 @@ parse_symbol(sh, ax)
                if (sh->sc == scRegister) {
                        class = LOC_REGISTER;
                        if (sh->value > 31)
-                               sh->value += 6;
+                               sh->value += FP0_REGNUM-32;
                } else
                        class = LOC_LOCAL;
                b = top_stack->cur_block;
@@ -865,7 +892,7 @@ data:               /* Common code for symbols describing data */
                if (sh->sc == scRegister) {
                        SYMBOL_CLASS(s) = LOC_REGPARM;
                        if (sh->value > 31)
-                               sh->value += 6;
+                               sh->value += FP0_REGNUM-32;
                } else
                        SYMBOL_CLASS(s) = LOC_ARG;
                SYMBOL_VALUE(s) = sh->value;
@@ -980,19 +1007,15 @@ data:            /* Common code for symbols describing data */
                    SYMBOL_CLASS(s) = LOC_TYPEDEF;
                    SYMBOL_VALUE(s) = 0;
                    add_symbol(s, top_stack->cur_block);
-                   /* If this type was expected, use its partial definition */
-                   if (pend)
-                       t = is_pending_symbol(cur_fdr, sh)->t;
-                   else
-                       t = new_type(sh->iss);
 
                    /* First count the number of fields. */
                    for (tsym = sh+1; tsym->st != stEnd; tsym++)
                        if (tsym->st == stMember) {
                            if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
-                               /* If the type of the member is Void,
+                               /* If the type of the member is Nil (or Void)
                                   assume the tag is an enumeration. */
                                if (tsym->index == indexNil
+                                   || ax[tsym->index].ti.bt == btNil
                                    || ax[tsym->index].ti.bt == btVoid)
                                    type_code = TYPE_CODE_ENUM;
                            nfields++;
@@ -1046,6 +1069,12 @@ data:            /* Common code for symbols describing data */
                        if (max_value == 0) type_code = TYPE_CODE_UNION;
                        else type_code = TYPE_CODE_STRUCT;
                    
+                   /* If this type was expected, use its partial definition */
+                   if (pend)
+                       t = is_pending_symbol(cur_fdr, sh)->t;
+                   else
+                       t = new_type(prepend_tag_kind(sh->iss, type_code));
+
                    TYPE_CODE(t) = type_code;
                    TYPE_NFIELDS(t) = nfields;
                    TYPE_FIELDS(t) = f = (struct field*)
@@ -1310,7 +1339,8 @@ static struct type *parse_type(ax, sh, bs)
                    complain (&bad_tag_guess_complaint, 0);
                    TYPE_CODE(tp) = type_code;
                }
-               TYPE_NAME(tp) = obsavestring(pn, strlen(pn));
+               if (TYPE_NAME(tp) == NULL || strcmp(TYPE_NAME(tp), name) != 0)
+                   TYPE_NAME(tp) = obsavestring(name, strlen(name));
        }
 
        /* Deal with range types */
index dc5af0dc4f634450b6a01bdfb93cbf7bc71918f3..bd0bebb154364c26c7e6021a8ab2eeee0fe21ee7 100644 (file)
@@ -344,3 +344,5 @@ typedef struct mips_extra_func_info {
   struct frame_saved_regs *saved_regs;
 
 #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci)
+
+#define STAB_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32)