* symfile.h (struct sym_fns) <next>: Remove.
authorTom Tromey <tromey@redhat.com>
Thu, 30 Sep 2010 19:14:30 +0000 (19:14 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 Sep 2010 19:14:30 +0000 (19:14 +0000)
(add_symtab_fns): Update.
* symfile.c (sym_fns_ptr): New typedef.
(symtab_fns): Now a VEC.
(add_symtab_fns): Update.  Change argument type.
(find_sym_fns): Update.  Change return type.
(get_symfile_segment_data): Update.
* objfiles.h (struct objfile) <sf>: Now const.
* somread.c (som_sym_fns): Now const.  Update.
* xcoffread.c (xcoff_sym_fns): Now const.  Update.
* mipsread.c (ecoff_sym_fns): Now const.  Update.
* machoread.c (macho_sym_fns): Now const.  Update.
* elfread.c (elf_sym_fns): Now const.  Update.
(elf_sym_fns_gdb_index): Likewise.
* dbxread.c (aout_sym_fns): Now const.  Update.
* coffread.c (coff_sym_fns): Now const.  Update.

gdb/ChangeLog
gdb/coffread.c
gdb/dbxread.c
gdb/elfread.c
gdb/machoread.c
gdb/mipsread.c
gdb/objfiles.h
gdb/somread.c
gdb/symfile.c
gdb/symfile.h
gdb/xcoffread.c

index ed211797faf6f5532e691049b2573e97b4d0ceb6..e31d565d74f2220d5a135f25b4c83081dbcc6957 100644 (file)
@@ -1,3 +1,22 @@
+2010-09-30  Tom Tromey  <tromey@redhat.com>
+
+       * symfile.h (struct sym_fns) <next>: Remove.
+       (add_symtab_fns): Update.
+       * symfile.c (sym_fns_ptr): New typedef.
+       (symtab_fns): Now a VEC.
+       (add_symtab_fns): Update.  Change argument type.
+       (find_sym_fns): Update.  Change return type.
+       (get_symfile_segment_data): Update.
+       * objfiles.h (struct objfile) <sf>: Now const.
+       * somread.c (som_sym_fns): Now const.  Update.
+       * xcoffread.c (xcoff_sym_fns): Now const.  Update.
+       * mipsread.c (ecoff_sym_fns): Now const.  Update.
+       * machoread.c (macho_sym_fns): Now const.  Update.
+       * elfread.c (elf_sym_fns): Now const.  Update.
+       (elf_sym_fns_gdb_index): Likewise.
+       * dbxread.c (aout_sym_fns): Now const.  Update.
+       * coffread.c (coff_sym_fns): Now const.  Update.
+
 2010-09-30  Tom Tromey  <tromey@redhat.com>
 
        * value.c (value_primitive_field): Take 'offset' into account for
index 7f1ecd0debd7965fe3098003cf6848e750ea318d..3d4dd6091c599ae2499926d4af2ae7b1e0502a30 100644 (file)
@@ -2126,7 +2126,7 @@ coff_read_enum_type (int index, int length, int lastsym,
 
 /* Register our ability to parse symbols for coff BFD files. */
 
-static struct sym_fns coff_sym_fns =
+static const struct sym_fns coff_sym_fns =
 {
   bfd_target_coff_flavour,
   coff_new_init,               /* sym_new_init: init anything gbl to entire symtab */
@@ -2138,8 +2138,7 @@ static struct sym_fns coff_sym_fns =
                                   a file.  */
   NULL,                         /* sym_read_linetable  */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 void
index 25bf07b5af5f249612e7e56cac1072c211139255..05e9f2ec47f0ff7b6195c8c6a337cf00140c6e2a 100644 (file)
@@ -3573,7 +3573,7 @@ section (%s)"),
   dbx_symfile_read (objfile, 0);
 }
 \f
-static struct sym_fns aout_sym_fns =
+static const struct sym_fns aout_sym_fns =
 {
   bfd_target_aout_flavour,
   dbx_new_init,                /* sym_new_init: init anything gbl to entire symtab */
@@ -3586,8 +3586,7 @@ static struct sym_fns aout_sym_fns =
                                   a file.  */
   NULL,                         /* sym_read_linetable */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 void
index ae92ff65b19dd19f9580bc2e03190e4e6c91ac1a..4745f8ede91997aea27eb4753ed4c736de0f06fd 100644 (file)
@@ -41,7 +41,7 @@
 extern void _initialize_elfread (void);
 
 /* Forward declaration.  */
-static struct sym_fns elf_sym_fns_gdb_index;
+static const struct sym_fns elf_sym_fns_gdb_index;
 
 /* The struct elfinfo is available only during ELF symbol table and
    psymtab reading.  It is destroyed at the completion of psymtab-reading.
@@ -1034,7 +1034,7 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
 \f
 /* Register that we are able to handle ELF object file formats.  */
 
-static struct sym_fns elf_sym_fns =
+static const struct sym_fns elf_sym_fns =
 {
   bfd_target_elf_flavour,
   elf_new_init,                        /* sym_new_init: init anything gbl to entire symtab */
@@ -1046,13 +1046,12 @@ static struct sym_fns elf_sym_fns =
                                   a file.  */
   NULL,                         /* sym_read_linetable */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 /* The same as elf_sym_fns, but not registered and uses the
    DWARF-specific GNU index rather than psymtab.  */
-static struct sym_fns elf_sym_fns_gdb_index =
+static const struct sym_fns elf_sym_fns_gdb_index =
 {
   bfd_target_elf_flavour,
   elf_new_init,                        /* sym_new_init: init anything gbl to entire symab */
@@ -1064,8 +1063,7 @@ static struct sym_fns elf_sym_fns_gdb_index =
                                   a file.  */
   NULL,                         /* sym_read_linetable */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &dwarf2_gdb_index_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &dwarf2_gdb_index_functions
 };
 
 void
index bb3268ca9ec204cedbd1bde725cc0357df5efbae..23a5d1c303592eadcb615ed82b319a9d6d0adf91 100644 (file)
@@ -837,7 +837,7 @@ macho_symfile_offsets (struct objfile *objfile,
     }
 }
 
-static struct sym_fns macho_sym_fns = {
+static const struct sym_fns macho_sym_fns = {
   bfd_target_mach_o_flavour,
 
   macho_new_init,               /* sym_new_init: init anything gbl to entire symtab */
@@ -849,8 +849,7 @@ static struct sym_fns macho_sym_fns = {
                                   a file.  */
   NULL,                         /* sym_read_linetable */
   macho_symfile_relocate,      /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                          /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 void
index cb186b1292a41960a215e41bc8ede247c24a5bdf..b1713b3d104473e850197e566dd9e130469cb5db 100644 (file)
@@ -390,7 +390,7 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
 
 /* Initialization.  */
 
-static struct sym_fns ecoff_sym_fns =
+static const struct sym_fns ecoff_sym_fns =
 {
   bfd_target_ecoff_flavour,
   mipscoff_new_init,           /* sym_new_init: init anything gbl to entire symtab */
@@ -402,8 +402,7 @@ static struct sym_fns ecoff_sym_fns =
                                   a file.  */
   NULL,                         /* sym_read_linetable */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
index 8b47d2bbfaf9fa4709a79442fa3eb6d250727f80..130ae26c344646e9cf6bb8dc844dc87fe240cf48 100644 (file)
@@ -293,7 +293,7 @@ struct objfile
        allocated memory, and is shared by all objfiles that use the
        object module reader of this type. */
 
-    struct sym_fns *sf;
+    const struct sym_fns *sf;
 
     /* The per-objfile information about the entry point, the scope (file/func)
        containing the entry point, and the scope of the user's main() func. */
index cc36042ca8b296bcceaedf3be5705fc3cb8a5923..779f5321d03a5e42c57c78158321ceffb5388549 100644 (file)
@@ -427,7 +427,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
 
 /* Register that we are able to handle SOM object file formats.  */
 
-static struct sym_fns som_sym_fns =
+static const struct sym_fns som_sym_fns =
 {
   bfd_target_som_flavour,
   som_new_init,                        /* sym_new_init: init anything gbl to entire symtab */
@@ -439,8 +439,7 @@ static struct sym_fns som_sym_fns =
                                   a file.  */
   NULL,                         /* sym_read_linetable */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 void
index 087cd3a68f304ba6a395a60b3a80448a0fbcdf96..dbd1412279c0063e3c91f356c862fe9a5fb28a8a 100644 (file)
@@ -102,7 +102,7 @@ bfd *symfile_bfd_open (char *);
 
 int get_section_index (struct objfile *, char *);
 
-static struct sym_fns *find_sym_fns (bfd *);
+static const struct sym_fns *find_sym_fns (bfd *);
 
 static void decrement_reading_symtab (void *);
 
@@ -147,7 +147,10 @@ void _initialize_symfile (void);
    calls add_symtab_fns() to register information on each format it is
    prepared to read. */
 
-static struct sym_fns *symtab_fns = NULL;
+typedef const struct sym_fns *sym_fns_ptr;
+DEF_VEC_P (sym_fns_ptr);
+
+static VEC (sym_fns_ptr) *symtab_fns = NULL;
 
 /* Flag for whether user will be reloading symbols multiple times.
    Defaults to ON for VxWorks, otherwise OFF.  */
@@ -1702,10 +1705,9 @@ get_section_index (struct objfile *objfile, char *section_name)
    handle. */
 
 void
-add_symtab_fns (struct sym_fns *sf)
+add_symtab_fns (const struct sym_fns *sf)
 {
-  sf->next = symtab_fns;
-  symtab_fns = sf;
+  VEC_safe_push (sym_fns_ptr, symtab_fns, sf);
 }
 
 /* Initialize OBJFILE to read symbols from its associated BFD.  It
@@ -1713,18 +1715,19 @@ add_symtab_fns (struct sym_fns *sf)
    struct sym_fns in the objfile structure, that contains cached
    information about the symbol file.  */
 
-static struct sym_fns *
+static const struct sym_fns *
 find_sym_fns (bfd *abfd)
 {
-  struct sym_fns *sf;
+  const struct sym_fns *sf;
   enum bfd_flavour our_flavour = bfd_get_flavour (abfd);
+  int i;
 
   if (our_flavour == bfd_target_srec_flavour
       || our_flavour == bfd_target_ihex_flavour
       || our_flavour == bfd_target_tekhex_flavour)
     return NULL;       /* No symbols.  */
 
-  for (sf = symtab_fns; sf != NULL; sf = sf->next)
+  for (i = 0; VEC_iterate (sym_fns_ptr, symtab_fns, i, sf); ++i)
     if (our_flavour == sf->sym_flavour)
       return sf;
 
@@ -3587,7 +3590,7 @@ symfile_relocate_debug_section (struct objfile *objfile,
 struct symfile_segment_data *
 get_symfile_segment_data (bfd *abfd)
 {
-  struct sym_fns *sf = find_sym_fns (abfd);
+  const struct sym_fns *sf = find_sym_fns (abfd);
 
   if (sf == NULL)
     return NULL;
index 58ab786182be372db54a333c1cd2d838ba6a54fb..afa92cdb149c3d812a865f35bb9afa460f258c73 100644 (file)
@@ -345,14 +345,6 @@ struct sym_fns
   /* The "quick" (aka partial) symbol functions for this symbol
      reader.  */
   const struct quick_symbol_functions *qf;
-
-  /* Finds the next struct sym_fns.  They are allocated and
-     initialized in whatever module implements the functions pointed
-     to; an initializer calls add_symtab_fns to add them to the global
-     chain.  */
-
-  struct sym_fns *next;
-
 };
 
 extern struct section_addr_info *
@@ -384,7 +376,7 @@ extern bfd_byte *default_symfile_relocate (struct objfile *objfile,
 
 extern struct symtab *allocate_symtab (char *, struct objfile *);
 
-extern void add_symtab_fns (struct sym_fns *);
+extern void add_symtab_fns (const struct sym_fns *);
 
 /* This enum encodes bit-flags passed as ADD_FLAGS parameter to
    syms_from_objfile, symbol_file_add, etc.  */
index aa6d27ed328feda63c654a4b2069b2bde1f07f9c..902d48f588d4833776325b3bd287975980db4e4d 100644 (file)
@@ -3028,7 +3028,7 @@ xcoff_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
 
 /* Register our ability to parse symbols for xcoff BFD files.  */
 
-static struct sym_fns xcoff_sym_fns =
+static const struct sym_fns xcoff_sym_fns =
 {
 
   /* It is possible that coff and xcoff should be merged as
@@ -3051,8 +3051,7 @@ static struct sym_fns xcoff_sym_fns =
                                   a file.  */
   aix_process_linenos,          /* sym_read_linetable */
   default_symfile_relocate,    /* sym_relocate: Relocate a debug section.  */
-  &psym_functions,
-  NULL                         /* next: pointer to next struct sym_fns */
+  &psym_functions
 };
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
This page took 0.037767 seconds and 4 git commands to generate.