Correct disassembly of dot product instructions.
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 952dffb60a31610bc5a9e0bb4573abf9330dfedb..debf46dc61697425283b027c9f8e88f0fda94e10 100644 (file)
@@ -68,8 +68,6 @@
 
 #include "expression.h"
 
-extern void _initialize_mdebugread (void);
-
 /* Provide a way to test if we have both ECOFF and ELF symbol tables.
    We use this define in order to know whether we should override a 
    symbol's ECOFF section with its ELF section.  This is necessary in 
@@ -220,7 +218,7 @@ static int found_ecoff_debugging_info;
 /* Forward declarations.  */
 
 static int upgrade_type (int, struct type **, int, union aux_ext *,
-                        int, char *);
+                        int, const char *);
 
 static void parse_partial_symbols (minimal_symbol_reader &,
                                   struct objfile *);
@@ -228,15 +226,15 @@ static void parse_partial_symbols (minimal_symbol_reader &,
 static int has_opaque_xref (FDR *, SYMR *);
 
 static int cross_ref (int, union aux_ext *, struct type **, enum type_code,
-                     char **, int, char *);
+                     const char **, int, const char *);
 
-static struct symbol *new_symbol (char *);
+static struct symbol *new_symbol (const char *);
 
 static struct type *new_type (char *);
 
 enum block_type { FUNCTION_BLOCK, NON_FUNCTION_BLOCK };
 
-static struct block *new_block (enum block_type);
+static struct block *new_block (enum block_type, enum language);
 
 static struct compunit_symtab *new_symtab (const char *, int, struct objfile *);
 
@@ -245,14 +243,14 @@ static struct linetable *new_linetable (int);
 static struct blockvector *new_bvect (int);
 
 static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
-                               int, char *);
+                               int, const char *);
 
-static struct symbol *mylookup_symbol (char *, const struct block *,
+static struct symbol *mylookup_symbol (const char *, const struct block *,
                                       domain_enum, enum address_class);
 
 static void sort_blocks (struct symtab *);
 
-static struct partial_symtab *new_psymtab (char *, struct objfile *);
+static struct partial_symtab *new_psymtab (const char *, struct objfile *);
 
 static void psymtab_to_symtab_1 (struct objfile *objfile,
                                 struct partial_symtab *, const char *);
@@ -268,7 +266,7 @@ static struct linetable *shrink_linetable (struct linetable *);
 static void handle_psymbol_enumerators (struct objfile *, FDR *, int,
                                        CORE_ADDR);
 
-static char *mdebug_next_symbol_text (struct objfile *);
+static const char *mdebug_next_symbol_text (struct objfile *);
 \f
 /* Exported procedure: Builds a symtab from the partial symtab SELF.
    Restores the environment in effect when SELF was created, delegates
@@ -322,7 +320,7 @@ get_rfd (int cf, int rf)
 
 /* Return a safer print NAME for a file descriptor.  */
 
-static char *
+static const char *
 fdr_name (FDR *f)
 {
   if (f->rss == -1)
@@ -574,7 +572,7 @@ static int mdebug_regparm_index;
 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)
+                struct objfile *objfile, const char *name)
 {
   SYMBOL_DOMAIN (s) = VAR_DOMAIN;
   SYMBOL_ACLASS_INDEX (s) = aclass_index;
@@ -596,7 +594,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
-  char *name;
+  const char *name;
   struct symbol *s;
   struct block *b;
   struct mdebug_pending *pend;
@@ -811,7 +809,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
        TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
 
       /* Create and enter a new lexical context.  */
-      b = new_block (FUNCTION_BLOCK);
+      b = new_block (FUNCTION_BLOCK, SYMBOL_LANGUAGE (s));
       SYMBOL_BLOCK_VALUE (s) = b;
       BLOCK_FUNCTION (b) = s;
       BLOCK_START (b) = BLOCK_END (b) = sh->value;
@@ -1144,7 +1142,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
        }
 
       top_stack->blocktype = stBlock;
-      b = new_block (NON_FUNCTION_BLOCK);
+      b = new_block (NON_FUNCTION_BLOCK, psymtab_language);
       BLOCK_START (b) = sh->value + top_stack->procadr;
       BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
       top_stack->cur_block = b;
@@ -1471,14 +1469,13 @@ basic_type (int bt, struct objfile *objfile)
 
     case btFloatDec:
       tp = init_type (objfile, TYPE_CODE_ERROR,
-                     gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
-                     "floating decimal");
+                     gdbarch_double_bit (gdbarch), "floating decimal");
       break;
 
     case btString:
       /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
         FIXME.  */
-      tp = init_type (objfile, TYPE_CODE_STRING, 1, "string");
+      tp = init_type (objfile, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string");
       break;
 
     case btVoid:
@@ -1530,7 +1527,7 @@ basic_type (int bt, struct objfile *objfile)
 
 static struct type *
 parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
-           int bigend, char *sym_name)
+           int bigend, const char *sym_name)
 {
   TIR t[1];
   struct type *tp = 0;
@@ -1658,7 +1655,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
      name.  This apparently is a MIPS extension for C sets.  */
       t->bt == btSet)
     {
-      char *name;
+      const char *name;
 
       /* Try to cross reference this type, build new type on failure.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
@@ -1718,7 +1715,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
      FIXME: We are not doing any guessing on range types.  */
   if (t->bt == btRange)
     {
-      char *name;
+      const char *name;
 
       /* Try to cross reference this type, build new type on failure.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
@@ -1751,7 +1748,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
     }
   if (t->bt == btTypedef)
     {
-      char *name;
+      const char *name;
 
       /* Try to cross reference this type, it should succeed.  */
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
@@ -1819,7 +1816,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 
 static int
 upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
-             char *sym_name)
+             const char *sym_name)
 {
   int off;
   struct type *t;
@@ -2110,7 +2107,7 @@ parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
   /* Reading .o files */
   if (SC_IS_UNDEF (es->asym.sc) || es->asym.sc == scNil)
     {
-      char *what;
+      const char *what;
       switch (es->asym.st)
        {
        case stNil:
@@ -2660,8 +2657,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
       pst = start_psymtab_common (objfile,
                                  fdr_name (fh),
                                  textlow,
-                                 objfile->global_psymbols.next,
-                                 objfile->static_psymbols.next);
+                                 objfile->global_psymbols,
+                                 objfile->static_psymbols);
       pst->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
                                                sizeof (struct symloc));
       memset (pst->read_symtab_private, 0, sizeof (struct symloc));
@@ -2851,7 +2848,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 
                switch (type_code)
                  {
-                   char *p;
+                   const char *p;
 
                    /* Standard, external, non-debugger, symbols.  */
 
@@ -3205,7 +3202,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
                               Accept either.  */
                            while (*p && *p != ';' && *p != ',')
                              {
-                               char *q;
+                               const char *q;
 
                                /* Check for and handle cretinous dbx
                                   symbol name continuation!  */
@@ -3887,7 +3884,7 @@ handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype,
 
 /* Get the next symbol.  OBJFILE is unused.  */
 
-static char *
+static const char *
 mdebug_next_symbol_text (struct objfile *objfile)
 {
   SYMR sh;
@@ -4026,6 +4023,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
          if (ECOFF_IS_STAB (&sh) || (name[0] == '#'))
            {
              int type_code = ECOFF_UNMARK_STAB (sh.index);
+             enum language language = PST_PRIVATE (pst)->pst_language;
 
              /* We should never get non N_STAB symbols here, but they
                 should be harmless, so keep process_one_symbol from
@@ -4053,14 +4051,14 @@ psymtab_to_symtab_1 (struct objfile *objfile,
                    {
                      last_symtab_ended = 0;
                      process_one_symbol (type_code, 0, valu, name,
-                                         section_offsets, objfile);
+                                         section_offsets, objfile, language);
                    }
                }
              /* Similarly a hack.  */
              else if (name[0] == '#')
                {
                  process_one_symbol (N_SLINE, 0, valu, name,
-                                     section_offsets, objfile);
+                                     section_offsets, objfile, language);
                }
              if (type_code == N_FUN)
                {
@@ -4360,7 +4358,7 @@ static int
 cross_ref (int fd, union aux_ext *ax, struct type **tpp,
           enum type_code type_code,
           /* Use to alloc new type if none is found.  */
-          char **pname, int bigend, char *sym_name)
+          const char **pname, int bigend, const char *sym_name)
 {
   RNDXR rn[1];
   unsigned int rf;
@@ -4556,7 +4554,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
    keeping the symtab sorted.  */
 
 static struct symbol *
-mylookup_symbol (char *name, const struct block *block,
+mylookup_symbol (const char *name, const struct block *block,
                 domain_enum domain, enum address_class theclass)
 {
   struct block_iterator iter;
@@ -4721,16 +4719,18 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
   struct compunit_symtab *cust = allocate_compunit_symtab (objfile, name);
   struct symtab *symtab;
   struct blockvector *bv;
+  enum language lang;
 
   add_compunit_symtab_to_objfile (cust);
   symtab = allocate_symtab (cust, name);
 
   SYMTAB_LINETABLE (symtab) = new_linetable (maxlines);
+  lang = compunit_language (cust);
 
   /* All symtabs must have at least two blocks.  */
   bv = new_bvect (2);
-  BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK);
-  BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK);
+  BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
+  BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK, lang);
   BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
     BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
   COMPUNIT_BLOCKVECTOR (cust) = bv;
@@ -4742,7 +4742,7 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
 /* Allocate a new partial_symtab NAME.  */
 
 static struct partial_symtab *
-new_psymtab (char *name, struct objfile *objfile)
+new_psymtab (const char *name, struct objfile *objfile)
 {
   struct partial_symtab *psymtab;
 
@@ -4812,13 +4812,13 @@ new_bvect (int nblocks)
   return bv;
 }
 
-/* Allocate and zero a new block, and set its BLOCK_DICT.  If function
-   is non-zero, assume the block is associated to a function, and make
-   sure that the symbols are stored linearly; otherwise, store them
-   hashed.  */
+/* Allocate and zero a new block of language LANGUAGE, and set its
+   BLOCK_DICT.  If function is non-zero, assume the block is
+   associated to a function, and make sure that the symbols are stored
+   linearly; otherwise, store them hashed.  */
 
 static struct block *
-new_block (enum block_type type)
+new_block (enum block_type type, enum language language)
 {
   /* FIXME: carlton/2003-09-11: This should use allocate_block to
      allocate the block.  Which, in turn, suggests that the block
@@ -4826,9 +4826,9 @@ new_block (enum block_type type)
   struct block *retval = XCNEW (struct block);
 
   if (type == FUNCTION_BLOCK)
-    BLOCK_DICT (retval) = dict_create_linear_expandable ();
+    BLOCK_DICT (retval) = dict_create_linear_expandable (language);
   else
-    BLOCK_DICT (retval) = dict_create_hashed_expandable ();
+    BLOCK_DICT (retval) = dict_create_hashed_expandable (language);
 
   return retval;
 }
@@ -4836,7 +4836,7 @@ new_block (enum block_type type)
 /* Create a new symbol with printname NAME.  */
 
 static struct symbol *
-new_symbol (char *name)
+new_symbol (const char *name)
 {
   struct symbol *s = allocate_symbol (mdebugread_objfile);
 
This page took 0.03014 seconds and 4 git commands to generate.