update copyright year range in GDB files
[deliverable/binutils-gdb.git] / gdb / mipsread.c
index fc4a268c313aafe06b97458c13bbe2e37ab05286..f2afe99ebec598c1ef17ca92bb314b1c5a59a07b 100644 (file)
@@ -1,6 +1,6 @@
 /* Read a symbol table in MIPS' format (Third-Eye).
 
-   Copyright (C) 1986-2013 Free Software Foundation, Inc.
+   Copyright (C) 1986-2017 Free Software Foundation, Inc.
 
    Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU.  Major work
    by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support.
@@ -24,7 +24,6 @@
    mdebugread.c.  */
 
 #include "defs.h"
-#include "gdb_string.h"
 #include "bfd.h"
 #include "symtab.h"
 #include "objfiles.h"
@@ -43,7 +42,8 @@
 #include "psymtab.h"
 
 static void
-read_alphacoff_dynamic_symtab (struct section_offsets *,
+read_alphacoff_dynamic_symtab (minimal_symbol_reader &,
+                              struct section_offsets *,
                               struct objfile *objfile);
 
 /* Initialize anything that needs initializing when a completely new
@@ -67,13 +67,11 @@ mipscoff_symfile_init (struct objfile *objfile)
 /* Read a symbol file from a file.  */
 
 static void
-mipscoff_symfile_read (struct objfile *objfile, int symfile_flags)
+mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
 {
   bfd *abfd = objfile->obfd;
-  struct cleanup *back_to;
 
-  init_minimal_symbol_collection ();
-  back_to = make_cleanup_discard_minimal_symbols ();
+  minimal_symbol_reader reader (objfile);
 
   /* Now that the executable file is positioned at symbol table,
      process it and define symbols accordingly.  */
@@ -82,18 +80,17 @@ mipscoff_symfile_read (struct objfile *objfile, int symfile_flags)
        (abfd, (asection *) NULL, &ecoff_data (abfd)->debug_info)))
     error (_("Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
 
-  mdebug_build_psymtabs (objfile, &ecoff_backend (abfd)->debug_swap,
+  mdebug_build_psymtabs (reader, objfile, &ecoff_backend (abfd)->debug_swap,
                         &ecoff_data (abfd)->debug_info);
 
   /* Add alpha coff dynamic symbols.  */
 
-  read_alphacoff_dynamic_symtab (objfile->section_offsets, objfile);
+  read_alphacoff_dynamic_symtab (reader, objfile->section_offsets, objfile);
 
   /* Install any minimal symbols that have been collected as the current
      minimal symbols for this objfile.  */
 
-  install_minimal_symbols (objfile);
-  do_cleanups (back_to);
+  reader.install ();
 }
 
 /* Perform any local cleanups required when we are done with a
@@ -177,7 +174,8 @@ alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, void *sip)
    them to the minimal symbol table.  */
 
 static void
-read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
+read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
+                              struct section_offsets *section_offsets,
                               struct objfile *objfile)
 {
   bfd *abfd = objfile->obfd;
@@ -216,13 +214,13 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
   str_secsize = bfd_get_section_size (si.str_sect);
   dyninfo_secsize = bfd_get_section_size (si.dyninfo_sect);
   got_secsize = bfd_get_section_size (si.got_sect);
-  sym_secptr = xmalloc (sym_secsize);
+  sym_secptr = (char *) xmalloc (sym_secsize);
   cleanups = make_cleanup (xfree, sym_secptr);
-  str_secptr = xmalloc (str_secsize);
+  str_secptr = (char *) xmalloc (str_secsize);
   make_cleanup (xfree, str_secptr);
-  dyninfo_secptr = xmalloc (dyninfo_secsize);
+  dyninfo_secptr = (char *) xmalloc (dyninfo_secsize);
   make_cleanup (xfree, dyninfo_secptr);
-  got_secptr = xmalloc (got_secsize);
+  got_secptr = (char *) xmalloc (got_secsize);
   make_cleanup (xfree, got_secptr);
 
   if (!bfd_get_section_contents (abfd, si.sym_sect, sym_secptr,
@@ -367,7 +365,6 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
                ms_type = mst_text;
              else
                ms_type = mst_file_text;
-             sym_value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
            }
          else if (sym_shndx == SHN_MIPS_DATA)
            {
@@ -375,7 +372,6 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
                ms_type = mst_data;
              else
                ms_type = mst_file_data;
-             sym_value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (sym_shndx == SHN_MIPS_ACOMMON)
            {
@@ -383,7 +379,6 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
                ms_type = mst_bss;
              else
                ms_type = mst_file_bss;
-             sym_value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
            }
          else if (sym_shndx == SHN_ABS)
            {
@@ -395,7 +390,7 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
            }
        }
 
-      prim_record_minimal_symbol (name, sym_value, ms_type, objfile);
+      reader.record (name, sym_value, ms_type);
     }
 
   do_cleanups (cleanups);
This page took 0.026122 seconds and 4 git commands to generate.