* doc/binutils.texi: Fix typos.
[deliverable/binutils-gdb.git] / gdb / hpread.c
index 98869a8eb121c46d3284158454c5010e1a68dd86..d64b4cae62da76a63ef3fee23d48f463de5caf1c 100644 (file)
@@ -98,7 +98,8 @@ struct hpread_symfile_info
     *NAMEP = ""; \
   else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
     { \
-      complain (&string_table_offset_complaint, (char *) symnum); \
+      complaint (&symfile_complaints, "bad string table offset in symbol %d", \
+                (char *) symnum); \
       *NAMEP = ""; \
     } \
   else \
@@ -127,57 +128,20 @@ struct symloc
 #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
 #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
 \f
-/* FIXME: Shouldn't this stuff be in a .h file somewhere?  */
 /* Complaints about the symbols we have encountered.  */
-extern struct complaint string_table_offset_complaint;
-extern struct complaint lbrac_unmatched_complaint;
-extern struct complaint lbrac_mismatch_complaint;
-\f
-static struct complaint hpread_unhandled_end_common_complaint =
-{
-  "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n", 0, 0
-};
-
-static struct complaint hpread_unhandled_type_complaint =
-{
-  "hpread_type_translate: unhandled type code.", 0, 0
-};
-
-static struct complaint hpread_struct_complaint =
-{
-  "hpread_read_struct_type: expected SVAR type...", 0, 0
-};
-
-static struct complaint hpread_array_complaint =
-{
-  "error in hpread_array_type.", 0, 0
-};
-
-static struct complaint hpread_type_lookup_complaint =
-{
-  "error in hpread_type_lookup().", 0, 0
-};
-
-
-static struct complaint hpread_unexpected_end_complaint =
-{
-  "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind.", 0, 0
-};
-
-static struct complaint hpread_tagdef_complaint =
-{
-  "error processing class tagdef", 0, 0
-};
-
-static struct complaint hpread_unhandled_common_complaint =
+static void
+lbrac_unmatched_complaint (int arg1)
 {
-  "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON.", 0, 0
-};
+  complaint (&symfile_complaints, "unmatched N_LBRAC before symtab pos %d",
+            arg1);
+}
 
-static struct complaint hpread_unhandled_blockdata_complaint =
+static void
+lbrac_mismatch_complaint (int arg1)
 {
-  "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA.", 0, 0
-};
+  complaint (&symfile_complaints,
+            "N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d", arg1);
+}
 
 /* To generate dumping code, uncomment this define.  The dumping
    itself is controlled by routine-local statics called "dumping". */
@@ -220,6 +184,8 @@ static unsigned long hpread_get_line (sltpointer, struct objfile *);
 
 static CORE_ADDR hpread_get_location (sltpointer, struct objfile *);
 
+int hpread_has_name (enum dntt_entry_type kind);
+
 static void hpread_psymtab_to_symtab_1 (struct partial_symtab *);
 
 void hpread_psymtab_to_symtab (struct partial_symtab *);
@@ -596,11 +562,11 @@ pst_syms_struct;
 
 static pst_syms_struct *pst_syms_array = 0;
 
-static pst_syms_count = 0;
-static pst_syms_size = 0;
+static int pst_syms_count = 0;
+static int pst_syms_size = 0;
 
 /* used by the TELL_OBJFILE macro */
-static boolean told_objfile = 0;
+static int told_objfile = 0;
 
 /* Set up psymtab symbol index stuff */
 static void
@@ -3186,6 +3152,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
          TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          TYPE_FIELD_BITSIZE (type, n) = 0;
+         TYPE_FIELD_STATIC_KIND (type, n) = 0;
        }
       if (syms == osyms)
        break;
@@ -3347,6 +3314,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
          TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
          TYPE_FIELD_ARTIFICIAL (type, n) = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
+         TYPE_FIELD_STATIC_KIND (type, n) = 0;
        }
     }
   /* Mark it as having been processed */
@@ -3520,6 +3488,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
          TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
          TYPE_FIELD_ARTIFICIAL (type, n) = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
+         TYPE_FIELD_STATIC_KIND (type, n) = 0;
        }
     }
 
@@ -3704,6 +3673,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
          list = new;
 
          FIELD_BITSIZE (list->field) = 0;
+         FIELD_STATIC_KIND (list->field) = 0;
 
          /* The "classname" field is actually a DNTT pointer to the base class */
          baseclass = hpread_type_lookup (parentp->dinheritance.classname,
@@ -3959,26 +3929,9 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
              /* But mark it as NULL if the method was incompletely processed
                 We'll fix this up later when the method is fully processed */
              if (TYPE_INCOMPLETE (memtype))
-               {
-                 fn_p->field.fn_fields[ix].type = NULL;
-               }
+               fn_p->field.fn_fields[ix].type = NULL;
              else
-               {
-                 fn_p->field.fn_fields[ix].type = memtype;
-
-                 /* The argument list */
-                 TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types
-                   = (struct type **) obstack_alloc (&objfile->type_obstack,
-                                                     (sizeof (struct type *)
-                                                      * (TYPE_NFIELDS (memtype)
-                                                         + 1)));
-                 for (i = 0; i < TYPE_NFIELDS (memtype); i++)
-                   TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
-                     .arg_types[i] = TYPE_FIELDS (memtype)[i].type;
-                 /* void termination */
-                 TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
-                   .arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void;
-               }
+               fn_p->field.fn_fields[ix].type = memtype;
 
              /* For virtual functions, fill in the voffset field with the
               * virtual table offset. (This is just copied over from the
@@ -4055,7 +4008,6 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
              list = new;
 
              list->field.name = VT (objfile) + fn_fieldp->dsvar.name;
-             FIELD_BITSIZE (list->field) = -1;         /* indicates static member */
              SET_FIELD_PHYSNAME (list->field, 0);      /* initialize to empty */
              memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile);
 
@@ -4119,6 +4071,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
              list->field.name = VT (objfile) + fn_fieldp->dsvar.name;
              FIELD_BITPOS (list->field) = 0;   /* FIXME is this always true? */
              FIELD_BITSIZE (list->field) = 0;  /* use length from type */
+             FIELD_STATIC_KIND (list->field) = 0;
              memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile);
              list->field.type = memtype;
              list->attributes = 0;
@@ -4138,6 +4091,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
              list->field.name = VT (objfile) + fn_fieldp->ddvar.name;
              FIELD_BITPOS (list->field) = 0;   /* FIXME is this always true? */
              FIELD_BITSIZE (list->field) = 0;  /* use length from type */
+             FIELD_STATIC_KIND (list->field) = 0;
              memtype = hpread_type_lookup (fn_fieldp->ddvar.type, objfile);
              list->field.type = memtype;
              list->attributes = 0;
@@ -4186,6 +4140,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
 
 
          /* A FIELD by itself (without a GENFIELD) can also be a static member */
+         FIELD_STATIC_KIND (list->field) = 0;
          if (fieldp->dfield.staticmem)
            {
              FIELD_BITPOS (list->field) = -1;
@@ -4455,14 +4410,6 @@ fixup_class_method_type (struct type *class, struct type *method,
        {
          /* Set the method type */
          TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method;
-         /* The argument list */
-         TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types
-           = (struct type **) obstack_alloc (&objfile->type_obstack,
-                           sizeof (struct type *) * (TYPE_NFIELDS (method) + 1));
-         for (k = 0; k < TYPE_NFIELDS (method); k++)
-           TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type;
-         /* void termination */
-         TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void;
 
          /* Break out of both loops -- only one method to fix up in a class */
          goto finish;
@@ -4792,7 +4739,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
          dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
        else
          {
-           complain (&hpread_type_lookup_complaint);
+           complaint (&symfile_complaints, "error in hpread_type_lookup().");
            return NULL;
          }
 
@@ -4916,21 +4863,18 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
        struct type *retvaltype;
        int nargs;
        int i;
-       struct type **args_type;
        class_type = hpread_type_lookup (dn_bufp->dptrmem.pointsto,
                                         objfile);
        functype = hpread_type_lookup (dn_bufp->dptrmem.memtype,
                                       objfile);
        retvaltype = TYPE_TARGET_TYPE (functype);
        nargs = TYPE_NFIELDS (functype);
-       args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *));
-       for (i = 0; i < nargs; i++)
-         {
-           args_type[i] = TYPE_FIELD_TYPE (functype, i);
-         }
-       args_type[nargs] = NULL;
        ptrmemtype = alloc_type (objfile);
-       smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type);
+
+       smash_to_method_type (ptrmemtype, class_type, retvaltype,
+                             TYPE_FIELDS (functype),
+                             TYPE_NFIELDS (functype),
+                             0);
        return make_pointer_type (ptrmemtype, NULL);
       }
       break;
@@ -5289,7 +5233,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
 
       /* Stack must be empty now.  */
       if (context_stack_depth != 0)
-       complain (&lbrac_unmatched_complaint, (char *) symnum);
+       lbrac_unmatched_complaint ((char *) symnum);
       new = push_context (0, valu);
 
       /* Built a type for the function. This includes processing
@@ -5407,7 +5351,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
       CURRENT_FUNCTION_VALUE (objfile) = valu;
       /* Stack must be empty now.  */
       if (context_stack_depth != 0)
-       complain (&lbrac_unmatched_complaint, (char *) symnum);
+       lbrac_unmatched_complaint ((char *) symnum);
       new = push_context (0, valu);
 
       /* Built a type for the function. This includes processing
@@ -5635,7 +5579,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
              new = pop_context ();
              desc = dn_bufp->dend.beginscope.dnttp.index;
              if (desc != new->depth)
-               complain (&lbrac_mismatch_complaint, (char *) symnum);
+               lbrac_mismatch_complaint ((char *) symnum);
 
              /* Make a block for the local symbols within.  */
              finish_block (new->name, &local_symbols, new->old_blocks,
@@ -5653,7 +5597,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
 
        case DNTT_TYPE_COMMON:
          /* End a FORTRAN common block. We don't currently handle these */
-         complain (&hpread_unhandled_end_common_complaint);
+         complaint (&symfile_complaints,
+                    "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n");
          break;
 
        case DNTT_TYPE_CLASS_SCOPE:
@@ -5670,7 +5615,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
          new = pop_context ();
          desc = dn_bufp->dend.beginscope.dnttp.index;
          if (desc != new->depth)
-           complain (&lbrac_mismatch_complaint, (char *) symnum);
+           lbrac_mismatch_complaint ((char *) symnum);
          /* Make a block for the local symbols within.  */
          finish_block (new->name, &local_symbols, new->old_blocks,
                        new->start_addr, valu, objfile);
@@ -5680,7 +5625,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
          break;
 
        default:
-         complain (&hpread_unexpected_end_complaint);
+         complaint (&symfile_complaints,
+                    "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind.");
          break;
        }
       break;
@@ -5771,7 +5717,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
        {
          /* Thread-local variable.
           */
-         SYMBOL_CLASS (sym) = LOC_THREAD_LOCAL_STATIC;
+         SYMBOL_CLASS (sym) = LOC_HP_THREAD_LOCAL_STATIC;
          SYMBOL_BASEREG (sym) = CR27_REGNUM;
 
          if (objfile->flags & OBJF_SHARED)
@@ -5902,7 +5848,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
          dn_bufp = hpread_get_lntt (dn_bufp->dtag.type.dnttp.index, objfile);
        else
          {
-           complain (&hpread_tagdef_complaint);
+           complaint (&symfile_complaints, "error processing class tagdef");
            return;
          }
        if (dn_bufp->dblock.kind == DNTT_TYPE_CLASS ||
@@ -6010,7 +5956,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
 
     case DNTT_TYPE_COMMON:
       /* FORTRAN common. Not yet handled. */
-      complain (&hpread_unhandled_common_complaint);
+      complaint (&symfile_complaints,
+                "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON.");
       break;
 
       /* DNTT_TYPE_COBSTRUCT is not handled by GDB.  */
@@ -6022,7 +5969,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
       /* Not sure what this is - part of FORTRAN support maybe? 
        * Anyway, not yet handled.
        */
-      complain (&hpread_unhandled_blockdata_complaint);
+      complaint (&symfile_complaints,
+                "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA.");
       break;
 
     case DNTT_TYPE_CLASS_SCOPE:
This page took 0.027104 seconds and 4 git commands to generate.