]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Rearrange psymtab_storage construction
authorTom Tromey <tom@tromey.com>
Sat, 20 Mar 2021 23:23:40 +0000 (17:23 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 20 Mar 2021 23:23:44 +0000 (17:23 -0600)
This changes objfile so that it doesn't construct a psymtab_storage
object until the psymtab functions are installed.  It also applies a
similar treatment to reread_symbols.

gdb/ChangeLog
2021-03-20  Tom Tromey  <tom@tromey.com>

* symfile.c (syms_from_objfile_1): Call reset_psymtabs.
(reread_symbols): Move reset_psymtabs call later.
* objfiles.c (objfile::objfile): Don't initialize
partial_symtabs.

gdb/ChangeLog
gdb/objfiles.c
gdb/symfile.c

index abeaad8f61333db6026cfa85d40c9e6f10ead388..9eba43c12e5a94d1396f8aa2f53ca5baaead65ce 100644 (file)
@@ -1,3 +1,10 @@
+2021-03-20  Tom Tromey  <tom@tromey.com>
+
+       * symfile.c (syms_from_objfile_1): Call reset_psymtabs.
+       (reread_symbols): Move reset_psymtabs call later.
+       * objfiles.c (objfile::objfile): Don't initialize
+       partial_symtabs.
+
 2021-03-20  Tom Tromey  <tom@tromey.com>
 
        * dwarf2/read.c (dwarf2_build_psymtabs): Call
index bfa5f0443e306e88df4e53070e2803bfaffebdf1..ca135dd63c3fef33e75cae767e06bcb5944bf532 100644 (file)
@@ -323,7 +323,6 @@ build_objfile_section_table (struct objfile *objfile)
 objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
   : flags (flags_),
     pspace (current_program_space),
-    partial_symtabs (new psymtab_storage ()),
     obfd (abfd)
 {
   const char *expanded_name;
index 12746c4337478b900d44c0621af9c4123b3bc695..01304523c0d88abd0d47b48ebeba950b23916418 100644 (file)
@@ -904,6 +904,7 @@ syms_from_objfile_1 (struct objfile *objfile,
   const int mainline = add_flags & SYMFILE_MAINLINE;
 
   objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd));
+  objfile->reset_psymtabs ();
   objfile->qf = make_psymbol_functions (objfile->partial_symtabs);
 
   if (objfile->sf == NULL)
@@ -2522,8 +2523,6 @@ reread_symbols (void)
            error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
                   bfd_errmsg (bfd_get_error ()));
 
-         objfile->reset_psymtabs ();
-
          /* NB: after this call to obstack_free, objfiles_changed
             will need to be called (see discussion below).  */
          obstack_free (&objfile->objfile_obstack, 0);
@@ -2555,6 +2554,7 @@ reread_symbols (void)
             based on whether .gdb_index is present, and we need it to
             start over.  PR symtab/15885  */
          objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd));
+         objfile->reset_psymtabs ();
          objfile->qf = make_psymbol_functions (objfile->partial_symtabs);
 
          build_objfile_section_table (objfile);