This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pushed] Introduce partial_symtab::read_symtab method


The original change was created by Tom Tromey.

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
2020-01-26  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(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6353a00..8fcb24e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,50 @@
 2020-01-26  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.
+
+2020-01-26  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 e3931fb..120c7b4 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -115,6 +115,19 @@
   struct buildsym_compunit *builder;
 };
 
+/* 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;
+
+  struct ctf_context *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.  */
@@ -147,7 +160,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);
 
@@ -1171,12 +1184,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)
 {
   struct ctf_context *ccp;
 
-  ccp = (struct ctf_context *) pst->read_symtab_private;
+  ccp = pst->context;
   ccp->builder = new buildsym_compunit
 		       (of, of->original_name, NULL,
 		       language_c, text_offset);
@@ -1188,12 +1201,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)
 {
   struct ctf_context *ccp;
 
-  ccp = (struct ctf_context *) pst->read_symtab_private;
+  ccp = pst->context;
   struct compunit_symtab *result
     = ccp->builder->end_symtab (end_addr, section);
   delete ccp->builder;
@@ -1204,14 +1217,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;
   struct ctf_context *ccp;
 
   gdb_assert (!pst->readin);
 
-  ccp = (struct ctf_context *) 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)
@@ -1247,31 +1260,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)
@@ -1291,21 +1304,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;
   struct ctf_context *ccx;
 
-  pst = new partial_symtab (name, objfile, 0);
+  pst = new ctf_psymtab (name, objfile, 0);
 
   ccx = XOBNEW (&objfile->objfile_obstack, struct ctf_context);
   ccx->fp = cfp;
   ccx->of = objfile;
-  pst->read_symtab_private = (void *) ccx;
-  pst->read_symtab = ctf_read_symtab;
+  pst->context = ccx;
 
   return pst;
 }
@@ -1393,7 +1405,7 @@
   struct ctf_context 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 4e388fae..64387c6 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;
@@ -1136,7 +1136,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;
@@ -1251,7 +1251,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;
@@ -1762,7 +1762,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,
@@ -1789,15 +1789,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 "
@@ -1823,7 +1823,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;
@@ -1899,17 +1899,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;
@@ -1927,11 +1926,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)
 {
@@ -2017,15 +2016,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);
@@ -2039,7 +2038,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
@@ -2065,7 +2064,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;
 
@@ -2092,7 +2091,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.  */
@@ -2115,7 +2115,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)
     {
@@ -2165,7 +2165,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 fd22262..9aaf6af 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -399,7 +399,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
@@ -439,7 +439,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,
@@ -582,7 +582,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,
@@ -612,12 +612,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;
@@ -629,7 +629,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)
@@ -638,7 +638,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,
@@ -868,14 +869,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 ()
@@ -1234,7 +1235,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 ()
@@ -1320,7 +1321,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);
@@ -1423,7 +1424,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
@@ -1508,7 +1509,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 f865fa4..8bde265 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1480,7 +1480,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,
@@ -1513,10 +1513,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 *,
@@ -1644,7 +1641,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 *,
@@ -1703,7 +1700,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.  */
@@ -1726,7 +1723,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 *,
@@ -6692,10 +6689,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))
     {
@@ -6707,12 +6704,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
@@ -6722,7 +6717,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;
@@ -7934,7 +7929,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.  */
@@ -8021,19 +8016,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;
@@ -8055,7 +8049,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;
 
@@ -8224,7 +8218,7 @@
   struct attribute *attr;
   struct partial_die_info *first_die;
   CORE_ADDR lowpc, highpc;
-  struct partial_symtab *pst;
+  dwarf2_psymtab *pst;
 
   gdb_assert (per_cu->is_debug_types);
   sig_type = (struct signatured_type *) per_cu;
@@ -8397,7 +8391,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;
 
@@ -8514,7 +8508,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;
@@ -9494,24 +9488,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);
 	}
 
@@ -9530,7 +9523,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)
@@ -9687,7 +9680,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;
@@ -9711,10 +9704,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)
     {
@@ -10477,7 +10470,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;
     }
@@ -10557,7 +10550,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;
     }
@@ -14596,7 +14589,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);
@@ -14664,7 +14657,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;
@@ -20944,7 +20937,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)
 {
@@ -21645,7 +21638,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 bc8087b..06bd908 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;
@@ -269,9 +270,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
 {
@@ -339,7 +359,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 dafc7f4..621b314 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 */
 };
@@ -1910,7 +1910,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;
@@ -2310,7 +2310,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.  */
@@ -2320,7 +2320,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;
@@ -2349,8 +2349,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);
 
@@ -2373,7 +2373,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;
@@ -2591,7 +2591,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;
 
@@ -2609,7 +2609,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));
 
@@ -2621,7 +2621,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
@@ -2895,7 +2895,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;
 			    }
@@ -3285,7 +3285,7 @@
 		    if (pst
 			&& gdbarch_sofun_address_maybe_missing (gdbarch))
 		      {
-			pst = (struct partial_symtab *) 0;
+			pst = (legacy_psymtab *) 0;
 			includes_used = 0;
 			dependencies_used = 0;
 		      }
@@ -3740,12 +3740,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
@@ -3844,7 +3844,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;
@@ -3882,7 +3882,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);
       }
 
@@ -4655,12 +4655,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.  */
 
@@ -4672,7 +4672,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 82ae1b5..4c189aa 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
   {
@@ -278,11 +286,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 b31461c..6a2f7f7 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -758,7 +758,7 @@
     {
       scoped_restore decrementer = increment_reading_symtab ();
 
-      (*pst->read_symtab) (pst, objfile);
+      pst->read_symtab (objfile);
     }
 
   return pst->compunit_symtab;
@@ -946,8 +946,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 aa52a98..b3d6ef4 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 901c134..69731a4 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -230,7 +230,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 **);
@@ -592,7 +592,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;
@@ -990,7 +990,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.  */
@@ -1817,7 +1817,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;
 
@@ -1847,7 +1847,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)
@@ -1866,7 +1867,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)
     {
@@ -2003,17 +2004,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);
@@ -2029,11 +2030,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;
@@ -2054,15 +2055,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;
@@ -2075,7 +2076,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
@@ -2169,7 +2170,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;
@@ -2177,7 +2178,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;
@@ -2191,7 +2192,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;
@@ -2201,8 +2202,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);
 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]