2001-03-06 J.T. Conklin <jtc@redback.com>
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 085cd094be882fae91dc6a12ffbc644b070fdbb5..401a09ee086a76d47d147d79cbff8209b2727dfd 100644 (file)
@@ -1,5 +1,6 @@
 /* Read a symbol table in ECOFF format (Third-Eye).
-   Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001
    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
@@ -57,7 +58,7 @@
 
 #ifndef MIPS_EFI_SYMBOL_NAME
 #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
-extern void ecoff_relocate_efi PARAMS ((struct symbol *, CORE_ADDR));
+extern void ecoff_relocate_efi (struct symbol *, CORE_ADDR);
 #include "coff/sym.h"
 #include "coff/symconst.h"
 typedef struct mips_extra_func_info
@@ -78,8 +79,6 @@ typedef struct mips_extra_func_info
 #include "gdb_stat.h"
 #include "gdb_string.h"
 
-#include "gdb-stabs.h"
-
 #include "bfd.h"
 
 #include "coff/ecoff.h"                /* COFF-like aspects of ecoff files */
@@ -91,12 +90,7 @@ typedef struct mips_extra_func_info
 #include "expression.h"
 #include "language.h"          /* Needed inside partial-stab.h */
 
-extern void _initialize_mdebugread PARAMS ((void));
-
-/* Provide a default mapping from a ecoff register number to a gdb REGNUM.  */
-#ifndef ECOFF_REG_TO_REGNUM
-#define ECOFF_REG_TO_REGNUM(num) (num)
-#endif
+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 
@@ -331,103 +325,77 @@ static int found_ecoff_debugging_info;
 
 /* Forward declarations */
 
-static void
-add_pending PARAMS ((FDR *, char *, struct type *));
+static void add_pending (FDR *, char *, struct type *);
 
-static struct mdebug_pending *
-  is_pending_symbol PARAMS ((FDR *, char *));
+static struct mdebug_pending *is_pending_symbol (FDR *, char *);
 
-static void
-pop_parse_stack PARAMS ((void));
+static void pop_parse_stack (void);
 
-static void
-push_parse_stack PARAMS ((void));
+static void push_parse_stack (void);
 
-static char *
-  fdr_name PARAMS ((FDR *));
+static char *fdr_name (FDR *);
 
-static void
-mdebug_psymtab_to_symtab PARAMS ((struct partial_symtab *));
+static void mdebug_psymtab_to_symtab (struct partial_symtab *);
 
 static int
-upgrade_type PARAMS ((int, struct type **, int, union aux_ext *, int, char *));
+upgrade_type (int, struct type **, int, union aux_ext *, int, char *);
 
-static void
-parse_partial_symbols PARAMS ((struct objfile *));
+static void parse_partial_symbols (struct objfile *);
 
-static FDR
-* get_rfd PARAMS ((int, int));
+static FDR * get_rfd (int, int);
 
-static int
-has_opaque_xref PARAMS ((FDR *, SYMR *));
+static int has_opaque_xref (FDR *, SYMR *);
 
 static int
-cross_ref PARAMS ((int, union aux_ext *, struct type **, enum type_code,
-                  char **, int, char *));
+cross_ref (int, union aux_ext *, struct type **, enum type_code,
+          char **, int, char *);
 
-static struct symbol *
-  new_symbol PARAMS ((char *));
+static struct symbol *new_symbol (char *);
 
-static struct type *
-  new_type PARAMS ((char *));
+static struct type *new_type (char *);
 
-static struct block *
-  new_block PARAMS ((int));
+static struct block *new_block (int);
 
-static struct symtab *
-  new_symtab PARAMS ((char *, int, int, struct objfile *));
+static struct symtab *new_symtab (char *, int, int, struct objfile *);
 
-static struct linetable *
-  new_linetable PARAMS ((int));
+static struct linetable *new_linetable (int);
 
-static struct blockvector *
-  new_bvect PARAMS ((int));
+static struct blockvector *new_bvect (int);
 
 static int
-parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int, struct section_offsets *));
+parse_symbol (SYMR *, union aux_ext *, char *, int, struct section_offsets *,
+             struct objfile *);
 
-static struct type *
-  parse_type PARAMS ((int, union aux_ext *, unsigned int, int *, int, char *));
+static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
+                               int, char *);
 
-static struct symbol *
-  mylookup_symbol PARAMS ((char *, struct block *, namespace_enum,
-                          enum address_class));
+static struct symbol *mylookup_symbol (char *, struct block *, namespace_enum,
+                                      enum address_class);
 
-static struct block *
-  shrink_block PARAMS ((struct block *, struct symtab *));
+static struct block *shrink_block (struct block *, struct symtab *);
 
-static PTR
-  xzalloc PARAMS ((unsigned int));
+static PTR xzalloc (unsigned int);
 
-static void
-sort_blocks PARAMS ((struct symtab *));
+static void sort_blocks (struct symtab *);
 
-static int
-compare_blocks PARAMS ((const void *, const void *));
+static int compare_blocks (const void *, const void *);
 
-static struct partial_symtab *
-  new_psymtab PARAMS ((char *, struct objfile *));
+static struct partial_symtab *new_psymtab (char *, struct objfile *);
 
-static void
-psymtab_to_symtab_1 PARAMS ((struct partial_symtab *, char *));
+static void psymtab_to_symtab_1 (struct partial_symtab *, char *);
 
-static void
-add_block PARAMS ((struct block *, struct symtab *));
+static void add_block (struct block *, struct symtab *);
 
-static void
-add_symbol PARAMS ((struct symbol *, struct block *));
+static void add_symbol (struct symbol *, struct block *);
 
-static int
-add_line PARAMS ((struct linetable *, int, CORE_ADDR, int));
+static int add_line (struct linetable *, int, CORE_ADDR, int);
 
-static struct linetable *
-  shrink_linetable PARAMS ((struct linetable *));
+static struct linetable *shrink_linetable (struct linetable *);
 
 static void
-handle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int, CORE_ADDR));
+handle_psymbol_enumerators (struct objfile *, FDR *, int, CORE_ADDR);
 
-static char *
-  mdebug_next_symbol_text PARAMS ((struct objfile *));
+static char *mdebug_next_symbol_text (struct objfile *);
 \f
 /* Address bounds for the signal trampoline in inferior, if any */
 
@@ -436,8 +404,7 @@ CORE_ADDR sigtramp_address, sigtramp_end;
 /* Allocate zeroed memory */
 
 static PTR
-xzalloc (size)
-     unsigned int size;
+xzalloc (unsigned int size)
 {
   PTR p = xmalloc (size);
 
@@ -451,8 +418,7 @@ xzalloc (size)
    and reorders the symtab list at the end */
 
 static void
-mdebug_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+mdebug_psymtab_to_symtab (struct partial_symtab *pst)
 {
 
   if (!pst)
@@ -481,8 +447,7 @@ mdebug_psymtab_to_symtab (pst)
 /* Find a file descriptor given its index RF relative to a file CF */
 
 static FDR *
-get_rfd (cf, rf)
-     int cf, rf;
+get_rfd (int cf, int rf)
 {
   FDR *fdrs;
   register FDR *f;
@@ -504,8 +469,7 @@ get_rfd (cf, rf)
 /* Return a safer print NAME for a file descriptor */
 
 static char *
-fdr_name (f)
-     FDR *f;
+fdr_name (FDR *f)
 {
   if (f->rss == -1)
     return "<stripped file>";
@@ -519,10 +483,9 @@ fdr_name (f)
    different sections are relocated via the SECTION_OFFSETS.  */
 
 void
-mdebug_build_psymtabs (objfile, swap, info)
-     struct objfile *objfile;
-     const struct ecoff_debug_swap *swap;
-     struct ecoff_debug_info *info;
+mdebug_build_psymtabs (struct objfile *objfile,
+                      const struct ecoff_debug_swap *swap,
+                      struct ecoff_debug_info *info)
 {
   cur_bfd = objfile->obfd;
   debug_swap = swap;
@@ -606,7 +569,7 @@ static struct parse_stack
 /* Enter a new lexical context */
 
 static void
-push_parse_stack ()
+push_parse_stack (void)
 {
   struct parse_stack *new;
 
@@ -631,7 +594,7 @@ push_parse_stack ()
 /* Exit a lexical context */
 
 static void
-pop_parse_stack ()
+pop_parse_stack (void)
 {
   if (!top_stack)
     return;
@@ -665,9 +628,7 @@ static struct mdebug_pending **pending_list;
 /* Check whether we already saw symbol SH in file FH */
 
 static struct mdebug_pending *
-is_pending_symbol (fh, sh)
-     FDR *fh;
-     char *sh;
+is_pending_symbol (FDR *fh, char *sh)
 {
   int f_idx = fh - debug_info->fdr;
   register struct mdebug_pending *p;
@@ -682,10 +643,7 @@ is_pending_symbol (fh, sh)
 /* Add a new symbol SH of type T */
 
 static void
-add_pending (fh, sh, t)
-     FDR *fh;
-     char *sh;
-     struct type *t;
+add_pending (FDR *fh, char *sh, struct type *t)
 {
   int f_idx = fh - debug_info->fdr;
   struct mdebug_pending *p = is_pending_symbol (fh, sh);
@@ -716,16 +674,11 @@ add_pending (fh, sh, t)
    SYMR's handled (normally one).  */
 
 static int
-parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
-     SYMR *sh;
-     union aux_ext *ax;
-     char *ext_sh;
-     int bigend;
-     struct section_offsets *section_offsets;
+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) PARAMS ((bfd *, PTR, SYMR *)) =
-  debug_swap->swap_sym_in;
+  void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
   char *name;
   struct symbol *s;
   struct block *b;
@@ -753,18 +706,18 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
          The value of a stBlock symbol is the displacement from the
          procedure address.  */
       if (sh->st != stEnd && sh->st != stBlock)
-       sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+       sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
       break;
     case scData:
     case scSData:
     case scRData:
     case scPData:
     case scXData:
-      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA);
+      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
       break;
     case scBss:
     case scSBss:
-      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS);
+      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
       break;
     }
 
@@ -1463,13 +1416,8 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
    they are big-endian or little-endian (from fh->fBigendian).  */
 
 static struct type *
-parse_type (fd, ax, aux_index, bs, bigend, sym_name)
-     int fd;
-     union aux_ext *ax;
-     unsigned int aux_index;
-     int *bs;
-     int bigend;
-     char *sym_name;
+parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
+           int bigend, char *sym_name)
 {
   /* Null entries in this map are treated specially */
   static struct type **map_bt[] =
@@ -1804,13 +1752,8 @@ parse_type (fd, ax, aux_index, bs, bigend, sym_name)
    Returns the number of aux symbols we parsed. */
 
 static int
-upgrade_type (fd, tpp, tq, ax, bigend, sym_name)
-     int fd;
-     struct type **tpp;
-     int tq;
-     union aux_ext *ax;
-     int bigend;
-     char *sym_name;
+upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
+             char *sym_name)
 {
   int off;
   struct type *t;
@@ -1925,14 +1868,11 @@ upgrade_type (fd, tpp, tq, ax, bigend, sym_name)
    to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
    in question, or NULL to use top_stack->cur_block.  */
 
-static void parse_procedure PARAMS ((PDR *, struct symtab *,
-                                    struct partial_symtab *));
+static void parse_procedure (PDR *, struct symtab *, struct partial_symtab *);
 
 static void
-parse_procedure (pr, search_symtab, pst)
-     PDR *pr;
-     struct symtab *search_symtab;
-     struct partial_symtab *pst;
+parse_procedure (PDR *pr, struct symtab *search_symtab,
+                struct partial_symtab *pst)
 {
   struct symbol *s, *i;
   struct block *b;
@@ -2042,7 +1982,7 @@ parse_procedure (pr, search_symtab, pst)
          procedure descriptor in e->pdr.adr.
          As the address in the procedure descriptor is usually relative,
          we would have to relocate e->pdr.adr with cur_fdr->adr and
-         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT).
+         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
          Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
          in shared libraries on some systems, and on other systems
          e->pdr.adr is sometimes offset by a bogus value.
@@ -2085,9 +2025,7 @@ parse_procedure (pr, search_symtab, pst)
 /* Relocate the extra function info pointed to by the symbol table.  */
 
 void
-ecoff_relocate_efi (sym, delta)
-     struct symbol *sym;
-     CORE_ADDR delta;
+ecoff_relocate_efi (struct symbol *sym, CORE_ADDR delta)
 {
   struct mips_extra_func_info *e;
 
@@ -2102,13 +2040,12 @@ ecoff_relocate_efi (sym, delta)
 
    This routine clobbers top_stack->cur_block and ->cur_st. */
 
-static void parse_external PARAMS ((EXTR *, int, struct section_offsets *));
+static void parse_external (EXTR *, int, struct section_offsets *,
+                           struct objfile *);
 
 static void
-parse_external (es, bigend, section_offsets)
-     EXTR *es;
-     int bigend;
-     struct section_offsets *section_offsets;
+parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
+               struct objfile *objfile)
 {
   union aux_ext *ax;
 
@@ -2183,7 +2120,7 @@ parse_external (es, bigend, section_offsets)
 
       /* Note that the case of a symbol with indexNil must be handled
          anyways by parse_symbol().  */
-      parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets);
+      parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets, objfile);
       break;
     default:
       break;
@@ -2196,17 +2133,12 @@ parse_external (es, bigend, section_offsets)
    numbers can go back and forth, apparently we can live
    with that and do not need to reorder our linetables */
 
-static void parse_lines PARAMS ((FDR *, PDR *, struct linetable *, int,
-                                struct partial_symtab *, CORE_ADDR));
+static void parse_lines (FDR *, PDR *, struct linetable *, int,
+                        struct partial_symtab *, CORE_ADDR);
 
 static void
-parse_lines (fh, pr, lt, maxlines, pst, lowest_pdr_addr)
-     FDR *fh;
-     PDR *pr;
-     struct linetable *lt;
-     int maxlines;
-     struct partial_symtab *pst;
-     CORE_ADDR lowest_pdr_addr;
+parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
+            struct partial_symtab *pst, CORE_ADDR lowest_pdr_addr)
 {
   unsigned char *base;
   int j, k;
@@ -2272,18 +2204,14 @@ parse_lines (fh, pr, lt, maxlines, pst, lowest_pdr_addr)
    into a partial_symtab.  */
 
 static void
-parse_partial_symbols (objfile)
-     struct objfile *objfile;
+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) PARAMS ((bfd *, PTR, EXTR *))
-  = debug_swap->swap_ext_in;
-  void (*const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))
-  = debug_swap->swap_sym_in;
-  void (*const swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *))
-  = debug_swap->swap_rfd_in;
+  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;
   int f_idx, s_idx;
   HDRR *hdr = &debug_info->symbolic_header;
   /* Running pointers */
@@ -2357,7 +2285,7 @@ parse_partial_symbols (objfile)
      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);
-  old_chain = make_cleanup (free, fdr_to_pst);
+  old_chain = make_cleanup (xfree, fdr_to_pst);
   fdr_to_pst++;
   {
     struct partial_symtab *pst = new_psymtab ("", objfile);
@@ -2375,7 +2303,7 @@ parse_partial_symbols (objfile)
 
   /* Pass 0 over external syms: swap them in.  */
   ext_block = (EXTR *) xmalloc (hdr->iextMax * sizeof (EXTR));
-  make_cleanup (free, ext_block);
+  make_cleanup (xfree, ext_block);
 
   ext_out = (char *) debug_info->external_ext;
   ext_out_end = ext_out + hdr->iextMax * external_ext_size;
@@ -2474,12 +2402,12 @@ parse_partial_symbols (objfile)
        {
        case stProc:
          /* Beginnning of Procedure */
-         svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          break;
        case stStaticProc:
          /* Load time only static procs */
          ms_type = mst_file_text;
-         svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
          break;
        case stGlobal:
          /* External symbol */
@@ -2492,12 +2420,12 @@ parse_partial_symbols (objfile)
          else if (SC_IS_DATA (ext_in->asym.sc))
            {
              ms_type = mst_data;
-             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (SC_IS_BSS (ext_in->asym.sc))
            {
              ms_type = mst_bss;
-             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
          else
            ms_type = mst_abs;
@@ -2507,17 +2435,17 @@ parse_partial_symbols (objfile)
          if (SC_IS_TEXT (ext_in->asym.sc))
            {
              ms_type = mst_file_text;
-             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
            }
          else if (SC_IS_DATA (ext_in->asym.sc))
            {
              ms_type = mst_file_data;
-             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (SC_IS_BSS (ext_in->asym.sc))
            {
              ms_type = mst_file_bss;
-             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+             svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
          else
            ms_type = mst_abs;
@@ -2561,7 +2489,7 @@ parse_partial_symbols (objfile)
        {
          textlow = fh->adr;
          if (relocatable || textlow != 0)
-           textlow += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+           textlow += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
        }
       else
        textlow = 0;
@@ -2649,7 +2577,7 @@ parse_partial_symbols (objfile)
                      CORE_ADDR procaddr;
                      long isym;
 
-                     sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+                     sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                      if (sh.st == stStaticProc)
                        {
                          namestring = debug_info->ss + fh->issBase + sh.iss;
@@ -2657,7 +2585,7 @@ parse_partial_symbols (objfile)
                                                               sh.value,
                                                               mst_file_text,
                                                               NULL,
-                                                              SECT_OFF_TEXT,
+                                                              SECT_OFF_TEXT (objfile),
                                                               NULL,
                                                               objfile);
                        }
@@ -2700,12 +2628,12 @@ parse_partial_symbols (objfile)
                        case scPData:
                        case scXData:
                          namestring = debug_info->ss + fh->issBase + sh.iss;
-                         sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+                         sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
                          prim_record_minimal_symbol_and_info (namestring,
                                                               sh.value,
                                                               mst_file_data,
                                                               NULL,
-                                                              SECT_OFF_DATA,
+                                                              SECT_OFF_DATA (objfile),
                                                               NULL,
                                                               objfile);
                          break;
@@ -2714,12 +2642,12 @@ parse_partial_symbols (objfile)
                          /* FIXME!  Shouldn't this use cases for bss, 
                             then have the default be abs? */
                          namestring = debug_info->ss + fh->issBase + sh.iss;
-                         sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+                         sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
                          prim_record_minimal_symbol_and_info (namestring,
                                                               sh.value,
                                                               mst_file_bss,
                                                               NULL,
-                                                              SECT_OFF_BSS,
+                                                              SECT_OFF_BSS (objfile),
                                                               NULL,
                                                               objfile);
                          break;
@@ -2767,7 +2695,7 @@ parse_partial_symbols (objfile)
 #define CUR_SYMBOL_TYPE type_code
 #define CUR_SYMBOL_VALUE sh.value
 #define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms)\
-  pst = save_pst
+  (pst = save_pst)
 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
 #define HANDLE_RBRAC(val) \
   if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
@@ -2775,7 +2703,7 @@ parse_partial_symbols (objfile)
 
                if (stabstring
                    && stabstring != debug_info->ss + fh->issBase + sh.iss)
-                 free (stabstring);
+                 xfree (stabstring);
              }
              /* end - Handle continuation */
            }
@@ -2818,18 +2746,18 @@ parse_partial_symbols (objfile)
                  /* The value of a stEnd symbol is the displacement from the
                     corresponding start symbol value, do not relocate it.  */
                  if (sh.st != stEnd)
-                   sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+                   sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                  break;
                case scData:
                case scSData:
                case scRData:
                case scPData:
                case scXData:
-                 sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+                 sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
                  break;
                case scBss:
                case scSBss:
-                 sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+                 sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
                  break;
                }
 
@@ -2842,7 +2770,7 @@ parse_partial_symbols (objfile)
                case stStaticProc:
                  prim_record_minimal_symbol_and_info (name, sh.value,
                                                       mst_file_text, NULL,
-                                                      SECT_OFF_TEXT, NULL,
+                                                      SECT_OFF_TEXT (objfile), NULL,
                                                       objfile);
 
                  /* FALLTHROUGH */
@@ -2915,13 +2843,13 @@ parse_partial_symbols (objfile)
                  if (SC_IS_DATA (sh.sc))
                    prim_record_minimal_symbol_and_info (name, sh.value,
                                                         mst_file_data, NULL,
-                                                        SECT_OFF_DATA,
+                                                        SECT_OFF_DATA (objfile),
                                                         NULL,
                                                         objfile);
                  else
                    prim_record_minimal_symbol_and_info (name, sh.value,
                                                         mst_file_bss, NULL,
-                                                        SECT_OFF_BSS,
+                                                        SECT_OFF_BSS (objfile),
                                                         NULL,
                                                         objfile);
                  class = LOC_STATIC;
@@ -3014,7 +2942,7 @@ parse_partial_symbols (objfile)
              CORE_ADDR svalue;
 
              if (ext_ptr->ifd != f_idx)
-               abort ();
+               internal_error (__FILE__, __LINE__, "failed internal consistency check");
              psh = &ext_ptr->asym;
 
              /* Do not add undefined symbols to the partial symbol table.  */
@@ -3026,18 +2954,18 @@ parse_partial_symbols (objfile)
                {
                case scText:
                case scRConst:
-                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
                  break;
                case scData:
                case scSData:
                case scRData:
                case scPData:
                case scXData:
-                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
                  break;
                case scBss:
                case scSBss:
-                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+                 svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
                  break;
                }
 
@@ -3184,15 +3112,11 @@ parse_partial_symbols (objfile)
    all the the enum constants to the partial symbol table.  */
 
 static void
-handle_psymbol_enumerators (objfile, fh, stype, svalue)
-     struct objfile *objfile;
-     FDR *fh;
-     int stype;
-     CORE_ADDR svalue;
+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) PARAMS ((bfd *, PTR, SYMR *))
-  = debug_swap->swap_sym_in;
+  void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
   char *ext_sym = ((char *) debug_info->external_sym
                   + ((fh->isymBase + cur_sdx + 1) * external_sym_size));
   SYMR sh;
@@ -3252,9 +3176,10 @@ handle_psymbol_enumerators (objfile, fh, stype, svalue)
     }
 }
 
+/* Get the next symbol.  OBJFILE is unused. */
+
 static char *
-mdebug_next_symbol_text (objfile)
-     struct objfile *objfile;  /* argument objfile is currently unused */
+mdebug_next_symbol_text (struct objfile *objfile)
 {
   SYMR sh;
 
@@ -3278,14 +3203,12 @@ mdebug_next_symbol_text (objfile)
    The flow of control and even the memory allocation differs.  FIXME.  */
 
 static void
-psymtab_to_symtab_1 (pst, filename)
-     struct partial_symtab *pst;
-     char *filename;
+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) PARAMS ((bfd *, PTR, SYMR *));
-  void (*swap_pdr_in) PARAMS ((bfd *, PTR, PDR *));
+  void (*swap_sym_in) (bfd *, PTR, SYMR *);
+  void (*swap_pdr_in) (bfd *, PTR, PDR *);
   int i;
   struct symtab *st;
   FDR *fh;
@@ -3435,7 +3358,7 @@ psymtab_to_symtab_1 (pst, filename)
              else
                {
                  /* Handle encoded stab line number. */
-                 valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT);
+                 valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile));
                  record_line (current_subfile, sh.index, valu);
                }
            }
@@ -3446,7 +3369,7 @@ psymtab_to_symtab_1 (pst, filename)
          else
            complain (&stab_unknown_complaint, name);
        }
-      st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT);
+      st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT (pst->objfile));
       end_stabs ();
 
       /* Sort the symbol table now, we are done adding symbols to it.
@@ -3470,7 +3393,7 @@ psymtab_to_symtab_1 (pst, filename)
          PDR *pdr_in_end;
 
          pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
-         old_chain = make_cleanup (free, pr_block);
+         old_chain = make_cleanup (xfree, pr_block);
 
          pdr_ptr = ((char *) debug_info->external_pdr
                     + fh->ipdFirst * external_pdr_size);
@@ -3561,7 +3484,7 @@ psymtab_to_symtab_1 (pst, filename)
              (*swap_sym_in) (cur_bfd, sym_ptr, &sh);
              c = parse_symbol (&sh,
                                debug_info->external_aux + fh->iauxBase,
-                               sym_ptr, fh->fBigendian, pst->section_offsets);
+                               sym_ptr, fh->fBigendian, pst->section_offsets, pst->objfile);
              sym_ptr += c * external_sym_size;
            }
 
@@ -3579,7 +3502,7 @@ psymtab_to_symtab_1 (pst, filename)
 
              pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
 
-             old_chain = make_cleanup (free, pr_block);
+             old_chain = make_cleanup (xfree, pr_block);
 
              pdr_ptr = ((char *) debug_info->external_pdr
                         + fh->ipdFirst * external_pdr_size);
@@ -3629,7 +3552,7 @@ psymtab_to_symtab_1 (pst, filename)
 
       ext_ptr = PST_PRIVATE (pst)->extern_tab;
       for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
-       parse_external (ext_ptr, fh->fBigendian, pst->section_offsets);
+       parse_external (ext_ptr, fh->fBigendian, pst->section_offsets, pst->objfile);
 
       /* If there are undefined symbols, tell the user.
          The alpha has an undefined symbol for every symbol that is
@@ -3665,9 +3588,7 @@ psymtab_to_symtab_1 (pst, filename)
    to an opaque aggregate type, else 0.  */
 
 static int
-has_opaque_xref (fh, sh)
-     FDR *fh;
-     SYMR *sh;
+has_opaque_xref (FDR *fh, SYMR *sh)
 {
   TIR tir;
   union aux_ext *ax;
@@ -3699,14 +3620,8 @@ has_opaque_xref (fh, sh)
    Return value says how many aux symbols we ate. */
 
 static int
-cross_ref (fd, ax, tpp, type_code, pname, bigend, sym_name)
-     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;
+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)
 {
   RNDXR rn[1];
   unsigned int rf;
@@ -3903,11 +3818,8 @@ cross_ref (fd, ax, tpp, type_code, pname, bigend, sym_name)
    keeping the symtab sorted */
 
 static struct symbol *
-mylookup_symbol (name, block, namespace, class)
-     char *name;
-     register struct block *block;
-     namespace_enum namespace;
-     enum address_class class;
+mylookup_symbol (char *name, register struct block *block,
+                namespace_enum namespace, enum address_class class)
 {
   register int bot, top, inc;
   register struct symbol *sym;
@@ -3938,9 +3850,7 @@ mylookup_symbol (name, block, namespace, class)
    that's the only time we know how big the block is.  FIXME.  */
 
 static void
-add_symbol (s, b)
-     struct symbol *s;
-     struct block *b;
+add_symbol (struct symbol *s, struct block *b)
 {
   int nsyms = BLOCK_NSYMS (b)++;
   struct block *origb;
@@ -3973,9 +3883,7 @@ add_symbol (s, b)
 /* Add a new block B to a symtab S */
 
 static void
-add_block (b, s)
-     struct block *b;
-     struct symtab *s;
+add_block (struct block *b, struct symtab *s)
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
@@ -4005,11 +3913,7 @@ add_block (b, s)
    This is another reason why -ggdb debugging format is preferable.  */
 
 static int
-add_line (lt, lineno, adr, last)
-     struct linetable *lt;
-     int lineno;
-     CORE_ADDR adr;
-     int last;
+add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
 {
   /* DEC c89 sometimes produces zero linenos which confuse gdb.
      Change them to something sensible. */
@@ -4031,9 +3935,7 @@ add_line (lt, lineno, adr, last)
 /* Blocks with a smaller low bound should come first */
 
 static int
-compare_blocks (arg1, arg2)
-     const PTR arg1;
-     const PTR arg2;
+compare_blocks (const PTR arg1, const PTR arg2)
 {
   register int addr_diff;
   struct block **b1 = (struct block **) arg1;
@@ -4050,8 +3952,7 @@ compare_blocks (arg1, arg2)
    as required by some MI search routines */
 
 static void
-sort_blocks (s)
-     struct symtab *s;
+sort_blocks (struct symtab *s)
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
@@ -4102,11 +4003,7 @@ sort_blocks (s)
    MAXSYMS and linenumbers MAXLINES we'll put in it */
 
 static struct symtab *
-new_symtab (name, maxsyms, maxlines, objfile)
-     char *name;
-     int maxsyms;
-     int maxlines;
-     struct objfile *objfile;
+new_symtab (char *name, int maxsyms, int maxlines, struct objfile *objfile)
 {
   struct symtab *s = allocate_symtab (name, objfile);
 
@@ -4128,9 +4025,7 @@ new_symtab (name, maxsyms, maxlines, objfile)
 /* Allocate a new partial_symtab NAME */
 
 static struct partial_symtab *
-new_psymtab (name, objfile)
-     char *name;
-     struct objfile *objfile;
+new_psymtab (char *name, struct objfile *objfile)
 {
   struct partial_symtab *psymtab;
 
@@ -4159,8 +4054,7 @@ new_psymtab (name, objfile)
    proper size to allocate.  */
 
 static struct linetable *
-new_linetable (size)
-     int size;
+new_linetable (int size)
 {
   struct linetable *l;
 
@@ -4177,8 +4071,7 @@ new_linetable (size)
    calculating the proper size to allocate.  */
 
 static struct linetable *
-shrink_linetable (lt)
-     struct linetable *lt;
+shrink_linetable (struct linetable *lt)
 {
 
   return (struct linetable *) xrealloc ((PTR) lt,
@@ -4190,8 +4083,7 @@ shrink_linetable (lt)
 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
 
 static struct blockvector *
-new_bvect (nblocks)
-     int nblocks;
+new_bvect (int nblocks)
 {
   struct blockvector *bv;
   int size;
@@ -4207,8 +4099,7 @@ new_bvect (nblocks)
 /* Allocate and zero a new block of MAXSYMS symbols */
 
 static struct block *
-new_block (maxsyms)
-     int maxsyms;
+new_block (int maxsyms)
 {
   int size = sizeof (struct block) + (maxsyms - 1) * sizeof (struct symbol *);
 
@@ -4219,9 +4110,7 @@ new_block (maxsyms)
    Shrink_block can also be used by add_symbol to grow a block.  */
 
 static struct block *
-shrink_block (b, s)
-     struct block *b;
-     struct symtab *s;
+shrink_block (struct block *b, struct symtab *s)
 {
   struct block *new;
   struct blockvector *bv = BLOCKVECTOR (s);
@@ -4249,8 +4138,7 @@ shrink_block (b, s)
 /* Create a new symbol with printname NAME */
 
 static struct symbol *
-new_symbol (name)
-     char *name;
+new_symbol (char *name)
 {
   struct symbol *s = ((struct symbol *)
                      obstack_alloc (&current_objfile->symbol_obstack,
@@ -4267,8 +4155,7 @@ new_symbol (name)
 /* Create a new type with printname NAME */
 
 static struct type *
-new_type (name)
-     char *name;
+new_type (char *name)
 {
   struct type *t;
 
@@ -4284,10 +4171,8 @@ new_type (name)
    it as normal.  */
 
 void
-elfmdebug_build_psymtabs (objfile, swap, sec)
-     struct objfile *objfile;
-     const struct ecoff_debug_swap *swap;
-     asection *sec;
+elfmdebug_build_psymtabs (struct objfile *objfile,
+                         const struct ecoff_debug_swap *swap, asection *sec)
 {
   bfd *abfd = objfile->obfd;
   struct ecoff_debug_info *info;
@@ -4322,7 +4207,7 @@ elfmdebug_build_psymtabs (objfile, swap, sec)
 #ifdef TM_MIPS_H
 
 void
-fixup_sigtramp ()
+fixup_sigtramp (void)
 {
   struct symbol *s;
   struct symtab *st;
@@ -4424,7 +4309,7 @@ fixup_sigtramp ()
 #endif /* TM_MIPS_H */
 
 void
-_initialize_mdebugread ()
+_initialize_mdebugread (void)
 {
   mdebug_type_void =
     init_type (TYPE_CODE_VOID, 1,
This page took 0.037562 seconds and 4 git commands to generate.