aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-20 17:23:40 -0600
committerTom Tromey <tom@tromey.com>2021-03-20 17:23:44 -0600
commitb29b98cf8411ac136d17fc68236fc029447f1461 (patch)
tree4c2341c4eb59d32a07ed5c31a24d33832c153f4a
parent17d66340ebb4528307c6c5d08383859aab785db7 (diff)
downloadgdb-b29b98cf8411ac136d17fc68236fc029447f1461.zip
gdb-b29b98cf8411ac136d17fc68236fc029447f1461.tar.gz
gdb-b29b98cf8411ac136d17fc68236fc029447f1461.tar.bz2
Rearrange psymtab_storage construction
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.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/objfiles.c1
-rw-r--r--gdb/symfile.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index abeaad8..9eba43c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
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
set_partial_symtabs.
* symfile.c (syms_from_objfile_1, reread_symbols): Update.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index bfa5f04..ca135dd 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -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;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 12746c4..0130452 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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);