[review] Introduce partial_symtab::read_symtab method

Message ID gerrit.1572228195000.Ia57a828786867d6ad03200af8f996f48ed15285e@gnutoolchain-gerrit.osci.io
State Superseded
Headers show
Series
  • [review] Introduce partial_symtab::read_symtab method
Related show

Commit Message

Simon Marchi (Code Review) Oct. 28, 2019, 2:03 a.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/379
......................................................................

Introduce partial_symtab::read_symtab method

This introduces a new partial_symtab::read_symtab method, and updates
the symbol readers to subclass partial_symtab and implement this
method.  The old read_symtab and read_symtab_private members are
removed.

In practice, only DWARF and CTF are truly updated to take advantage of
the new setup.  The other symbol readers are less actively maintained,
and so this patch also introduces a "legacy_psymtab", which
essentially works the same way as the old partial_symtab.

(Note that, without more knowledge of the interaction between these
symbol readers, fixing this to remove the new (small) overhead is not
trivial, because these readers copy the read_symtab pointer between
partial symtabs.)

gdb/ChangeLog
2019-10-27  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (this_symtab_psymtab, read_xcoff_symtab)
	(xcoff_psymtab_to_symtab_1, xcoff_read_symtab)
	(xcoff_start_psymtab, xcoff_end_psymtab, scan_xcoff_symtab): Use
	legacy_symtab.
	* stabsread.h (dbx_end_psymtab): Use legacy_symtab.
	* psymtab.c (psymtab_to_symtab): Call method.
	(dump_psymtab): Update.
	* psympriv.h (struct partial_symtab): Add virtual destructor.
	<read_symtab>: New method.
	(struct legacy_symtab): New.
	* mdebugread.c (mdebug_read_symtab): Use legacy_psymtab.
	(struct pst_map) <pst>: Now a legacy_psymtab.
	(parse_procedure, parse_partial_symbols, psymtab_to_symtab_1)
	(new_psymtab): Use legacy_psymtab.
	* dwarf2read.h (struct dwarf2_psymtab): New.
	(struct dwarf2_per_cu_data) <psymtab>: Use it.
	* dwarf2read.c (dwarf2_create_include_psymtab)
	(dwarf2_build_include_psymtabs, create_type_unit_group)
	(create_partial_symtab, process_psymtab_comp_unit_reader)
	(build_type_psymtabs_reader, build_type_psymtab_dependencies)
	(set_partial_user): Use dwarf2_psymtab.
	(dwarf2_psymtab::read_symtab): Rename from dwarf2_read_symtab.
	(psymtab_to_symtab_1, process_full_comp_unit)
	(process_full_type_unit, dwarf2_ranges_read)
	(dwarf2_get_pc_bounds, psymtab_include_file_name)
	(dwarf_decode_lines): Use dwarf2_psymtab.
	* dwarf-index-write.c (psym_index_map): Use dwarf2_psymtab.
	(add_address_entry_worker, write_one_signatured_type)
	(recursively_count_psymbols, recursively_write_psymbols)
	(write_one_signatured_type, psyms_seen_size, write_gdbindex)
	(write_debug_names): Likewise.
	* dbxread.c (struct header_file_location): Take a legacy_psymtab.
	<pst>: Now a legacy_psymtab.
	(find_corresponding_bincl_psymtab): Return a legacy_psymtab.
	(read_dbx_symtab, start_psymtab, dbx_end_psymtab)
	(dbx_psymtab_to_symtab_1, read_ofile_symtab): Use legacy_psymtab.
	* ctfread.c (struct ctf_psymtab): New.
	(ctf_start_symtab, ctf_end_symtab, psymtab_to_symtab): Take a
	ctf_psymtab.
	(ctf_psymtab::read_symtab): Rename from ctf_read_symtab.
	(create_partial_symtab): Return a ctf_psymtab.
	(scan_partial_symbols): Update.

Change-Id: Ia57a828786867d6ad03200af8f996f48ed15285e
---
M gdb/ChangeLog
M gdb/ctfread.c
M gdb/dbxread.c
M gdb/dwarf-index-write.c
M gdb/dwarf2read.c
M gdb/dwarf2read.h
M gdb/mdebugread.c
M gdb/psympriv.h
M gdb/psymtab.c
M gdb/stabsread.h
M gdb/xcoffread.c
11 files changed, 277 insertions(+), 174 deletions(-)




-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ia57a828786867d6ad03200af8f996f48ed15285e
Gerrit-Change-Number: 379
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7918ec3..39585f0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,50 @@ 
 2019-10-27  Tom Tromey  <tom@tromey.com>
 
+	* xcoffread.c (this_symtab_psymtab, read_xcoff_symtab)
+	(xcoff_psymtab_to_symtab_1, xcoff_read_symtab)
+	(xcoff_start_psymtab, xcoff_end_psymtab, scan_xcoff_symtab): Use
+	legacy_symtab.
+	* stabsread.h (dbx_end_psymtab): Use legacy_symtab.
+	* psymtab.c (psymtab_to_symtab): Call method.
+	(dump_psymtab): Update.
+	* psympriv.h (struct partial_symtab): Add virtual destructor.
+	<read_symtab>: New method.
+	(struct legacy_symtab): New.
+	* mdebugread.c (mdebug_read_symtab): Use legacy_psymtab.
+	(struct pst_map) <pst>: Now a legacy_psymtab.
+	(parse_procedure, parse_partial_symbols, psymtab_to_symtab_1)
+	(new_psymtab): Use legacy_psymtab.
+	* dwarf2read.h (struct dwarf2_psymtab): New.
+	(struct dwarf2_per_cu_data) <psymtab>: Use it.
+	* dwarf2read.c (dwarf2_create_include_psymtab)
+	(dwarf2_build_include_psymtabs, create_type_unit_group)
+	(create_partial_symtab, process_psymtab_comp_unit_reader)
+	(build_type_psymtabs_reader, build_type_psymtab_dependencies)
+	(set_partial_user): Use dwarf2_psymtab.
+	(dwarf2_psymtab::read_symtab): Rename from dwarf2_read_symtab.
+	(psymtab_to_symtab_1, process_full_comp_unit)
+	(process_full_type_unit, dwarf2_ranges_read)
+	(dwarf2_get_pc_bounds, psymtab_include_file_name)
+	(dwarf_decode_lines): Use dwarf2_psymtab.
+	* dwarf-index-write.c (psym_index_map): Use dwarf2_psymtab.
+	(add_address_entry_worker, write_one_signatured_type)
+	(recursively_count_psymbols, recursively_write_psymbols)
+	(write_one_signatured_type, psyms_seen_size, write_gdbindex)
+	(write_debug_names): Likewise.
+	* dbxread.c (struct header_file_location): Take a legacy_psymtab.
+	<pst>: Now a legacy_psymtab.
+	(find_corresponding_bincl_psymtab): Return a legacy_psymtab.
+	(read_dbx_symtab, start_psymtab, dbx_end_psymtab)
+	(dbx_psymtab_to_symtab_1, read_ofile_symtab): Use legacy_psymtab.
+	* ctfread.c (struct ctf_psymtab): New.
+	(ctf_start_symtab, ctf_end_symtab, psymtab_to_symtab): Take a
+	ctf_psymtab.
+	(ctf_psymtab::read_symtab): Rename from ctf_read_symtab.
+	(create_partial_symtab): Return a ctf_psymtab.
+	(scan_partial_symbols): Update.
+
+2019-10-27  Tom Tromey  <tom@tromey.com>
+
 	* xcoffread.c (xcoff_start_psymtab): Use new.
 	* psymtab.c (partial_symtab::partial_symtab): New constructor,
 	renamed from start_psymtab_common.
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 3e3e318..43cac9c 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -96,6 +96,19 @@ 
   struct buildsym_compunit *builder;
 } ctf_context_t;
 
+/* A partial symtab, specialized for this module.  */
+struct ctf_psymtab : public partial_symtab
+{
+  ctf_psymtab (const char *filename, struct objfile *objfile, CORE_ADDR addr)
+    : partial_symtab (filename, objfile, addr)
+  {
+  }
+
+  void read_symtab (struct objfile *) override;
+
+  ctf_context_t *context;
+};
+
 /* The routines that read and process fields/members of a C struct, union,
    or enumeration, pass lists of data member fields in an instance of a
    ctf_field_info structure. It is derived from dwarf2read.c.  */
@@ -128,7 +141,7 @@ 
 
 /* Local function prototypes */
 
-static void psymtab_to_symtab (struct partial_symtab *);
+static void psymtab_to_symtab (ctf_psymtab *);
 
 static int ctf_add_type_cb (ctf_id_t tid, void *arg);
 
@@ -1163,12 +1176,12 @@ 
 /* Start a symtab for OBJFILE in CTF format.  */
 
 static void
-ctf_start_symtab (struct partial_symtab *pst,
+ctf_start_symtab (ctf_psymtab *pst,
 		  struct objfile *of, CORE_ADDR text_offset)
 {
   ctf_context_t *ccp;
 
-  ccp = (ctf_context_t *) pst->read_symtab_private;
+  ccp = pst->context;
   ccp->builder = new buildsym_compunit
 		       (of, of->original_name, NULL,
 		       language_c, text_offset);
@@ -1180,12 +1193,12 @@ 
    the .text section number.  */
 
 static struct compunit_symtab *
-ctf_end_symtab (struct partial_symtab *pst,
+ctf_end_symtab (ctf_psymtab *pst,
 		CORE_ADDR end_addr, int section)
 {
   ctf_context_t *ccp;
 
-  ccp = (ctf_context_t *) pst->read_symtab_private;
+  ccp = pst->context;
   struct compunit_symtab *result
     = ccp->builder->end_symtab (end_addr, section);
   delete ccp->builder;
@@ -1196,14 +1209,14 @@ 
 /* Read in full symbols for PST, and anything it depends on.  */
 
 static void
-psymtab_to_symtab (struct partial_symtab *pst)
+psymtab_to_symtab (ctf_psymtab *pst)
 {
   struct symbol *sym;
   ctf_context_t *ccp;
 
   gdb_assert (!pst->readin);
 
-  ccp = (ctf_context_t *) pst->read_symtab_private;
+  ccp = pst->context;
 
   /* Iterate over entries in data types section.  */
   if (ctf_type_iter (ccp->fp, ctf_add_type_cb, ccp) == CTF_ERR)
@@ -1239,31 +1252,31 @@ 
 /* Expand partial symbol table PST into a full symbol table.
    PST is not NULL.  */
 
-static void
-ctf_read_symtab (struct partial_symtab *pst, struct objfile *objfile)
+void
+ctf_psymtab::read_symtab (struct objfile *objfile)
 {
-  if (pst->readin)
-    warning (_("bug: psymtab for %s is already read in."), pst->filename);
+  if (readin)
+    warning (_("bug: psymtab for %s is already read in."), filename);
   else
     {
       if (info_verbose)
 	{
-	  printf_filtered (_("Reading in CTF data for %s..."), pst->filename);
+	  printf_filtered (_("Reading in CTF data for %s..."), filename);
 	  gdb_flush (gdb_stdout);
 	}
 
       /* Start a symtab.  */
-      CORE_ADDR text_offset;        /* Start of text segment.  */
+      CORE_ADDR offset;        /* Start of text segment.  */
       int tsize;
 
-      text_offset = get_objfile_text_range (objfile, &tsize);
-      ctf_start_symtab (pst, objfile, text_offset);
-      psymtab_to_symtab (pst);
+      offset = get_objfile_text_range (objfile, &tsize);
+      ctf_start_symtab (this, objfile, offset);
+      psymtab_to_symtab (this);
 
-      pst->set_text_low (text_offset);
-      pst->set_text_high (text_offset + tsize);
-      pst->compunit_symtab = ctf_end_symtab (pst, text_offset + tsize,
-					     SECT_OFF_TEXT (objfile));
+      set_text_low (offset);
+      set_text_high (offset + tsize);
+      compunit_symtab = ctf_end_symtab (this, offset + tsize,
+					SECT_OFF_TEXT (objfile));
 
       /* Finish up the debug error message.  */
       if (info_verbose)
@@ -1294,21 +1307,20 @@ 
    partial_symtab remains around.  They are allocated on an obstack,
    objfile_obstack.  */
 
-static struct partial_symtab *
+static ctf_psymtab *
 create_partial_symtab (const char *name,
 		       ctf_file_t *cfp,
 		       struct objfile *objfile)
 {
-  struct partial_symtab *pst;
+  ctf_psymtab *pst;
   ctf_context_t *ccx;
 
-  pst = new partial_symtab (name, objfile, 0);
+  pst = new ctf_psymtab (name, objfile, 0);
 
   ccx = XOBNEW (&objfile->objfile_obstack, ctf_context_t);
   ccx->fp = cfp;
   ccx->of = objfile;
-  pst->read_symtab_private = (void *) ccx;
-  pst->read_symtab = ctf_read_symtab;
+  pst->context = ccx;
 
   return pst;
 }
@@ -1396,7 +1408,7 @@ 
   ctf_context_t ccx;
   bfd *abfd = of->obfd;
   const char *name = bfd_get_filename (abfd);
-  struct partial_symtab *pst = create_partial_symtab (name, cfp, of);
+  ctf_psymtab *pst = create_partial_symtab (name, cfp, of);
 
   ccx.fp = cfp;
   ccx.of = of;
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index c7a862a..ce04951 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -245,7 +245,7 @@ 
 struct header_file_location
 {
   header_file_location (const char *name_, int instance_,
-			struct partial_symtab *pst_)
+			legacy_psymtab *pst_)
     : name (name_),
       instance (instance_),
       pst (pst_)
@@ -254,7 +254,7 @@ 
 
   const char *name;		/* Name of header file */
   int instance;			/* See above */
-  struct partial_symtab *pst;	/* Partial symtab that has the
+  legacy_psymtab *pst;	/* Partial symtab that has the
 				   BINCL/EINCL defs for this file.  */
 };
 
@@ -263,16 +263,16 @@ 
 
 /* Local function prototypes.  */
 
-static void read_ofile_symtab (struct objfile *, struct partial_symtab *);
+static void read_ofile_symtab (struct objfile *, legacy_psymtab *);
 
-static void dbx_read_symtab (struct partial_symtab *self,
+static void dbx_read_symtab (legacy_psymtab *self,
 			     struct objfile *objfile);
 
-static void dbx_psymtab_to_symtab_1 (struct objfile *, struct partial_symtab *);
+static void dbx_psymtab_to_symtab_1 (struct objfile *, legacy_psymtab *);
 
 static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *);
 
-static struct partial_symtab *find_corresponding_bincl_psymtab (const char *,
+static legacy_psymtab *find_corresponding_bincl_psymtab (const char *,
 								int);
 
 static const char *dbx_next_symbol_text (struct objfile *);
@@ -297,7 +297,7 @@ 
 
 static void add_this_object_header_file (int);
 
-static struct partial_symtab *start_psymtab (struct objfile *, const char *,
+static legacy_psymtab *start_psymtab (struct objfile *, const char *,
 					     CORE_ADDR, int);
 
 /* Free up old header file tables.  */
@@ -857,7 +857,7 @@ 
    bincl in the list.  Return the partial symtab associated
    with that header_file_location.  */
 
-static struct partial_symtab *
+static legacy_psymtab *
 find_corresponding_bincl_psymtab (const char *name, int instance)
 {
   for (const header_file_location &bincl : *bincl_list)
@@ -866,7 +866,7 @@ 
       return bincl.pst;
 
   repeated_header_complaint (name, symnum);
-  return (struct partial_symtab *) 0;
+  return (legacy_psymtab *) 0;
 }
 
 /* Set namestring based on nlist.  If the string table index is invalid, 
@@ -968,7 +968,7 @@ 
   int data_sect_index;
 
   /* Current partial symtab.  */
-  struct partial_symtab *pst;
+  legacy_psymtab *pst;
 
   /* List of current psymtab's include files.  */
   const char **psymtab_include_list;
@@ -976,7 +976,7 @@ 
   int includes_used;
 
   /* Index within current psymtab dependency list.  */
-  struct partial_symtab **dependency_list;
+  legacy_psymtab **dependency_list;
   int dependencies_used, dependencies_allocated;
 
   text_addr = DBX_TEXT_ADDR (objfile);
@@ -989,7 +989,7 @@ 
 
   stringtab_global = DBX_STRINGTAB (objfile);
 
-  pst = (struct partial_symtab *) 0;
+  pst = (legacy_psymtab *) 0;
 
   includes_allocated = 30;
   includes_used = 0;
@@ -999,8 +999,8 @@ 
   dependencies_allocated = 30;
   dependencies_used = 0;
   dependency_list =
-    (struct partial_symtab **) alloca (dependencies_allocated *
-				       sizeof (struct partial_symtab *));
+    (legacy_psymtab **) alloca (dependencies_allocated *
+				sizeof (legacy_psymtab *));
 
   /* Init bincl list */
   std::vector<struct header_file_location> bincl_storage;
@@ -1138,7 +1138,7 @@ 
 				   ? nlist.n_value : pst->raw_text_high (),
 				   dependency_list, dependencies_used,
 				   textlow_not_set);
-		  pst = (struct partial_symtab *) 0;
+		  pst = (legacy_psymtab *) 0;
 		  includes_used = 0;
 		  dependencies_used = 0;
 		  has_line_numbers = 0;
@@ -1253,7 +1253,7 @@ 
 				      ? valu : pst->raw_text_high ()),
 				     dependency_list, dependencies_used,
 				     prev_textlow_not_set);
-		    pst = (struct partial_symtab *) 0;
+		    pst = (legacy_psymtab *) 0;
 		    includes_used = 0;
 		    dependencies_used = 0;
 		    has_line_numbers = 0;
@@ -1764,7 +1764,7 @@ 
 	  /* Find the corresponding bincl and mark that psymtab on the
 	     psymtab dependency list.  */
 	  {
-	    struct partial_symtab *needed_pst =
+	    legacy_psymtab *needed_pst =
 	      find_corresponding_bincl_psymtab (namestring, nlist.n_value);
 
 	    /* If this include file was defined earlier in this file,
@@ -1791,15 +1791,15 @@ 
 		dependency_list[dependencies_used++] = needed_pst;
 		if (dependencies_used >= dependencies_allocated)
 		  {
-		    struct partial_symtab **orig = dependency_list;
+		    legacy_psymtab **orig = dependency_list;
 
 		    dependency_list =
-		      (struct partial_symtab **)
+		      (legacy_psymtab **)
 		      alloca ((dependencies_allocated *= 2)
-			      * sizeof (struct partial_symtab *));
+			      * sizeof (legacy_psymtab *));
 		    memcpy (dependency_list, orig,
 			    (dependencies_used
-			     * sizeof (struct partial_symtab *)));
+			     * sizeof (legacy_psymtab *)));
 #ifdef DEBUG_INFO
 		    fprintf_unfiltered (gdb_stderr,
 					"Had to reallocate "
@@ -1825,7 +1825,7 @@ 
 			       symnum * symbol_size,
 			       (CORE_ADDR) 0, dependency_list,
 			       dependencies_used, textlow_not_set);
-	      pst = (struct partial_symtab *) 0;
+	      pst = (legacy_psymtab *) 0;
 	      includes_used = 0;
 	      dependencies_used = 0;
 	      has_line_numbers = 0;
@@ -1901,17 +1901,16 @@ 
    is the address relative to which its symbols are (incremental) or 0
    (normal).  */
 
-static struct partial_symtab *
+static legacy_psymtab *
 start_psymtab (struct objfile *objfile, const char *filename, CORE_ADDR textlow,
 	       int ldsymoff)
 {
-  struct partial_symtab *result = new partial_symtab (filename, objfile,
-						      textlow);
+  legacy_psymtab *result = new legacy_psymtab (filename, objfile, textlow);
 
   result->read_symtab_private =
     XOBNEW (&objfile->objfile_obstack, struct symloc);
   LDSYMOFF (result) = ldsymoff;
-  result->read_symtab = dbx_read_symtab;
+  result->legacy_read_symtab = dbx_read_symtab;
   SYMBOL_SIZE (result) = symbol_size;
   SYMBOL_OFFSET (result) = symbol_table_offset;
   STRING_OFFSET (result) = string_table_offset;
@@ -1929,11 +1928,11 @@ 
 
    FIXME:  List variables and peculiarities of same.  */
 
-struct partial_symtab *
-dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+legacy_psymtab *
+dbx_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
 		 const char **include_list, int num_includes,
 		 int capping_symbol_offset, CORE_ADDR capping_text,
-		 struct partial_symtab **dependency_list,
+		 legacy_psymtab **dependency_list,
 		 int number_dependencies,
 		 int textlow_not_set)
 {
@@ -2019,15 +2018,15 @@ 
       pst->dependencies
 	= objfile->partial_symtabs->allocate_dependencies (number_dependencies);
       memcpy (pst->dependencies, dependency_list,
-	      number_dependencies * sizeof (struct partial_symtab *));
+	      number_dependencies * sizeof (legacy_psymtab *));
     }
   else
     pst->dependencies = 0;
 
   for (i = 0; i < num_includes; i++)
     {
-      struct partial_symtab *subpst =
-	new partial_symtab (include_list[i], objfile);
+      legacy_psymtab *subpst =
+	new legacy_psymtab (include_list[i], objfile);
 
       subpst->read_symtab_private =
 	XOBNEW (&objfile->objfile_obstack, struct symloc);
@@ -2041,7 +2040,7 @@ 
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
 
-      subpst->read_symtab = pst->read_symtab;
+      subpst->legacy_read_symtab = pst->legacy_read_symtab;
     }
 
   if (num_includes == 0
@@ -2067,7 +2066,7 @@ 
 }
 
 static void
-dbx_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
+dbx_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
 {
   int i;
 
@@ -2094,7 +2093,8 @@ 
 	    wrap_here ("");	/* Flush output.  */
 	    gdb_flush (gdb_stdout);
 	  }
-	dbx_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
+	dbx_psymtab_to_symtab_1 (objfile,
+				 (legacy_psymtab *) pst->dependencies[i]);
       }
 
   if (LDSYMLEN (pst))		/* Otherwise it's a dummy.  */
@@ -2117,7 +2117,7 @@ 
    Be verbose about it if the user wants that.  SELF is not NULL.  */
 
 static void
-dbx_read_symtab (struct partial_symtab *self, struct objfile *objfile)
+dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
   if (self->readin)
     {
@@ -2167,7 +2167,7 @@ 
 /* Read in a defined section of a specific object file's symbols.  */
 
 static void
-read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
+read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
 {
   const char *namestring;
   struct external_nlist *bufp;
diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index 48f385e..88fa1a1 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -397,7 +397,7 @@ 
     }
 }
 
-typedef std::unordered_map<partial_symtab *, unsigned int> psym_index_map;
+typedef std::unordered_map<dwarf2_psymtab *, unsigned int> psym_index_map;
 
 /* Helper struct for building the address table.  */
 struct addrmap_index_data
@@ -437,7 +437,7 @@ 
 add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
 {
   struct addrmap_index_data *data = (struct addrmap_index_data *) datap;
-  struct partial_symtab *pst = (struct partial_symtab *) obj;
+  dwarf2_psymtab *pst = (dwarf2_psymtab *) obj;
 
   if (data->previous_valid)
     add_address_entry (data->objfile, data->addr_vec,
@@ -580,7 +580,7 @@ 
   struct signatured_type_index_data *info
     = (struct signatured_type_index_data *) d;
   struct signatured_type *entry = (struct signatured_type *) *slot;
-  struct partial_symtab *psymtab = entry->per_cu.v.psymtab;
+  dwarf2_psymtab *psymtab = entry->per_cu.v.psymtab;
 
   write_psymbols (info->symtab,
 		  info->psyms_seen,
@@ -610,12 +610,12 @@ 
    if they appeared in this psymtab.  */
 
 static void
-recursively_count_psymbols (struct partial_symtab *psymtab,
+recursively_count_psymbols (dwarf2_psymtab *psymtab,
 			    size_t &psyms_seen)
 {
   for (int i = 0; i < psymtab->number_of_dependencies; ++i)
     if (psymtab->dependencies[i]->user != NULL)
-      recursively_count_psymbols (psymtab->dependencies[i],
+      recursively_count_psymbols ((dwarf2_psymtab *) psymtab->dependencies[i],
 				  psyms_seen);
 
   psyms_seen += psymtab->n_global_syms;
@@ -627,7 +627,7 @@ 
 
 static void
 recursively_write_psymbols (struct objfile *objfile,
-			    struct partial_symtab *psymtab,
+			    dwarf2_psymtab *psymtab,
 			    struct mapped_symtab *symtab,
 			    std::unordered_set<partial_symbol *> &psyms_seen,
 			    offset_type cu_index)
@@ -636,7 +636,8 @@ 
 
   for (i = 0; i < psymtab->number_of_dependencies; ++i)
     if (psymtab->dependencies[i]->user != NULL)
-      recursively_write_psymbols (objfile, psymtab->dependencies[i],
+      recursively_write_psymbols (objfile,
+				  (dwarf2_psymtab *) psymtab->dependencies[i],
 				  symtab, psyms_seen, cu_index);
 
   write_psymbols (symtab,
@@ -866,14 +867,14 @@ 
      as if they appeared in this psymtab.  */
   void recursively_write_psymbols
     (struct objfile *objfile,
-     struct partial_symtab *psymtab,
+     dwarf2_psymtab *psymtab,
      std::unordered_set<partial_symbol *> &psyms_seen,
      int cu_index)
   {
     for (int i = 0; i < psymtab->number_of_dependencies; ++i)
       if (psymtab->dependencies[i]->user != NULL)
-	recursively_write_psymbols (objfile, psymtab->dependencies[i],
-				    psyms_seen, cu_index);
+	recursively_write_psymbols
+	  (objfile, (dwarf2_psymtab *) psymtab->dependencies[i], psyms_seen, cu_index);
 
     write_psymbols (psyms_seen,
 		    (objfile->partial_symtabs->global_psymbols.data ()
@@ -1232,7 +1233,7 @@ 
   write_one_signatured_type (struct signatured_type *entry,
 			     struct signatured_type_index_data *info)
   {
-    struct partial_symtab *psymtab = entry->per_cu.v.psymtab;
+    dwarf2_psymtab *psymtab = entry->per_cu.v.psymtab;
 
     write_psymbols (info->psyms_seen,
 		    (info->objfile->partial_symtabs->global_psymbols.data ()
@@ -1318,7 +1319,7 @@ 
   size_t psyms_count = 0;
   for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
     {
-      struct partial_symtab *psymtab = per_cu->v.psymtab;
+      dwarf2_psymtab *psymtab = per_cu->v.psymtab;
 
       if (psymtab != NULL && psymtab->user == NULL)
 	recursively_count_psymbols (psymtab, psyms_count);
@@ -1421,7 +1422,7 @@ 
     {
       struct dwarf2_per_cu_data *per_cu
 	= dwarf2_per_objfile->all_comp_units[i];
-      struct partial_symtab *psymtab = per_cu->v.psymtab;
+      dwarf2_psymtab *psymtab = per_cu->v.psymtab;
 
       /* CU of a shared file from 'dwz -m' may be unused by this main file.
 	 It may be referenced from a local scope but in such case it does not
@@ -1506,7 +1507,7 @@ 
   for (int i = 0; i < dwarf2_per_objfile->all_comp_units.size (); ++i)
     {
       const dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->all_comp_units[i];
-      partial_symtab *psymtab = per_cu->v.psymtab;
+      dwarf2_psymtab *psymtab = per_cu->v.psymtab;
 
       /* CU of a shared file from 'dwz -m' may be unused by this main
 	 file.  It may be referenced from a local scope but in such
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 3127c48..2408098 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1450,7 +1450,7 @@ 
 static void dwarf2_find_base_address (struct die_info *die,
 				      struct dwarf2_cu *cu);
 
-static struct partial_symtab *create_partial_symtab
+static dwarf2_psymtab *create_partial_symtab
   (struct dwarf2_per_cu_data *per_cu, const char *name);
 
 static void build_type_psymtabs_reader (const struct die_reader_specs *reader,
@@ -1483,10 +1483,7 @@ 
 				    CORE_ADDR *lowpc, CORE_ADDR *highpc,
 				    int need_pc, struct dwarf2_cu *cu);
 
-static void dwarf2_read_symtab (struct partial_symtab *,
-				struct objfile *);
-
-static void psymtab_to_symtab_1 (struct partial_symtab *);
+static void psymtab_to_symtab_1 (dwarf2_psymtab *);
 
 static abbrev_table_up abbrev_table_read_table
   (struct dwarf2_per_objfile *dwarf2_per_objfile, struct dwarf2_section_info *,
@@ -1606,7 +1603,7 @@ 
 						struct dwarf2_cu *cu);
 
 static void dwarf_decode_lines (struct line_header *, const char *,
-				struct dwarf2_cu *, struct partial_symtab *,
+				struct dwarf2_cu *, dwarf2_psymtab *,
 				CORE_ADDR, int decode_mapping);
 
 static void dwarf2_start_subfile (struct dwarf2_cu *, const char *,
@@ -1665,7 +1662,7 @@ 
 static void read_variable (struct die_info *die, struct dwarf2_cu *cu);
 
 static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
-			       struct dwarf2_cu *, struct partial_symtab *);
+			       struct dwarf2_cu *, dwarf2_psymtab *);
 
 /* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
    values.  Keep the items ordered with increasing constraints compliance.  */
@@ -1688,7 +1685,7 @@ 
 static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
 						 CORE_ADDR *, CORE_ADDR *,
 						 struct dwarf2_cu *,
-						 struct partial_symtab *);
+						 dwarf2_psymtab *);
 
 static void get_scope_pc_bounds (struct die_info *,
 				 CORE_ADDR *, CORE_ADDR *,
@@ -6630,10 +6627,10 @@ 
    partial symtab as being an include of PST.  */
 
 static void
-dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst,
+dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst,
                                struct objfile *objfile)
 {
-  struct partial_symtab *subpst = new partial_symtab (name, objfile);
+  dwarf2_psymtab *subpst = new dwarf2_psymtab (name, objfile);
 
   if (!IS_ABSOLUTE_PATH (subpst->filename))
     {
@@ -6645,12 +6642,10 @@ 
   subpst->dependencies[0] = pst;
   subpst->number_of_dependencies = 1;
 
-  subpst->read_symtab = pst->read_symtab;
-
   /* No private part is necessary for include psymtabs.  This property
      can be used to differentiate between such include psymtabs and
      the regular ones.  */
-  subpst->read_symtab_private = NULL;
+  subpst->per_cu_data = nullptr;
 }
 
 /* Read the Line Number Program data and extract the list of files
@@ -6660,7 +6655,7 @@ 
 static void
 dwarf2_build_include_psymtabs (struct dwarf2_cu *cu,
 			       struct die_info *die,
-			       struct partial_symtab *pst)
+			       dwarf2_psymtab *pst)
 {
   line_header_up lh;
   struct attribute *attr;
@@ -7891,7 +7886,7 @@ 
   else
     {
       unsigned int line_offset = to_underlying (line_offset_struct);
-      struct partial_symtab *pst;
+      dwarf2_psymtab *pst;
       std::string name;
 
       /* Give the symtab a useful name for debug purposes.  */
@@ -7978,19 +7973,18 @@ 
    The caller must fill in the following details:
    dirname, textlow, texthigh.  */
 
-static struct partial_symtab *
+static dwarf2_psymtab *
 create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
 {
   struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
 
-  pst = new partial_symtab (name, objfile, 0);
+  pst = new dwarf2_psymtab (name, objfile, 0);
 
   pst->psymtabs_addrmap_supported = true;
 
   /* This is the glue that links PST into GDB's symbol API.  */
-  pst->read_symtab_private = per_cu;
-  pst->read_symtab = dwarf2_read_symtab;
+  pst->per_cu_data = per_cu;
   per_cu->v.psymtab = pst;
 
   return pst;
@@ -8026,7 +8020,7 @@ 
   struct dwarf2_per_cu_data *per_cu = cu->per_cu;
   CORE_ADDR baseaddr;
   CORE_ADDR best_lowpc = 0, best_highpc = 0;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
   enum pc_bounds_kind cu_bounds_kind;
   const char *filename;
   struct process_psymtab_comp_unit_data *info
@@ -8194,7 +8188,7 @@ 
   struct attribute *attr;
   struct partial_die_info *first_die;
   CORE_ADDR lowpc, highpc;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
 
   gdb_assert (data == NULL);
   gdb_assert (per_cu->is_debug_types);
@@ -8364,7 +8358,7 @@ 
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   struct type_unit_group *tu_group = (struct type_unit_group *) *slot;
   struct dwarf2_per_cu_data *per_cu = &tu_group->per_cu;
-  struct partial_symtab *pst = per_cu->v.psymtab;
+  dwarf2_psymtab *pst = per_cu->v.psymtab;
   int len = (tu_group->tus == nullptr) ? 0 : tu_group->tus->size ();
   int i;
 
@@ -8479,7 +8473,7 @@ 
 {
   for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
     {
-      struct partial_symtab *pst = per_cu->v.psymtab;
+      dwarf2_psymtab *pst = per_cu->v.psymtab;
 
       if (pst == NULL)
 	continue;
@@ -9472,24 +9466,23 @@ 
 /* Expand this partial symbol table into a full symbol table.  SELF is
    not NULL.  */
 
-static void
-dwarf2_read_symtab (struct partial_symtab *self,
-		    struct objfile *objfile)
+void
+dwarf2_psymtab::read_symtab (struct objfile *objfile)
 {
   struct dwarf2_per_objfile *dwarf2_per_objfile
     = get_dwarf2_per_objfile (objfile);
 
-  if (self->readin)
+  if (readin)
     {
       warning (_("bug: psymtab for %s is already read in."),
-	       self->filename);
+	       filename);
     }
   else
     {
       if (info_verbose)
 	{
 	  printf_filtered (_("Reading in symbols for %s..."),
-			   self->filename);
+			   filename);
 	  gdb_flush (gdb_stdout);
 	}
 
@@ -9508,7 +9501,7 @@ 
 
       dwarf2_per_objfile->reading_partial_symbols = 0;
 
-      psymtab_to_symtab_1 (self);
+      psymtab_to_symtab_1 (this);
 
       /* Finish up the debug error message.  */
       if (info_verbose)
@@ -9665,7 +9658,7 @@ 
 /* Read in full symbols for PST, and anything it depends on.  */
 
 static void
-psymtab_to_symtab_1 (struct partial_symtab *pst)
+psymtab_to_symtab_1 (dwarf2_psymtab *pst)
 {
   struct dwarf2_per_cu_data *per_cu;
   int i;
@@ -9689,10 +9682,10 @@ 
             wrap_here ("");     /* Flush output.  */
             gdb_flush (gdb_stdout);
           }
-        psymtab_to_symtab_1 (pst->dependencies[i]);
+        psymtab_to_symtab_1 ((dwarf2_psymtab *) pst->dependencies[i]);
       }
 
-  per_cu = (struct dwarf2_per_cu_data *) pst->read_symtab_private;
+  per_cu = pst->per_cu_data;
 
   if (per_cu == NULL)
     {
@@ -10468,7 +10461,7 @@ 
     per_cu->v.quick->compunit_symtab = cust;
   else
     {
-      struct partial_symtab *pst = per_cu->v.psymtab;
+      dwarf2_psymtab *pst = per_cu->v.psymtab;
       pst->compunit_symtab = cust;
       pst->readin = true;
     }
@@ -10548,7 +10541,7 @@ 
     per_cu->v.quick->compunit_symtab = cust;
   else
     {
-      struct partial_symtab *pst = per_cu->v.psymtab;
+      dwarf2_psymtab *pst = per_cu->v.psymtab;
       pst->compunit_symtab = cust;
       pst->readin = true;
     }
@@ -14598,7 +14591,7 @@ 
 static int
 dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
 		    CORE_ADDR *high_return, struct dwarf2_cu *cu,
-		    struct partial_symtab *ranges_pst)
+		    dwarf2_psymtab *ranges_pst)
 {
   struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
@@ -14667,7 +14660,7 @@ 
 static enum pc_bounds_kind
 dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 		      CORE_ADDR *highpc, struct dwarf2_cu *cu,
-		      struct partial_symtab *pst)
+		      dwarf2_psymtab *pst)
 {
   struct dwarf2_per_objfile *dwarf2_per_objfile
     = cu->per_cu->dwarf2_per_objfile;
@@ -20677,7 +20670,7 @@ 
 
 static const char *
 psymtab_include_file_name (const struct line_header *lh, const file_entry &fe,
-			   const struct partial_symtab *pst,
+			   const dwarf2_psymtab *pst,
 			   const char *comp_dir,
 			   gdb::unique_xmalloc_ptr<char> *name_holder)
 {
@@ -21376,7 +21369,7 @@ 
 
 static void
 dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
-		    struct dwarf2_cu *cu, struct partial_symtab *pst,
+		    struct dwarf2_cu *cu, dwarf2_psymtab *pst,
 		    CORE_ADDR lowpc, int decode_mapping)
 {
   struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index 53fc7f4..08068f8 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -25,6 +25,7 @@ 
 #include "filename-seen-cache.h"
 #include "gdb_obstack.h"
 #include "gdbsupport/hash_enum.h"
+#include "psympriv.h"
 
 /* Hold 'maintenance (set|show) dwarf' commands.  */
 extern struct cmd_list_element *set_dwarf_cmdlist;
@@ -268,9 +269,28 @@ 
 
 dwarf2_per_objfile *get_dwarf2_per_objfile (struct objfile *objfile);
 
+/* A partial symtab specialized for DWARF.  */
+struct dwarf2_psymtab : public partial_symtab
+{
+  dwarf2_psymtab (const char *filename, struct objfile *objfile)
+    : partial_symtab (filename, objfile)
+  {
+  }
+
+  dwarf2_psymtab (const char *filename, struct objfile *objfile,
+		  CORE_ADDR addr)
+    : partial_symtab (filename, objfile, addr)
+  {
+  }
+
+  void read_symtab (struct objfile *) override;
+
+  struct dwarf2_per_cu_data *per_cu_data;
+};
+
 /* Persistent data held for a compilation unit, even when not
    processing it.  We put a pointer to this structure in the
-   read_symtab_private field of the psymtab.  */
+   psymtab.  */
 
 struct dwarf2_per_cu_data
 {
@@ -338,7 +358,7 @@ 
   {
     /* The partial symbol table associated with this compilation unit,
        or NULL for unread partial units.  */
-    struct partial_symtab *psymtab;
+    dwarf2_psymtab *psymtab;
 
     /* Data needed by the "quick" functions.  */
     struct dwarf2_per_cu_quick_data *quick;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2319b35..cf10a25 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -251,10 +251,10 @@ 
 
 static void sort_blocks (struct symtab *);
 
-static struct partial_symtab *new_psymtab (const char *, struct objfile *);
+static legacy_psymtab *new_psymtab (const char *, struct objfile *);
 
 static void psymtab_to_symtab_1 (struct objfile *objfile,
-				 struct partial_symtab *, const char *);
+				 legacy_psymtab *, const char *);
 
 static void add_block (struct block *, struct symtab *);
 
@@ -275,7 +275,7 @@ 
    and reorders the symtab list at the end.  SELF is not NULL.  */
 
 static void
-mdebug_read_symtab (struct partial_symtab *self, struct objfile *objfile)
+mdebug_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
   if (info_verbose)
     {
@@ -389,7 +389,7 @@ 
 
 struct pst_map
 {
-  struct partial_symtab *pst;	/* the psymtab proper */
+  legacy_psymtab *pst;	/* the psymtab proper */
   long n_globals;		/* exported globals (external symbols) */
   long globals_offset;		/* cumulative */
 };
@@ -1911,7 +1911,7 @@ 
 
 static void
 parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
-		 struct partial_symtab *pst)
+		 legacy_psymtab *pst)
 {
   struct symbol *s, *i;
   const struct block *b;
@@ -2315,7 +2315,7 @@ 
   EXTR *ext_in;
   EXTR *ext_in_end;
   SYMR sh;
-  struct partial_symtab *pst;
+  legacy_psymtab *pst;
   int textlow_not_set = 1;
 
   /* List of current psymtab's include files.  */
@@ -2325,7 +2325,7 @@ 
   EXTR *extern_tab;
   struct pst_map *fdr_to_pst;
   /* Index within current psymtab dependency list.  */
-  struct partial_symtab **dependency_list;
+  legacy_psymtab **dependency_list;
   int dependencies_used, dependencies_allocated;
   char *name;
   enum language prev_language;
@@ -2354,8 +2354,8 @@ 
   dependencies_allocated = 30;
   dependencies_used = 0;
   dependency_list =
-    (struct partial_symtab **) alloca (dependencies_allocated *
-				       sizeof (struct partial_symtab *));
+    (legacy_psymtab **) alloca (dependencies_allocated *
+				sizeof (legacy_psymtab *));
 
   set_last_source_file (NULL);
 
@@ -2378,7 +2378,7 @@ 
   fdr_to_pst = fdr_to_pst_holder.data ();
   fdr_to_pst++;
   {
-    struct partial_symtab *new_pst = new_psymtab ("", objfile);
+    legacy_psymtab *new_pst = new_psymtab ("", objfile);
 
     fdr_to_pst[-1].pst = new_pst;
     FDR_IDX (new_pst) = -1;
@@ -2596,7 +2596,7 @@ 
   /* Pass 3 over files, over local syms: fill in static symbols.  */
   for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
     {
-      struct partial_symtab *save_pst;
+      legacy_psymtab *save_pst;
       EXTR *ext_ptr;
       CORE_ADDR textlow;
 
@@ -2614,7 +2614,7 @@ 
 	textlow = fh->adr;
       else
 	textlow = 0;
-      pst = new partial_symtab (fdr_name (fh), objfile, textlow);
+      pst = new legacy_psymtab (fdr_name (fh), objfile, textlow);
       pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
       memset (pst->read_symtab_private, 0, sizeof (struct symloc));
 
@@ -2626,7 +2626,7 @@ 
       PENDING_LIST (pst) = pending_list;
 
       /* The way to turn this into a symtab is to call...  */
-      pst->read_symtab = mdebug_read_symtab;
+      pst->legacy_read_symtab = mdebug_read_symtab;
 
       /* Set up language for the pst.
          The language from the FDR is used if it is unambigious (e.g. cfront
@@ -2900,7 +2900,7 @@ 
 			{		/* Here if prev stab wasn't N_SO.  */
 			  if (pst)
 			    {
-			      pst = (struct partial_symtab *) 0;
+			      pst = (legacy_psymtab *) 0;
 			      includes_used = 0;
 			      dependencies_used = 0;
 			    }
@@ -3284,7 +3284,7 @@ 
 		    if (pst
 			&& gdbarch_sofun_address_maybe_missing (gdbarch))
 		      {
-			pst = (struct partial_symtab *) 0;
+			pst = (legacy_psymtab *) 0;
 			includes_used = 0;
 			dependencies_used = 0;
 		      }
@@ -3739,12 +3739,12 @@ 
 
   /* Remove the dummy psymtab created for -O3 images above, if it is
      still empty, to enable the detection of stripped executables.  */
-  pst = objfile->partial_symtabs->psymtabs;
-  if (pst->next == NULL
-      && pst->number_of_dependencies == 0
-      && pst->n_global_syms == 0
-      && pst->n_static_syms == 0)
-    objfile->partial_symtabs->discard_psymtab (pst);
+  partial_symtab *pst_del = objfile->partial_symtabs->psymtabs;
+  if (pst_del->next == NULL
+      && pst_del->number_of_dependencies == 0
+      && pst_del->n_global_syms == 0
+      && pst_del->n_static_syms == 0)
+    objfile->partial_symtabs->discard_psymtab (pst_del);
 }
 
 /* If the current psymbol has an enumerated type, we need to add
@@ -3843,7 +3843,7 @@ 
 
 static void
 psymtab_to_symtab_1 (struct objfile *objfile,
-		     struct partial_symtab *pst, const char *filename)
+		     legacy_psymtab *pst, const char *filename)
 {
   bfd_size_type external_sym_size;
   bfd_size_type external_pdr_size;
@@ -3881,7 +3881,7 @@ 
 	    gdb_flush (gdb_stdout);
 	  }
 	/* We only pass the filename for debug purposes.  */
-	psymtab_to_symtab_1 (objfile, pst->dependencies[i],
+	psymtab_to_symtab_1 (objfile, (legacy_psymtab *) pst->dependencies[i],
 			     pst->dependencies[i]->filename);
       }
 
@@ -4656,12 +4656,12 @@ 
 
 /* Allocate a new partial_symtab NAME.  */
 
-static struct partial_symtab *
+static legacy_psymtab *
 new_psymtab (const char *name, struct objfile *objfile)
 {
-  struct partial_symtab *psymtab;
+  legacy_psymtab *psymtab;
 
-  psymtab = new partial_symtab (name, objfile);
+  psymtab = new legacy_psymtab (name, objfile);
 
   /* Keep a backpointer to the file's symbols.  */
 
@@ -4673,7 +4673,7 @@ 
   PENDING_LIST (psymtab) = pending_list;
 
   /* The way to turn this into a symtab is to call...  */
-  psymtab->read_symtab = mdebug_read_symtab;
+  psymtab->legacy_read_symtab = mdebug_read_symtab;
   return (psymtab);
 }
 
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 0dc6141..fc2ea81 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -121,6 +121,14 @@ 
 		  CORE_ADDR addr)
     ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
 
+  virtual ~partial_symtab ()
+  {
+  }
+
+  /* Read the full symbol table corresponding to this partial symbol
+     table.  */
+  virtual void read_symtab (struct objfile *) = 0;
+
   /* Return the raw low text address of this partial_symtab.  */
   CORE_ADDR raw_text_low () const
   {
@@ -280,11 +288,35 @@ 
      !readin or if we haven't looked for the symtab after it was readin.  */
 
   struct compunit_symtab *compunit_symtab = nullptr;
+};
+
+/* A partial_symtab that works in the historical db way.  This should
+   not be used in new code, but exists to transition the somewhat
+   unmaintained "legacy" debug formats.  */
+
+struct legacy_psymtab : public partial_symtab
+{
+  legacy_psymtab (const char *filename, struct objfile *objfile)
+    : partial_symtab (filename, objfile)
+  {
+  }
+
+  legacy_psymtab (const char *filename, struct objfile *objfile,
+		  CORE_ADDR addr)
+    : partial_symtab (filename, objfile, addr)
+  {
+  }
+
+  void read_symtab (struct objfile *objf) override
+  {
+    if (legacy_read_symtab)
+      (*legacy_read_symtab) (this, objf);
+  }
 
   /* Pointer to function which will read in the symtab corresponding to
      this psymtab.  */
 
-  void (*read_symtab) (struct partial_symtab *, struct objfile *) = nullptr;
+  void (*legacy_read_symtab) (legacy_psymtab *, struct objfile *) = nullptr;
 
   /* Information that lets read_symtab() locate the part of the symbol table
      that this psymtab corresponds to.  This information is private to the
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index b44b6c0..f0d1237 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -759,7 +759,7 @@ 
     {
       scoped_restore decrementer = increment_reading_symtab ();
 
-      (*pst->read_symtab) (pst, objfile);
+      pst->read_symtab (objfile);
     }
 
   return pst->compunit_symtab;
@@ -947,8 +947,6 @@ 
       fprintf_filtered (outfile,
 			"  Full symtab was read (at ");
       gdb_print_host_address (psymtab->compunit_symtab, outfile);
-      fprintf_filtered (outfile, " by function at ");
-      gdb_print_host_address (psymtab->read_symtab, outfile);
       fprintf_filtered (outfile, ")\n");
     }
 
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index f692808..20188c3 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -20,6 +20,7 @@ 
 #define STABSREAD_H
 
 struct objfile;
+struct legacy_psymtab;
 enum language;
 
 /* Definitions, prototypes, etc for stabs debugging format support
@@ -170,11 +171,11 @@ 
 /* Functions exported by dbxread.c.  These are not in stabsread.c because
    they are only used by some stabs readers.  */
 
-extern struct partial_symtab *dbx_end_psymtab
-  (struct objfile *objfile, struct partial_symtab *pst,
+extern legacy_psymtab *dbx_end_psymtab
+  (struct objfile *objfile, legacy_psymtab *pst,
    const char **include_list, int num_includes,
    int capping_symbol_offset, CORE_ADDR capping_text,
-   struct partial_symtab **dependency_list, int number_dependencies,
+   legacy_psymtab **dependency_list, int number_dependencies,
    int textlow_not_set);
 
 extern void process_one_symbol (int, int, CORE_ADDR, const char *,
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 1230cfb..f35e74a 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -229,7 +229,7 @@ 
 static struct symbol *process_xcoff_symbol (struct coff_symbol *,
 					    struct objfile *);
 
-static void read_xcoff_symtab (struct objfile *, struct partial_symtab *);
+static void read_xcoff_symtab (struct objfile *, legacy_psymtab *);
 
 #if 0
 static void add_stab_to_list (char *, struct pending_stabs **);
@@ -591,7 +591,7 @@ 
 
 /* Global variable to pass the psymtab down to all the routines involved
    in psymtab to symtab processing.  */
-static struct partial_symtab *this_symtab_psymtab;
+static legacy_psymtab *this_symtab_psymtab;
 
 /* Objfile related to this_symtab_psymtab; set at the same time.  */
 static struct objfile *this_symtab_objfile;
@@ -989,7 +989,7 @@ 
 /* Read symbols for a given partial symbol table.  */
 
 static void
-read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
+read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
 {
   bfd *abfd = objfile->obfd;
   char *raw_auxptr;		/* Pointer to first raw aux entry for sym.  */
@@ -1822,7 +1822,7 @@ 
 }
 
 static void
-xcoff_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst)
+xcoff_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
 {
   int i;
 
@@ -1852,7 +1852,8 @@ 
 	    wrap_here ("");	/* Flush output */
 	    gdb_flush (gdb_stdout);
 	  }
-	xcoff_psymtab_to_symtab_1 (objfile, pst->dependencies[i]);
+	xcoff_psymtab_to_symtab_1 (objfile,
+				   (legacy_psymtab *) pst->dependencies[i]);
       }
 
   if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
@@ -1871,7 +1872,7 @@ 
    Be verbose about it if the user wants that.  SELF is not NULL.  */
 
 static void
-xcoff_read_symtab (struct partial_symtab *self, struct objfile *objfile)
+xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile)
 {
   if (self->readin)
     {
@@ -2008,17 +2009,17 @@ 
    is the address relative to which its symbols are (incremental) or 0
    (normal).  */
 
-static struct partial_symtab *
+static legacy_psymtab *
 xcoff_start_psymtab (struct objfile *objfile,
 		     const char *filename, int first_symnum)
 {
   /* We fill in textlow later.  */
-  struct partial_symtab *result = new partial_symtab (filename, objfile, 0);
+  legacy_psymtab *result = new legacy_psymtab (filename, objfile, 0);
 
   result->read_symtab_private =
     XOBNEW (&objfile->objfile_obstack, struct symloc);
   ((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
-  result->read_symtab = xcoff_read_symtab;
+  result->legacy_read_symtab = xcoff_read_symtab;
 
   /* Deduce the source language from the filename for this psymtab.  */
   psymtab_language = deduce_language_from_filename (filename);
@@ -2034,11 +2035,11 @@ 
    INCLUDE_LIST, NUM_INCLUDES, DEPENDENCY_LIST, and NUMBER_DEPENDENCIES
    are the information for includes and dependencies.  */
 
-static struct partial_symtab *
-xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
+static legacy_psymtab *
+xcoff_end_psymtab (struct objfile *objfile, legacy_psymtab *pst,
 		   const char **include_list, int num_includes,
 		   int capping_symbol_number,
-		   struct partial_symtab **dependency_list,
+		   legacy_psymtab **dependency_list,
 		   int number_dependencies, int textlow_not_set)
 {
   int i;
@@ -2059,15 +2060,15 @@ 
       pst->dependencies
 	= objfile->partial_symtabs->allocate_dependencies (number_dependencies);
       memcpy (pst->dependencies, dependency_list,
-	      number_dependencies * sizeof (struct partial_symtab *));
+	      number_dependencies * sizeof (legacy_psymtab *));
     }
   else
     pst->dependencies = 0;
 
   for (i = 0; i < num_includes; i++)
     {
-      struct partial_symtab *subpst =
-	new partial_symtab (include_list[i], objfile);
+      legacy_psymtab *subpst =
+	new legacy_psymtab (include_list[i], objfile);
 
       subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
       ((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
@@ -2080,7 +2081,7 @@ 
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
 
-      subpst->read_symtab = pst->read_symtab;
+      subpst->legacy_read_symtab = pst->legacy_read_symtab;
     }
 
   if (num_includes == 0
@@ -2174,7 +2175,7 @@ 
   unsigned int nsyms;
 
   /* Current partial symtab */
-  struct partial_symtab *pst;
+  legacy_psymtab *pst;
 
   /* List of current psymtab's include files.  */
   const char **psymtab_include_list;
@@ -2182,7 +2183,7 @@ 
   int includes_used;
 
   /* Index within current psymtab dependency list.  */
-  struct partial_symtab **dependency_list;
+  legacy_psymtab **dependency_list;
   int dependencies_used, dependencies_allocated;
 
   char *sraw_symbol;
@@ -2196,7 +2197,7 @@ 
   int misc_func_recorded = 0;	/* true if any misc. function.  */
   int textlow_not_set = 1;
 
-  pst = (struct partial_symtab *) 0;
+  pst = (legacy_psymtab *) 0;
 
   includes_allocated = 30;
   includes_used = 0;
@@ -2206,8 +2207,8 @@ 
   dependencies_allocated = 30;
   dependencies_used = 0;
   dependency_list =
-    (struct partial_symtab **) alloca (dependencies_allocated *
-				       sizeof (struct partial_symtab *));
+    (legacy_psymtab **) alloca (dependencies_allocated *
+				       sizeof (legacy_psymtab *));
 
   set_last_source_file (NULL);