2002-11-08 Jeff Johnston <jjohnstn@redhat.com>
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 7be8080b11b407e5fedfd539a40145284cd17873..cdf800d67b86175449a924ce66ca23120cb48b67 100644 (file)
 #include "gdbcore.h"
 #include "symfile.h"
 #include "objfiles.h"
-#include "obstack.h"
+#include "gdb_obstack.h"
 #include "buildsym.h"
 #include "stabsread.h"
 #include "complaints.h"
 #include "demangle.h"
+#include "gdb_assert.h"
 
 /* These are needed if the tm.h file does not contain the necessary
    mips specific definitions.  */
@@ -105,11 +106,6 @@ extern void _initialize_mdebugread (void);
 
 struct symloc
   {
-    /* Our running best guess as to the range of text addresses for
-       this psymtab.  After we've read everything in, we use this to
-       build pst->text_addrs.  */
-    CORE_ADDR textlow, texthigh;
-
     /* Index of the FDR that this psymtab represents.  */
     int fdr_idx;
     /* The BFD that the psymtab was created from.  */
@@ -125,8 +121,6 @@ struct symloc
   };
 
 #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private)
-#define TEXTLOW(p) (PST_PRIVATE(p)->textlow)
-#define TEXTHIGH(p) (PST_PRIVATE(p)->texthigh)
 #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
 #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
 #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap)
@@ -143,99 +137,100 @@ struct symloc
                   || (sc) == scPData \
                   || (sc) == scXData)
 #define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
-#define SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss)
+#define SC_IS_BSS(sc) ((sc) == scBss)
+#define SC_IS_SBSS(sc) ((sc) == scSBss)
 #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
 \f
 /* Various complaints about symbol reading that don't abort the process */
 
-static struct complaint bad_file_number_complaint =
+static struct deprecated_complaint bad_file_number_complaint =
 {"bad file number %d", 0, 0};
 
-static struct complaint index_complaint =
+static struct deprecated_complaint index_complaint =
 {"bad aux index at symbol %s", 0, 0};
 
-static struct complaint aux_index_complaint =
+static struct deprecated_complaint aux_index_complaint =
 {"bad proc end in aux found from symbol %s", 0, 0};
 
-static struct complaint block_index_complaint =
+static struct deprecated_complaint block_index_complaint =
 {"bad aux index at block symbol %s", 0, 0};
 
-static struct complaint unknown_ext_complaint =
+static struct deprecated_complaint unknown_ext_complaint =
 {"unknown external symbol %s", 0, 0};
 
-static struct complaint unknown_sym_complaint =
+static struct deprecated_complaint unknown_sym_complaint =
 {"unknown local symbol %s", 0, 0};
 
-static struct complaint unknown_st_complaint =
+static struct deprecated_complaint unknown_st_complaint =
 {"with type %d", 0, 0};
 
-static struct complaint block_overflow_complaint =
+static struct deprecated_complaint block_overflow_complaint =
 {"block containing %s overfilled", 0, 0};
 
-static struct complaint basic_type_complaint =
+static struct deprecated_complaint basic_type_complaint =
 {"cannot map ECOFF basic type 0x%x for %s", 0, 0};
 
-static struct complaint unknown_type_qual_complaint =
+static struct deprecated_complaint unknown_type_qual_complaint =
 {"unknown type qualifier 0x%x", 0, 0};
 
-static struct complaint array_index_type_complaint =
+static struct deprecated_complaint array_index_type_complaint =
 {"illegal array index type for %s, assuming int", 0, 0};
 
-static struct complaint bad_tag_guess_complaint =
+static struct deprecated_complaint bad_tag_guess_complaint =
 {"guessed tag type of %s incorrectly", 0, 0};
 
-static struct complaint block_member_complaint =
+static struct deprecated_complaint block_member_complaint =
 {"declaration block contains unhandled symbol type %d", 0, 0};
 
-static struct complaint stEnd_complaint =
+static struct deprecated_complaint stEnd_complaint =
 {"stEnd with storage class %d not handled", 0, 0};
 
-static struct complaint unknown_mdebug_symtype_complaint =
+static struct deprecated_complaint unknown_mdebug_symtype_complaint =
 {"unknown symbol type 0x%x", 0, 0};
 
-static struct complaint stab_unknown_complaint =
+static struct deprecated_complaint stab_unknown_complaint =
 {"unknown stabs symbol %s", 0, 0};
 
-static struct complaint pdr_for_nonsymbol_complaint =
+static struct deprecated_complaint pdr_for_nonsymbol_complaint =
 {"PDR for %s, but no symbol", 0, 0};
 
-static struct complaint pdr_static_symbol_complaint =
+static struct deprecated_complaint pdr_static_symbol_complaint =
 {"can't handle PDR for static proc at 0x%lx", 0, 0};
 
-static struct complaint bad_setjmp_pdr_complaint =
+static struct deprecated_complaint bad_setjmp_pdr_complaint =
 {"fixing bad setjmp PDR from libc", 0, 0};
 
-static struct complaint bad_fbitfield_complaint =
+static struct deprecated_complaint bad_fbitfield_complaint =
 {"can't handle TIR fBitfield for %s", 0, 0};
 
-static struct complaint bad_continued_complaint =
+static struct deprecated_complaint bad_continued_complaint =
 {"illegal TIR continued for %s", 0, 0};
 
-static struct complaint bad_rfd_entry_complaint =
+static struct deprecated_complaint bad_rfd_entry_complaint =
 {"bad rfd entry for %s: file %d, index %d", 0, 0};
 
-static struct complaint unexpected_type_code_complaint =
+static struct deprecated_complaint unexpected_type_code_complaint =
 {"unexpected type code for %s", 0, 0};
 
-static struct complaint unable_to_cross_ref_complaint =
+static struct deprecated_complaint unable_to_cross_ref_complaint =
 {"unable to cross ref btTypedef for %s", 0, 0};
 
-static struct complaint bad_indirect_xref_complaint =
+static struct deprecated_complaint bad_indirect_xref_complaint =
 {"unable to cross ref btIndirect for %s", 0, 0};
 
-static struct complaint illegal_forward_tq0_complaint =
+static struct deprecated_complaint illegal_forward_tq0_complaint =
 {"illegal tq0 in forward typedef for %s", 0, 0};
 
-static struct complaint illegal_forward_bt_complaint =
+static struct deprecated_complaint illegal_forward_bt_complaint =
 {"illegal bt %d in forward typedef for %s", 0, 0};
 
-static struct complaint bad_linetable_guess_complaint =
+static struct deprecated_complaint bad_linetable_guess_complaint =
 {"guessed size of linetable for %s incorrectly", 0, 0};
 
-static struct complaint bad_ext_ifd_complaint =
+static struct deprecated_complaint bad_ext_ifd_complaint =
 {"bad ifd for external symbol: %d (max %d)", 0, 0};
 
-static struct complaint bad_ext_iss_complaint =
+static struct deprecated_complaint bad_ext_iss_complaint =
 {"bad iss for external symbol: %ld (max %ld)", 0, 0};
 
 /* Macros and extra defs */
@@ -327,30 +322,15 @@ static int found_ecoff_debugging_info;
 
 /* Forward declarations */
 
-static void add_pending (FDR *, char *, struct type *);
-
-static struct mdebug_pending *is_pending_symbol (FDR *, char *);
-
-static void pop_parse_stack (void);
-
-static void push_parse_stack (void);
-
-static char *fdr_name (FDR *);
-
-static void mdebug_psymtab_to_symtab (struct partial_symtab *);
-
-static int
-upgrade_type (int, struct type **, int, union aux_ext *, int, char *);
+static int upgrade_type (int, struct type **, int, union aux_ext *,
+                        int, char *);
 
 static void parse_partial_symbols (struct objfile *);
 
-static FDR * get_rfd (int, int);
-
 static int has_opaque_xref (FDR *, SYMR *);
 
-static int
-cross_ref (int, union aux_ext *, struct type **, enum type_code,
-          char **, int, char *);
+static int cross_ref (int, union aux_ext *, struct type **, enum type_code,
+                     char **, int, char *);
 
 static struct symbol *new_symbol (char *);
 
@@ -364,10 +344,6 @@ static struct linetable *new_linetable (int);
 
 static struct blockvector *new_bvect (int);
 
-static int
-parse_symbol (SYMR *, union aux_ext *, char *, int, struct section_offsets *,
-             struct objfile *);
-
 static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
                                int, char *);
 
@@ -376,12 +352,8 @@ static struct symbol *mylookup_symbol (char *, struct block *, namespace_enum,
 
 static struct block *shrink_block (struct block *, struct symtab *);
 
-static PTR xzalloc (unsigned int);
-
 static void sort_blocks (struct symtab *);
 
-static int compare_blocks (const PTR, const PTR);
-
 static struct partial_symtab *new_psymtab (char *, struct objfile *);
 
 static void psymtab_to_symtab_1 (struct partial_symtab *, char *);
@@ -394,8 +366,8 @@ static int add_line (struct linetable *, int, CORE_ADDR, int);
 
 static struct linetable *shrink_linetable (struct linetable *);
 
-static void
-handle_psymbol_enumerators (struct objfile *, FDR *, int, CORE_ADDR);
+static void handle_psymbol_enumerators (struct objfile *, FDR *, int,
+                                       CORE_ADDR);
 
 static char *mdebug_next_symbol_text (struct objfile *);
 \f
@@ -405,10 +377,10 @@ CORE_ADDR sigtramp_address, sigtramp_end;
 
 /* Allocate zeroed memory */
 
-static PTR
+static void *
 xzalloc (unsigned int size)
 {
-  PTR p = xmalloc (size);
+  void *p = xmalloc (size);
 
   memset (p, 0, size);
   return p;
@@ -518,19 +490,6 @@ mdebug_build_psymtabs (struct objfile *objfile,
 
   parse_partial_symbols (objfile);
 
-  /* Take the text ranges the partial symbol scanner computed for each
-     of the psymtabs and convert it into the canonical form for
-     psymtabs.  */
-  {
-    struct partial_symtab *p;
-
-    ALL_OBJFILE_PSYMTABS (objfile, p)
-      {
-        p->textlow = TEXTLOW (p);
-        p->texthigh = TEXTHIGH (p);
-      }
-  }
-
 #if 0
   /* Check to make sure file was compiled with -g.  If not, warn the
      user of this limitation.  */
@@ -698,7 +657,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
              struct section_offsets *section_offsets, struct objfile *objfile)
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
-  void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
+  void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
   char *name;
   struct symbol *s;
   struct block *b;
@@ -854,7 +813,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
       else
        {
          t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);
-         if (STREQ (name, "malloc") && t->code == TYPE_CODE_VOID)
+         if (STREQ (name, "malloc") && TYPE_CODE (t) == TYPE_CODE_VOID)
            {
              /* I don't know why, but, at least under Alpha GNU/Linux,
                 when linking against a malloc without debugging
@@ -1137,7 +1096,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                enum_sym = ((struct symbol *)
                            obstack_alloc (&current_objfile->symbol_obstack,
                                           sizeof (struct symbol)));
-               memset ((PTR) enum_sym, 0, sizeof (struct symbol));
+               memset (enum_sym, 0, sizeof (struct symbol));
                SYMBOL_NAME (enum_sym) =
                  obsavestring (f->name, strlen (f->name),
                                &current_objfile->symbol_obstack);
@@ -1235,7 +1194,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
          e = ((struct mips_extra_func_info *)
               obstack_alloc (&current_objfile->symbol_obstack,
                              sizeof (struct mips_extra_func_info)));
-         memset ((PTR) e, 0, sizeof (struct mips_extra_func_info));
+         memset (e, 0, sizeof (struct mips_extra_func_info));
          SYMBOL_VALUE (s) = (long) e;
          e->numargs = top_stack->numargs;
          e->pdr.framereg = -1;
@@ -1626,7 +1585,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          dereference them.  */
       while (TYPE_CODE (tp) == TYPE_CODE_PTR
             || TYPE_CODE (tp) == TYPE_CODE_ARRAY)
-       tp = tp->target_type;
+       tp = TYPE_TARGET_TYPE (tp);
 
       /* Make sure that TYPE_CODE(tp) has an expected type code.
          Any type may be returned from cross_ref if file indirect entries
@@ -2190,7 +2149,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
        halt = base + fh->cbLine;
       base += pr->cbLineOffset;
 
-      adr = TEXTLOW (pst) + pr->adr - lowest_pdr_addr;
+      adr = pst->textlow + pr->adr - lowest_pdr_addr;
 
       l = adr >> 2;            /* in words */
       for (lineno = pr->lnLow; base < halt;)
@@ -2230,9 +2189,9 @@ parse_partial_symbols (struct objfile *objfile)
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   const bfd_size_type external_rfd_size = debug_swap->external_rfd_size;
   const bfd_size_type external_ext_size = debug_swap->external_ext_size;
-  void (*const swap_ext_in) (bfd *, PTR, EXTR *) = debug_swap->swap_ext_in;
-  void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
-  void (*const swap_rfd_in) (bfd *, PTR, RFDT *) = debug_swap->swap_rfd_in;
+  void (*const swap_ext_in) (bfd *, void *, EXTR *) = debug_swap->swap_ext_in;
+  void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
+  void (*const swap_rfd_in) (bfd *, void *, RFDT *) = debug_swap->swap_rfd_in;
   int f_idx, s_idx;
   HDRR *hdr = &debug_info->symbolic_header;
   /* Running pointers */
@@ -2319,7 +2278,7 @@ parse_partial_symbols (struct objfile *objfile)
     ((struct mdebug_pending **)
      obstack_alloc (&objfile->psymbol_obstack,
                    hdr->ifdMax * sizeof (struct mdebug_pending *)));
-  memset ((PTR) pending_list, 0,
+  memset (pending_list, 0,
          hdr->ifdMax * sizeof (struct mdebug_pending *));
 
   /* Pass 0 over external syms: swap them in.  */
@@ -2448,26 +2407,72 @@ parse_partial_symbols (struct objfile *objfile)
              ms_type = mst_bss;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
+          else if (SC_IS_SBSS (ext_in->asym.sc))
+            {
+              ms_type = mst_bss;
+              svalue += ANOFFSET (objfile->section_offsets, 
+                                  get_section_index (objfile, ".sbss"));
+            }
          else
            ms_type = mst_abs;
          break;
        case stLabel:
          /* Label */
+
+          /* On certain platforms, some extra label symbols can be
+             generated by the linker. One possible usage for this kind
+             of symbols is to represent the address of the begining of a
+             given section. For instance, on Tru64 5.1, the address of
+             the _ftext label is the start address of the .text section.
+
+             The storage class of these symbols is usually directly
+             related to the section to which the symbol refers. For
+             instance, on Tru64 5.1, the storage class for the _fdata
+             label is scData, refering to the .data section.
+
+             It is actually possible that the section associated to the
+             storage class of the label does not exist. On True64 5.1
+             for instance, the libm.so shared library does not contain
+             any .data section, although it contains a _fpdata label
+             which storage class is scData... Since these symbols are
+             usually useless for the debugger user anyway, we just
+             discard these symbols.
+           */
+          
          if (SC_IS_TEXT (ext_in->asym.sc))
            {
+              if (objfile->sect_index_text == -1)
+                continue;
+                
              ms_type = mst_file_text;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
            }
          else if (SC_IS_DATA (ext_in->asym.sc))
            {
+              if (objfile->sect_index_data == -1)
+                continue;
+
              ms_type = mst_file_data;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (SC_IS_BSS (ext_in->asym.sc))
            {
+              if (objfile->sect_index_bss == -1)
+                continue;
+
              ms_type = mst_file_bss;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
+          else if (SC_IS_SBSS (ext_in->asym.sc))
+            {
+              const int sbss_sect_index = get_section_index (objfile, ".sbss");
+
+              if (sbss_sect_index == -1)
+                continue;
+
+              ms_type = mst_file_bss;
+              svalue += ANOFFSET (objfile->section_offsets, sbss_sect_index);
+            }
          else
            ms_type = mst_abs;
          break;
@@ -2522,11 +2527,9 @@ parse_partial_symbols (struct objfile *objfile)
       pst->read_symtab_private = ((char *)
                                  obstack_alloc (&objfile->psymbol_obstack,
                                                 sizeof (struct symloc)));
-      memset ((PTR) pst->read_symtab_private, 0, sizeof (struct symloc));
+      memset (pst->read_symtab_private, 0, sizeof (struct symloc));
 
       save_pst = pst;
-      TEXTLOW (pst) = pst->textlow;
-      TEXTHIGH (pst) = pst->texthigh;
       FDR_IDX (pst) = f_idx;
       CUR_BFD (pst) = cur_bfd;
       DEBUG_SWAP (pst) = debug_swap;
@@ -2562,7 +2565,7 @@ parse_partial_symbols (struct objfile *objfile)
        psymtab_language = prev_language;
       PST_PRIVATE (pst)->pst_language = psymtab_language;
 
-      TEXTHIGH (pst) = TEXTLOW (pst);
+      pst->texthigh = pst->textlow;
 
       /* For stabs-in-ecoff files, the second symbol must be @stab.
          This symbol is emitted by mips-tfile to signal that the
@@ -2629,10 +2632,10 @@ parse_partial_symbols (struct objfile *objfile)
 
                          /* Kludge for Irix 5.2 zero fh->adr.  */
                          if (!relocatable
-                         && (TEXTLOW (pst) == 0 || procaddr < TEXTLOW (pst)))
-                           TEXTLOW (pst) = procaddr;
-                         if (high > TEXTHIGH (pst))
-                           TEXTHIGH (pst) = high;
+                         && (pst->textlow == 0 || procaddr < pst->textlow))
+                           pst->textlow = procaddr;
+                         if (high > pst->texthigh)
+                           pst->texthigh = high;
                        }
                    }
                  else if (sh.st == stStatic)
@@ -2707,15 +2710,17 @@ parse_partial_symbols (struct objfile *objfile)
                     && stabstring != debug_info->ss + fh->issBase + sh.iss)
                      stabstring = xrealloc (stabstring, len + len2 + 1);
                    else
-                     stabstring = xmalloc (len + len2 + 1);
-                   strcpy (stabstring, stabstring1);
+                     {
+                       stabstring = xmalloc (len + len2 + 1);
+                       strcpy (stabstring, stabstring1);
+                     }
                    strcpy (stabstring + len, stabstring2);
                    len += len2;
                  }
 
                switch (type_code)
                  {
-                   static struct complaint function_outside_compilation_unit = {
+                   static struct deprecated_complaint function_outside_compilation_unit = {
                      "function `%s' appears to be defined outside of all compilation units", 0, 0
                    };
                    char *p;
@@ -3204,10 +3209,11 @@ parse_partial_symbols (struct objfile *objfile)
 
                  case N_ENDM:
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
-                   /* Solaris 2 end of module, finish current partial symbol table.
-                      END_PSYMTAB will set TEXTHIGH (pst) to the proper value, which
-                      is necessary if a module compiled without debugging info
-                      follows this module.  */
+                   /* Solaris 2 end of module, finish current partial
+                      symbol table.  END_PSYMTAB will set
+                      pst->texthigh to the proper value, which is
+                      necessary if a module compiled without
+                      debugging info follows this module.  */
                    if (pst)
                      {
                        pst = (struct partial_symtab *) 0;
@@ -3218,8 +3224,8 @@ parse_partial_symbols (struct objfile *objfile)
                    continue;
 
                  case N_RBRAC:
-                   if (sh.value > TEXTHIGH (save_pst))
-                     TEXTHIGH (save_pst) = sh.value;
+                   if (sh.value > save_pst->texthigh)
+                     save_pst->texthigh = sh.value;
                    continue;
                  case N_EINCL:
                  case N_DSLINE:
@@ -3386,12 +3392,12 @@ parse_partial_symbols (struct objfile *objfile)
 
                  /* Kludge for Irix 5.2 zero fh->adr.  */
                  if (!relocatable
-                     && (TEXTLOW (pst) == 0 || procaddr < TEXTLOW (pst)))
-                   TEXTLOW (pst) = procaddr;
+                     && (pst->textlow == 0 || procaddr < pst->textlow))
+                   pst->textlow = procaddr;
 
                  high = procaddr + sh.value;
-                 if (high > TEXTHIGH (pst))
-                   TEXTHIGH (pst) = high;
+                 if (high > pst->texthigh)
+                   pst->texthigh = high;
                  continue;
 
                case stStatic:  /* Variable */
@@ -3565,16 +3571,16 @@ parse_partial_symbols (struct objfile *objfile)
          empty and put on the free list.  */
       fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
                                        psymtab_include_list, includes_used,
-                                          -1, TEXTHIGH (save_pst),
+                                          -1, save_pst->texthigh,
                       dependency_list, dependencies_used, textlow_not_set);
       includes_used = 0;
       dependencies_used = 0;
 
-      if (objfile->ei.entry_point >= TEXTLOW (save_pst) &&
-         objfile->ei.entry_point < TEXTHIGH (save_pst))
+      if (objfile->ei.entry_point >= save_pst->textlow &&
+         objfile->ei.entry_point < save_pst->texthigh)
        {
-         objfile->ei.entry_file_lowpc = TEXTLOW (save_pst);
-         objfile->ei.entry_file_highpc = TEXTHIGH (save_pst);
+         objfile->ei.entry_file_lowpc = save_pst->textlow;
+         objfile->ei.entry_file_highpc = save_pst->texthigh;
        }
 
       /* The objfile has its functions reordered if this partial symbol
@@ -3590,15 +3596,15 @@ parse_partial_symbols (struct objfile *objfile)
          other cases.  */
       save_pst = fdr_to_pst[f_idx].pst;
       if (save_pst != NULL
-         && TEXTLOW (save_pst) != 0
+         && save_pst->textlow != 0
          && !(objfile->flags & OBJF_REORDERED))
        {
          ALL_OBJFILE_PSYMTABS (objfile, pst)
          {
            if (save_pst != pst
-               && TEXTLOW (save_pst) >= TEXTLOW (pst)
-               && TEXTLOW (save_pst) < TEXTHIGH (pst)
-               && TEXTHIGH (save_pst) > TEXTHIGH (pst))
+               && save_pst->textlow >= pst->textlow
+               && save_pst->textlow < pst->texthigh
+               && save_pst->texthigh > pst->texthigh)
              {
                objfile->flags |= OBJF_REORDERED;
                break;
@@ -3671,7 +3677,7 @@ handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype,
                            CORE_ADDR svalue)
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
-  void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
+  void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
   char *ext_sym = ((char *) debug_info->external_sym
                   + ((fh->isymBase + cur_sdx + 1) * external_sym_size));
   SYMR sh;
@@ -3762,8 +3768,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
 {
   bfd_size_type external_sym_size;
   bfd_size_type external_pdr_size;
-  void (*swap_sym_in) (bfd *, PTR, SYMR *);
-  void (*swap_pdr_in) (bfd *, PTR, PDR *);
+  void (*swap_sym_in) (bfd *, void *, SYMR *);
+  void (*swap_pdr_in) (bfd *, void *, PDR *);
   int i;
   struct symtab *st = NULL;
   FDR *fh;
@@ -3802,7 +3808,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
   /* Do nothing if this is a dummy psymtab.  */
 
   if (pst->n_global_syms == 0 && pst->n_static_syms == 0
-      && TEXTLOW (pst) == 0 && TEXTHIGH (pst) == 0)
+      && pst->textlow == 0 && pst->texthigh == 0)
     return;
 
   /* Now read the symbols for this symtab */
@@ -3916,7 +3922,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
                                  sizeof (struct mips_extra_func_info)));
                  struct symbol *s = new_symbol (MIPS_EFI_SYMBOL_NAME);
 
-                 memset ((PTR) e, 0, sizeof (struct mips_extra_func_info));
+                 memset (e, 0, sizeof (struct mips_extra_func_info));
                  SYMBOL_NAMESPACE (s) = LABEL_NAMESPACE;
                  SYMBOL_CLASS (s) = LOC_CONST;
                  SYMBOL_TYPE (s) = mdebug_type_void;
@@ -3950,7 +3956,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
 
       if (! last_symtab_ended)
        {
-         st = end_symtab (TEXTHIGH (pst), pst->objfile, SECT_OFF_TEXT (pst->objfile));
+         st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT (pst->objfile));
          end_stabs ();
        }
 
@@ -4040,7 +4046,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
       top_stack->cur_st = st;
       top_stack->cur_block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (st),
                                                STATIC_BLOCK);
-      BLOCK_START (top_stack->cur_block) = TEXTLOW (pst);
+      BLOCK_START (top_stack->cur_block) = pst->textlow;
       BLOCK_END (top_stack->cur_block) = 0;
       top_stack->blocktype = stFile;
       top_stack->maxsyms = 2 * f_max;
@@ -4465,7 +4471,7 @@ add_block (struct block *b, struct symtab *s)
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
-  bv = (struct blockvector *) xrealloc ((PTR) bv,
+  bv = (struct blockvector *) xrealloc ((void *) bv,
                                        (sizeof (struct blockvector)
                                         + BLOCKVECTOR_NBLOCKS (bv)
                                         * sizeof (bv->block)));
@@ -4513,7 +4519,7 @@ add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
 /* Blocks with a smaller low bound should come first */
 
 static int
-compare_blocks (const PTR arg1, const PTR arg2)
+compare_blocks (const void *arg1, const void *arg2)
 {
   register int addr_diff;
   struct block **b1 = (struct block **) arg1;
@@ -4615,7 +4621,7 @@ new_psymtab (char *name, struct objfile *objfile)
   psymtab->read_symtab_private = ((char *)
                                  obstack_alloc (&objfile->psymbol_obstack,
                                                 sizeof (struct symloc)));
-  memset ((PTR) psymtab->read_symtab_private, 0, sizeof (struct symloc));
+  memset (psymtab->read_symtab_private, 0, sizeof (struct symloc));
   CUR_BFD (psymtab) = cur_bfd;
   DEBUG_SWAP (psymtab) = debug_swap;
   DEBUG_INFO (psymtab) = debug_info;
@@ -4652,7 +4658,7 @@ static struct linetable *
 shrink_linetable (struct linetable *lt)
 {
 
-  return (struct linetable *) xrealloc ((PTR) lt,
+  return (struct linetable *) xrealloc ((void *) lt,
                                        (sizeof (struct linetable)
                                         + ((lt->nitems - 1)
                                            * sizeof (lt->item))));
@@ -4696,11 +4702,16 @@ shrink_block (struct block *b, struct symtab *s)
 
   /* Just reallocate it and fix references to the old one */
 
-  new = (struct block *) xrealloc ((PTR) b,
+  new = (struct block *) xrealloc ((void *) b,
                                   (sizeof (struct block)
                                    + ((BLOCK_NSYMS (b) - 1)
                                       * sizeof (struct symbol *))));
 
+  /* FIXME: Not worth hashing this block as it's built.  */
+  /* All callers should have created the block with new_block (), which
+     would mean it was not previously hashed.  Make sure.  */
+  gdb_assert (BLOCK_HASHTABLE (new) == 0);
+
   /* Should chase pointers to old one.  Fortunately, that`s just
      the block`s function and inferior blocks */
   if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b)
@@ -4722,7 +4733,7 @@ new_symbol (char *name)
                      obstack_alloc (&current_objfile->symbol_obstack,
                                     sizeof (struct symbol)));
 
-  memset ((PTR) s, 0, sizeof (*s));
+  memset (s, 0, sizeof (*s));
   SYMBOL_NAME (s) = obsavestring (name, strlen (name),
                                  &current_objfile->symbol_obstack);
   SYMBOL_LANGUAGE (s) = psymtab_language;
This page took 0.034171 seconds and 4 git commands to generate.