Add missing format for built-in floating-point types
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 5344d2f887caf4a36caf8ca9394df4f59c4acdc4..157ce77a8c96ce530209a2b9d85df49a6b953711 100644 (file)
@@ -1,6 +1,6 @@
 /* Read a symbol table in ECOFF format (Third-Eye).
 
-   Copyright (C) 1986-2015 Free Software Foundation, Inc.
+   Copyright (C) 1986-2016 Free Software Foundation, Inc.
 
    Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
    CMU.  Major work by Per Bothner, John Gilmore and Ian Lance Taylor
@@ -359,7 +359,7 @@ mdebug_build_psymtabs (struct objfile *objfile,
       info->fdr = (FDR *) obstack_alloc (&objfile->objfile_obstack,
                                         (info->symbolic_header.ifdMax
                                          * sizeof (FDR)));
-      fdr_src = info->external_fdr;
+      fdr_src = (char *) info->external_fdr;
       fdr_end = (fdr_src
                 + info->symbolic_header.ifdMax * swap->external_fdr_size);
       fdr_ptr = info->fdr;
@@ -436,7 +436,7 @@ push_parse_stack (void)
   if (top_stack && top_stack->prev)
     newobj = top_stack->prev;
   else
-    newobj = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
+    newobj = XCNEW (struct parse_stack);
   /* Initialize new frame with previous content.  */
   if (top_stack)
     {
@@ -521,6 +521,14 @@ add_pending (FDR *fh, char *sh, struct type *t)
 
 /* Parsing Routines proper.  */
 
+static void
+reg_value_complaint (int regnum, int num_regs, const char *sym)
+{
+  complaint (&symfile_complaints,
+            _("bad register number %d (max %d) in symbol %s"),
+             regnum, num_regs - 1, sym);
+}
+
 /* Parse a single symbol.  Mostly just make up a GDB symbol for it.
    For blocks, procedures and types we open a new lexical context.
    This is basically just a big switch on the symbol's type.  Argument
@@ -533,7 +541,21 @@ add_pending (FDR *fh, char *sh, struct type *t)
 static int
 mdebug_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
 {
-  return gdbarch_ecoff_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym));
+  int regno = gdbarch_ecoff_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym));
+
+  if (regno < 0
+      || regno >= (gdbarch_num_regs (gdbarch)
+                  + gdbarch_num_pseudo_regs (gdbarch)))
+    {
+      reg_value_complaint (regno,
+                          gdbarch_num_regs (gdbarch)
+                            + gdbarch_num_pseudo_regs (gdbarch),
+                          SYMBOL_PRINT_NAME (sym));
+
+      regno = gdbarch_sp_regnum (gdbarch); /* Known safe, though useless.  */
+    }
+
+  return regno;
 }
 
 static const struct symbol_register_ops mdebug_register_funcs = {
@@ -545,6 +567,26 @@ static const struct symbol_register_ops mdebug_register_funcs = {
 static int mdebug_register_index;
 static int mdebug_regparm_index;
 
+/* Common code for symbols describing data.  */
+
+static void
+add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
+                struct symbol *s, int aclass_index, struct block *b,
+                struct objfile *objfile, char *name)
+{
+  SYMBOL_DOMAIN (s) = VAR_DOMAIN;
+  SYMBOL_ACLASS_INDEX (s) = aclass_index;
+  add_symbol (s, top_stack->cur_st, b);
+
+  /* Type could be missing if file is compiled without debugging info.  */
+  if (SC_IS_UNDEF (sh->sc)
+      || sh->sc == scNil || sh->index == indexNil)
+    SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
+  else
+    SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
+  /* Value of a data symbol is its memory address.  */
+}
+
 static int
 parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
              struct section_offsets *section_offsets, struct objfile *objfile)
@@ -559,7 +601,6 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
   struct type *t;
   struct field *f;
   int count = 1;
-  enum address_class theclass;
   TIR tir;
   long svalue = sh->value;
   int bitsize;
@@ -600,15 +641,14 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       break;
 
     case stGlobal:             /* External symbol, goes into global block.  */
-      theclass = LOC_STATIC;
       b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st),
                             GLOBAL_BLOCK);
       s = new_symbol (name);
       SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
-      goto data;
+      add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
+      break;
 
     case stStatic:             /* Static data, goes into current block.  */
-      theclass = LOC_STATIC;
       b = top_stack->cur_block;
       s = new_symbol (name);
       if (SC_IS_COMMON (sh->sc))
@@ -622,29 +662,19 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
        }
       else
        SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
-      goto data;
+      add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
+      break;
 
     case stLocal:              /* Local variable, goes into current block.  */
       b = top_stack->cur_block;
       s = new_symbol (name);
       SYMBOL_VALUE (s) = svalue;
       if (sh->sc == scRegister)
-       theclass = mdebug_register_index;
-      else
-       theclass = LOC_LOCAL;
-
-    data:                      /* Common code for symbols describing data.  */
-      SYMBOL_DOMAIN (s) = VAR_DOMAIN;
-      SYMBOL_ACLASS_INDEX (s) = theclass;
-      add_symbol (s, top_stack->cur_st, b);
-
-      /* Type could be missing if file is compiled without debugging info.  */
-      if (SC_IS_UNDEF (sh->sc)
-         || sh->sc == scNil || sh->index == indexNil)
-       SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
+       add_data_symbol (sh, ax, bigend, s, mdebug_register_index,
+                        b, objfile, name);
       else
-       SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
-      /* Value of a data symbol is its memory address.  */
+       add_data_symbol (sh, ax, bigend, s, LOC_LOCAL,
+                        b, objfile, name);
       break;
 
     case stParam:              /* Arg to procedure, goes into current
@@ -1050,8 +1080,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                enum_sym = allocate_symbol (mdebugread_objfile);
                SYMBOL_SET_LINKAGE_NAME
                  (enum_sym,
-                  obstack_copy0 (&mdebugread_objfile->objfile_obstack,
-                                 f->name, strlen (f->name)));
+                  (char *) obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+                                          f->name, strlen (f->name)));
                SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST;
                SYMBOL_TYPE (enum_sym) = t;
                SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN;
@@ -1348,7 +1378,8 @@ static struct type *
 basic_type (int bt, struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
-  struct type **map_bt = objfile_data (objfile, basic_type_data);
+  struct type **map_bt
+    = (struct type **) objfile_data (objfile, basic_type_data);
   struct type *tp;
 
   if (bt >= btMax)
@@ -1371,97 +1402,81 @@ basic_type (int bt, struct objfile *objfile)
       break;
 
     case btAdr:
-      tp = init_type (TYPE_CODE_PTR, 4, TYPE_FLAG_UNSIGNED,
-                     "adr_32", objfile);
-      TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
+      tp = init_pointer_type (objfile, 32, "adr_32",
+                             objfile_type (objfile)->builtin_void);
       break;
 
     case btChar:
-      tp = init_type (TYPE_CODE_INT, 1, 0,
-                     "char", objfile);
+      tp = init_integer_type (objfile, 8, 0, "char");
+      TYPE_NOSIGN (tp) = 1;
       break;
 
     case btUChar:
-      tp = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED,
-                     "unsigned char", objfile);
+      tp = init_integer_type (objfile, 8, 1, "unsigned char");
       break;
 
     case btShort:
-      tp = init_type (TYPE_CODE_INT, 2, 0,
-                     "short", objfile);
+      tp = init_integer_type (objfile, 16, 0, "short");
       break;
 
     case btUShort:
-      tp = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED,
-                     "unsigned short", objfile);
+      tp = init_integer_type (objfile, 16, 1, "unsigned short");
       break;
 
     case btInt:
-      tp = init_type (TYPE_CODE_INT, 4, 0,
-                     "int", objfile);
+      tp = init_integer_type (objfile, 32, 0, "int");
       break;
 
    case btUInt:
-      tp = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
-                     "unsigned int", objfile);
+      tp = init_integer_type (objfile, 32, 1, "unsigned int");
       break;
 
     case btLong:
-      tp = init_type (TYPE_CODE_INT, 4, 0,
-                     "long", objfile);
+      tp = init_integer_type (objfile, 32, 0, "long");
       break;
 
     case btULong:
-      tp = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
-                     "unsigned long", objfile);
+      tp = init_integer_type (objfile, 32, 1, "unsigned long");
       break;
 
     case btFloat:
-      tp = init_type (TYPE_CODE_FLT,
-                     gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0,
-                     "float", objfile);
+      tp = init_float_type (objfile, gdbarch_float_bit (gdbarch),
+                           "float", gdbarch_float_format (gdbarch));
       break;
 
     case btDouble:
-      tp = init_type (TYPE_CODE_FLT,
-                     gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
-                     "double", objfile);
+      tp = init_float_type (objfile, gdbarch_double_bit (gdbarch),
+                           "double", gdbarch_double_format (gdbarch));
       break;
 
     case btComplex:
-      tp = init_type (TYPE_CODE_COMPLEX,
-                     2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0,
-                     "complex", objfile);
-      TYPE_TARGET_TYPE (tp) = basic_type (btFloat, objfile);
+      tp = init_complex_type (objfile, "complex",
+                             basic_type (btFloat, objfile));
       break;
 
     case btDComplex:
-      tp = init_type (TYPE_CODE_COMPLEX,
-                     2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
-                     "double complex", objfile);
-      TYPE_TARGET_TYPE (tp) = basic_type (btDouble, objfile);
+      tp = init_complex_type (objfile, "double complex",
+                             basic_type (btFloat, objfile));
       break;
 
     case btFixedDec:
       /* We use TYPE_CODE_INT to print these as integers.  Does this do any
         good?  Would we be better off with TYPE_CODE_ERROR?  Should
         TYPE_CODE_ERROR print things in hex if it knows the size?  */
-      tp = init_type (TYPE_CODE_INT,
-                     gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, 0,
-                     "fixed decimal", objfile);
+      tp = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
+                             "fixed decimal");
       break;
 
     case btFloatDec:
-      tp = init_type (TYPE_CODE_ERROR,
-                     gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
-                     "floating decimal", objfile);
+      tp = init_type (objfile, TYPE_CODE_ERROR,
+                     gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
+                     "floating decimal");
       break;
 
     case btString:
       /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
         FIXME.  */
-      tp = init_type (TYPE_CODE_STRING, 1, 0,
-                     "string", objfile);
+      tp = init_type (objfile, TYPE_CODE_STRING, 1, "string");
       break;
 
     case btVoid:
@@ -1469,39 +1484,32 @@ basic_type (int bt, struct objfile *objfile)
       break;
 
     case btLong64:
-      tp = init_type (TYPE_CODE_INT, 8, 0,
-                     "long", objfile);
+      tp = init_integer_type (objfile, 64, 0, "long");
       break;
 
     case btULong64:
-      tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
-                     "unsigned long", objfile);
+      tp = init_integer_type (objfile, 64, 1, "unsigned long");
       break;
 
     case btLongLong64:
-      tp = init_type (TYPE_CODE_INT, 8, 0,
-                     "long long", objfile);
+      tp = init_integer_type (objfile, 64, 0, "long long");
       break;
 
     case btULongLong64:
-      tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
-                     "unsigned long long", objfile);
+      tp = init_integer_type (objfile, 64, 1, "unsigned long long");
       break;
 
     case btAdr64:
-      tp = init_type (TYPE_CODE_PTR, 8, TYPE_FLAG_UNSIGNED,
-                     "adr_64", objfile);
-      TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
+      tp = init_pointer_type (objfile, 64, "adr_64",
+                             objfile_type (objfile)->builtin_void);
       break;
 
     case btInt64:
-      tp = init_type (TYPE_CODE_INT, 8, 0,
-                     "int", objfile);
+      tp = init_integer_type (objfile, 64, 0, "int");
       break;
 
     case btUInt64:
-      tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
-                     "unsigned int", objfile);
+      tp = init_integer_type (objfile, 64, 1, "unsigned int");
       break;
 
     default:
@@ -1653,7 +1661,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
       /* Try to cross reference this type, build new type on failure.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
       if (tp == (struct type *) NULL)
-       tp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
+       tp = init_type (mdebugread_objfile, type_code, 0, NULL);
 
       /* DEC c89 produces cross references to qualified aggregate types,
          dereference them.  */
@@ -1696,8 +1704,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          else if (TYPE_TAG_NAME (tp) == NULL
                   || strcmp (TYPE_TAG_NAME (tp), name) != 0)
            TYPE_TAG_NAME (tp)
-             = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
-                              name, strlen (name));
+             = ((const char *)
+                obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+                               name, strlen (name)));
        }
     }
 
@@ -1712,7 +1721,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
       /* Try to cross reference this type, build new type on failure.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
       if (tp == (struct type *) NULL)
-       tp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
+       tp = init_type (mdebugread_objfile, type_code, 0, NULL);
 
       /* Make sure that TYPE_CODE(tp) has an expected type code.
          Any type may be returned from cross_ref if file indirect entries
@@ -1733,8 +1742,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          if (TYPE_NAME (tp) == NULL
              || strcmp (TYPE_NAME (tp), name) != 0)
            TYPE_NAME (tp)
-             = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
-                              name, strlen (name));
+             = ((const char *)
+                obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+                               name, strlen (name)));
        }
     }
   if (t->bt == btTypedef)
@@ -2335,7 +2345,6 @@ parse_partial_symbols (struct objfile *objfile)
   SYMR sh;
   struct partial_symtab *pst;
   int textlow_not_set = 1;
-  int past_first_source_file = 0;
 
   /* List of current psymtab's include files.  */
   const char **psymtab_include_list;
@@ -2395,8 +2404,7 @@ parse_partial_symbols (struct objfile *objfile)
   /* Allocate the map FDR -> PST.
      Minor hack: -O3 images might claim some global data belongs
      to FDR -1.  We`ll go along with that.  */
-  fdr_to_pst = (struct pst_map *)
-    xzalloc ((hdr->ifdMax + 1) * sizeof *fdr_to_pst);
+  fdr_to_pst = XCNEWVEC (struct pst_map, hdr->ifdMax + 1);
   old_chain = make_cleanup (xfree, fdr_to_pst);
   fdr_to_pst++;
   {
@@ -2415,7 +2423,7 @@ parse_partial_symbols (struct objfile *objfile)
          hdr->ifdMax * sizeof (struct mdebug_pending *));
 
   /* Pass 0 over external syms: swap them in.  */
-  ext_block = (EXTR *) xmalloc (hdr->iextMax * sizeof (EXTR));
+  ext_block = XNEWVEC (EXTR, hdr->iextMax);
   make_cleanup (xfree, ext_block);
 
   ext_out = (char *) debug_info->external_ext;
@@ -2827,10 +2835,11 @@ parse_partial_symbols (struct objfile *objfile)
                    /* Concatinate stabstring2 with stabstring1.  */
                    if (stabstring
                     && stabstring != debug_info->ss + fh->issBase + sh.iss)
-                     stabstring = xrealloc (stabstring, len + len2 + 1);
+                     stabstring
+                       = (char *) xrealloc (stabstring, len + len2 + 1);
                    else
                      {
-                       stabstring = xmalloc (len + len2 + 1);
+                       stabstring = (char *) xmalloc (len + len2 + 1);
                        strcpy (stabstring, stabstring1);
                      }
                    strcpy (stabstring + len, stabstring2);
@@ -2924,16 +2933,8 @@ parse_partial_symbols (struct objfile *objfile)
 
                  case N_SO:
                    {
-                     CORE_ADDR valu;
                      static int prev_so_symnum = -10;
-                     static int first_so_symnum;
                      const char *p;
-                     int prev_textlow_not_set;
-
-                     valu = sh.value + ANOFFSET (objfile->section_offsets,
-                                                 SECT_OFF_TEXT (objfile));
-
-                     prev_textlow_not_set = textlow_not_set;
 
                      /* A zero value is probably an indication for the
                         SunPRO 3.0 compiler.  dbx_end_psymtab explicitly tests
@@ -2941,19 +2942,12 @@ parse_partial_symbols (struct objfile *objfile)
 
                      if (sh.value == 0
                          && gdbarch_sofun_address_maybe_missing (gdbarch))
-                       {
-                         textlow_not_set = 1;
-                         valu = 0;
-                       }
+                       textlow_not_set = 1;
                      else
                        textlow_not_set = 0;
 
-                     past_first_source_file = 1;
-
                      if (prev_so_symnum != symnum - 1)
                        {               /* Here if prev stab wasn't N_SO.  */
-                         first_so_symnum = symnum;
-
                          if (pst)
                            {
                              pst = (struct partial_symtab *) 0;
@@ -3110,7 +3104,7 @@ parse_partial_symbols (struct objfile *objfile)
                        add_psymbol_to_list (namestring, p - namestring, 1,
                                             VAR_DOMAIN, LOC_STATIC,
                                             &objfile->static_psymbols,
-                                            0, sh.value,
+                                            sh.value,
                                             psymtab_language, objfile);
                        continue;
                      case 'G':
@@ -3122,7 +3116,7 @@ parse_partial_symbols (struct objfile *objfile)
                        add_psymbol_to_list (namestring, p - namestring, 1,
                                             VAR_DOMAIN, LOC_STATIC,
                                             &objfile->global_psymbols,
-                                            0, sh.value,
+                                            sh.value,
                                             psymtab_language, objfile);
                        continue;
 
@@ -3140,8 +3134,7 @@ parse_partial_symbols (struct objfile *objfile)
                            add_psymbol_to_list (namestring, p - namestring, 1,
                                                 STRUCT_DOMAIN, LOC_TYPEDEF,
                                                 &objfile->static_psymbols,
-                                                sh.value, 0,
-                                                psymtab_language, objfile);
+                                                0, psymtab_language, objfile);
                            if (p[2] == 't')
                              {
                                /* Also a typedef with the same name.  */
@@ -3149,8 +3142,7 @@ parse_partial_symbols (struct objfile *objfile)
                                                     p - namestring, 1,
                                                     VAR_DOMAIN, LOC_TYPEDEF,
                                                     &objfile->static_psymbols,
-                                                    sh.value, 0,
-                                                    psymtab_language,
+                                                    0, psymtab_language,
                                                     objfile);
                                p += 1;
                              }
@@ -3163,8 +3155,7 @@ parse_partial_symbols (struct objfile *objfile)
                            add_psymbol_to_list (namestring, p - namestring, 1,
                                                 VAR_DOMAIN, LOC_TYPEDEF,
                                                 &objfile->static_psymbols,
-                                                sh.value, 0,
-                                                psymtab_language, objfile);
+                                                0, psymtab_language, objfile);
                          }
                      check_enum:
                        /* If this is an enumerated type, we need to add
@@ -3228,7 +3219,7 @@ parse_partial_symbols (struct objfile *objfile)
                                add_psymbol_to_list (p, q - p, 1,
                                                     VAR_DOMAIN, LOC_CONST,
                                                     &objfile->static_psymbols,
-                                                    0, 0, psymtab_language,
+                                                    0, psymtab_language,
                                                     objfile);
                                /* Point past the name.  */
                                p = q;
@@ -3246,15 +3237,14 @@ parse_partial_symbols (struct objfile *objfile)
                        add_psymbol_to_list (namestring, p - namestring, 1,
                                             VAR_DOMAIN, LOC_CONST,
                                             &objfile->static_psymbols,
-                                            sh.value, 0, psymtab_language,
-                                            objfile);
+                                            0, psymtab_language, objfile);
                        continue;
 
                      case 'f':
                        if (! pst)
                          {
                            int name_len = p - namestring;
-                           char *name = xmalloc (name_len + 1);
+                           char *name = (char *) xmalloc (name_len + 1);
 
                            memcpy (name, namestring, name_len);
                            name[name_len] = '\0';
@@ -3266,7 +3256,7 @@ parse_partial_symbols (struct objfile *objfile)
                        add_psymbol_to_list (namestring, p - namestring, 1,
                                             VAR_DOMAIN, LOC_BLOCK,
                                             &objfile->static_psymbols,
-                                            0, sh.value,
+                                            sh.value,
                                             psymtab_language, objfile);
                        continue;
 
@@ -3278,7 +3268,7 @@ parse_partial_symbols (struct objfile *objfile)
                        if (! pst)
                          {
                            int name_len = p - namestring;
-                           char *name = xmalloc (name_len + 1);
+                           char *name = (char *) xmalloc (name_len + 1);
 
                            memcpy (name, namestring, name_len);
                            name[name_len] = '\0';
@@ -3290,7 +3280,7 @@ parse_partial_symbols (struct objfile *objfile)
                        add_psymbol_to_list (namestring, p - namestring, 1,
                                             VAR_DOMAIN, LOC_BLOCK,
                                             &objfile->global_psymbols,
-                                            0, sh.value,
+                                            sh.value,
                                             psymtab_language, objfile);
                        continue;
 
@@ -3533,12 +3523,12 @@ parse_partial_symbols (struct objfile *objfile)
                    add_psymbol_to_list (name, strlen (name), 1,
                                         VAR_DOMAIN, LOC_BLOCK,
                                         &objfile->global_psymbols,
-                                   0, sh.value, psymtab_language, objfile);
+                                        sh.value, psymtab_language, objfile);
                  else
                    add_psymbol_to_list (name, strlen (name), 1,
                                         VAR_DOMAIN, LOC_BLOCK,
                                         &objfile->static_psymbols,
-                                   0, sh.value, psymtab_language, objfile);
+                                        sh.value, psymtab_language, objfile);
 
                  procaddr = sh.value;
 
@@ -3605,8 +3595,7 @@ parse_partial_symbols (struct objfile *objfile)
                      add_psymbol_to_list (name, strlen (name), 1,
                                           STRUCT_DOMAIN, LOC_TYPEDEF,
                                           &objfile->static_psymbols,
-                                          0, (CORE_ADDR) 0,
-                                          psymtab_language, objfile);
+                                          0, psymtab_language, objfile);
                    }
                  handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
 
@@ -3646,7 +3635,7 @@ parse_partial_symbols (struct objfile *objfile)
              add_psymbol_to_list (name, strlen (name), 1,
                                   VAR_DOMAIN, theclass,
                                   &objfile->static_psymbols,
-                                  0, sh.value, psymtab_language, objfile);
+                                  sh.value, psymtab_language, objfile);
            skip:
              cur_sdx++;        /* Go to next file symbol.  */
            }
@@ -3726,8 +3715,7 @@ parse_partial_symbols (struct objfile *objfile)
              add_psymbol_to_list (name, strlen (name), 1,
                                   VAR_DOMAIN, theclass,
                                   &objfile->global_psymbols,
-                                  0, svalue,
-                                  psymtab_language, objfile);
+                                  svalue, psymtab_language, objfile);
            }
        }
 
@@ -3891,8 +3879,8 @@ handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype,
          in psymtabs, just in symtabs.  */
       add_psymbol_to_list (name, strlen (name), 1,
                           VAR_DOMAIN, LOC_CONST,
-                          &objfile->static_psymbols, 0,
-                          (CORE_ADDR) 0, psymtab_language, objfile);
+                          &objfile->static_psymbols,
+                          0, psymtab_language, objfile);
       ext_sym += external_sym_size;
     }
 }
@@ -4141,7 +4129,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
          PDR *pdr_in;
          PDR *pdr_in_end;
 
-         pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
+         pr_block = XNEWVEC (PDR, fh->cpd);
          old_chain = make_cleanup (xfree, pr_block);
 
          pdr_ptr = ((char *) debug_info->external_pdr
@@ -4244,7 +4232,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
              PDR *pdr_in;
              PDR *pdr_in_end;
 
-             pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
+             pr_block = XNEWVEC (PDR, fh->cpd);
 
              old_chain = make_cleanup (xfree, pr_block);
 
@@ -4285,10 +4273,10 @@ psymtab_to_symtab_1 (struct objfile *objfile,
       if (size > 1)
        --size;
       SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
-       = obstack_copy (&mdebugread_objfile->objfile_obstack,
-                       lines,
-                       (sizeof (struct linetable)
-                        + size * sizeof (lines->item)));
+       = ((struct linetable *)
+          obstack_copy (&mdebugread_objfile->objfile_obstack,
+                        lines, (sizeof (struct linetable)
+                                + size * sizeof (lines->item))));
       xfree (lines);
 
       /* .. and our share of externals.
@@ -4383,7 +4371,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
   int xref_fd;
   struct mdebug_pending *pend;
 
-  *tpp = (struct type *) NULL;
+  *tpp = NULL;
 
   (*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn);
 
@@ -4399,13 +4387,13 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
     }
 
   /* mips cc uses a rf of -1 for opaque struct definitions.
-     Set TYPE_FLAG_STUB for these types so that check_typedef will
+     Set TYPE_STUB for these types so that check_typedef will
      resolve them if the struct gets defined in another compilation unit.  */
   if (rf == -1)
     {
       *pname = "<undefined>";
-      *tpp = init_type (type_code, 0, TYPE_FLAG_STUB,
-                       (char *) NULL, mdebugread_objfile);
+      *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
+      TYPE_STUB (*tpp) = 1;
       return result;
     }
 
@@ -4491,8 +4479,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
          switch (tir.bt)
            {
            case btVoid:
-             *tpp = init_type (type_code, 0, 0, (char *) NULL,
-                               mdebugread_objfile);
+             *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
              *pname = "<undefined>";
              break;
 
@@ -4527,8 +4514,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
              complaint (&symfile_complaints,
                         _("illegal bt %d in forward typedef for %s"), tir.bt,
                         sym_name);
-             *tpp = init_type (type_code, 0, 0, (char *) NULL,
-                               mdebugread_objfile);
+             *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
              break;
            }
          return result;
@@ -4556,7 +4542,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
             has not been parsed yet.
             Initialize the type only, it will be filled in when
             it's definition is parsed.  */
-         *tpp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
+         *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
        }
       add_pending (fh, esh, *tpp);
     }
@@ -4837,7 +4823,7 @@ new_block (enum block_type type)
   /* FIXME: carlton/2003-09-11: This should use allocate_block to
      allocate the block.  Which, in turn, suggests that the block
      should be allocated on an obstack.  */
-  struct block *retval = xzalloc (sizeof (struct block));
+  struct block *retval = XCNEW (struct block);
 
   if (type == FUNCTION_BLOCK)
     BLOCK_DICT (retval) = dict_create_linear_expandable ();
This page took 0.034171 seconds and 4 git commands to generate.