diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0aca3d3..15951c4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,35 @@
 2019-10-27  Tom Tromey  <tom@tromey.com>
 
+	* xcoffread.c (xcoff_psymtab_to_symtab_1): Change argument order.
+	Call expand_psymtab.
+	(xcoff_read_symtab): Call expand_psymtab.
+	(xcoff_start_psymtab, xcoff_end_psymtab): Set
+	legacy_expand_psymtab.
+	* psympriv.h (struct partial_symtab) <expand_psymtab>: New
+	method.
+	(struct legacy_psymtab) <expand_psymtab>: Implement.
+	<legacy_expand_psymtab>: New member.
+	* mdebugread.c (mdebug_read_symtab): Call expand_psymtab.
+	(parse_partial_symbols): Set legacy_expand_psymtab.
+	(psymtab_to_symtab_1): Change argument order.  Call
+	expand_psymtab.
+	(new_psymtab): Set legacy_expand_psymtab.
+	* dwarf2read.h (struct dwarf2_psymtab) <expand_psymtab>: Declare.
+	* dwarf2read.c (dwarf2_psymtab::read_symtab): Call
+	expand_psymtab.
+	(dwarf2_psymtab::expand_psymtab): Rename from
+	psymtab_to_symtab_1.  Call expand_psymtab.
+	* dbxread.c (start_psymtab): Set legacy_expand_psymtab.
+	(dbx_end_psymtab): Likewise.
+	(dbx_psymtab_to_symtab_1): Change argument order. Call
+	expand_psymtab.
+	(dbx_read_symtab): Call expand_psymtab.
+	* ctfread.c (struct ctf_psymtab) <expand_psymtab>: Declare.
+	(ctf_psymtab::expand_psymtab): Rename from psymtab_to_symtab.
+	(ctf_psymtab::read_symtab): Call expand_psymtab.
+
+2019-10-27  Tom Tromey  <tom@tromey.com>
+
 	* xcoffread.c (xcoff_read_symtab): Remove prints.  Add assert.
 	* psymtab.c (psymtab_to_symtab): Print verbose "Reading"
 	messages.
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 43cac9c..074bc68 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -105,6 +105,7 @@
   }
 
   void read_symtab (struct objfile *) override;
+  void expand_psymtab (struct objfile *) override;
 
   ctf_context_t *context;
 };
@@ -141,8 +142,6 @@
 
 /* Local function prototypes */
 
-static void psymtab_to_symtab (ctf_psymtab *);
-
 static int ctf_add_type_cb (ctf_id_t tid, void *arg);
 
 static struct type *read_array_type (ctf_context_t *ccp, ctf_id_t tid);
@@ -1208,15 +1207,15 @@
 
 /* Read in full symbols for PST, and anything it depends on.  */
 
-static void
-psymtab_to_symtab (ctf_psymtab *pst)
+void
+ctf_psymtab::expand_psymtab (struct objfile *objfile)
 {
   struct symbol *sym;
   ctf_context_t *ccp;
 
-  gdb_assert (!pst->readin);
+  gdb_assert (!readin);
 
-  ccp = pst->context;
+  ccp = context;
 
   /* Iterate over entries in data types section.  */
   if (ctf_type_iter (ccp->fp, ctf_add_type_cb, ccp) == CTF_ERR)
@@ -1246,7 +1245,7 @@
       set_symbol_address (ccp->of, sym, SYMBOL_LINKAGE_NAME (sym));
     }
 
-  pst->readin = true;
+  readin = true;
 }
 
 /* Expand partial symbol table PST into a full symbol table.
@@ -1271,7 +1270,7 @@
 
       offset = get_objfile_text_range (objfile, &tsize);
       ctf_start_symtab (this, objfile, offset);
-      psymtab_to_symtab (this);
+      expand_psymtab (objfile);
 
       set_text_low (offset);
       set_text_high (offset + tsize);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index a288071..f839cab 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -268,7 +268,7 @@
 static void dbx_read_symtab (legacy_psymtab *self,
 			     struct objfile *objfile);
 
-static void dbx_psymtab_to_symtab_1 (struct objfile *, legacy_psymtab *);
+static void dbx_psymtab_to_symtab_1 (legacy_psymtab *, struct objfile *);
 
 static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *);
 
@@ -1911,6 +1911,7 @@
     XOBNEW (&objfile->objfile_obstack, struct symloc);
   LDSYMOFF (result) = ldsymoff;
   result->legacy_read_symtab = dbx_read_symtab;
+  result->legacy_expand_psymtab = dbx_psymtab_to_symtab_1;
   SYMBOL_SIZE (result) = symbol_size;
   SYMBOL_OFFSET (result) = symbol_table_offset;
   STRING_OFFSET (result) = string_table_offset;
@@ -2041,6 +2042,7 @@
       subpst->number_of_dependencies = 1;
 
       subpst->legacy_read_symtab = pst->legacy_read_symtab;
+      subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab;
     }
 
   if (num_includes == 0
@@ -2066,7 +2068,7 @@
 }
 
 static void
-dbx_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
+dbx_psymtab_to_symtab_1 (legacy_psymtab *pst, struct objfile *objfile)
 {
   int i;
 
@@ -2093,8 +2095,7 @@
 	    wrap_here ("");	/* Flush output.  */
 	    gdb_flush (gdb_stdout);
 	  }
-	dbx_psymtab_to_symtab_1 (objfile,
-				 (legacy_psymtab *) pst->dependencies[i]);
+	pst->dependencies[i]->expand_psymtab (objfile);
       }
 
   if (LDSYMLEN (pst))		/* Otherwise it's a dummy.  */
@@ -2137,7 +2138,7 @@
 	    data_holder.reset (stabs_data);
 	  }
 
-	dbx_psymtab_to_symtab_1 (objfile, self);
+	self->expand_psymtab (objfile);
       }
 
       /* Match with global symbols.  This only needs to be done once,
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9209a4d..9b84ae7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1483,8 +1483,6 @@
 				    CORE_ADDR *lowpc, CORE_ADDR *highpc,
 				    int need_pc, struct dwarf2_cu *cu);
 
-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 *,
    sect_offset);
@@ -9488,7 +9486,7 @@
 
   dwarf2_per_objfile->reading_partial_symbols = 0;
 
-  psymtab_to_symtab_1 (this);
+  expand_psymtab (objfile);
 
   process_cu_includes (dwarf2_per_objfile);
 }
@@ -9639,18 +9637,18 @@
 
 /* Read in full symbols for PST, and anything it depends on.  */
 
-static void
-psymtab_to_symtab_1 (dwarf2_psymtab *pst)
+void
+dwarf2_psymtab::expand_psymtab (struct objfile *objfile)
 {
   struct dwarf2_per_cu_data *per_cu;
   int i;
 
-  if (pst->readin)
+  if (readin)
     return;
 
-  for (i = 0; i < pst->number_of_dependencies; i++)
-    if (!pst->dependencies[i]->readin
-	&& pst->dependencies[i]->user == NULL)
+  for (i = 0; i < number_of_dependencies; i++)
+    if (!dependencies[i]->readin
+	&& dependencies[i]->user == NULL)
       {
         /* Inform about additional files that need to be read in.  */
         if (info_verbose)
@@ -9660,20 +9658,20 @@
             wrap_here ("");
             fputs_filtered ("and ", gdb_stdout);
             wrap_here ("");
-            printf_filtered ("%s...", pst->dependencies[i]->filename);
+            printf_filtered ("%s...", dependencies[i]->filename);
             wrap_here ("");     /* Flush output.  */
             gdb_flush (gdb_stdout);
           }
-        psymtab_to_symtab_1 ((dwarf2_psymtab *) pst->dependencies[i]);
+	dependencies[i]->expand_psymtab (objfile);
       }
 
-  per_cu = pst->per_cu_data;
+  per_cu = per_cu_data;
 
   if (per_cu == NULL)
     {
       /* It's an include file, no symbols to read for it.
          Everything is in the parent symtab.  */
-      pst->readin = true;
+      readin = true;
       return;
     }
 
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index 08068f8..25287be 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -284,6 +284,7 @@
   }
 
   void read_symtab (struct objfile *) override;
+  void expand_psymtab (struct objfile *) override;
 
   struct dwarf2_per_cu_data *per_cu_data;
 };
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 6fde729..a99e3de 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -253,8 +253,8 @@
 
 static legacy_psymtab *new_psymtab (const char *, struct objfile *);
 
-static void psymtab_to_symtab_1 (struct objfile *objfile,
-				 legacy_psymtab *, const char *);
+static void psymtab_to_symtab_1 (legacy_psymtab *pst,
+				 struct objfile *objfile);
 
 static void add_block (struct block *, struct symtab *);
 
@@ -279,7 +279,7 @@
 {
   next_symbol_text_func = mdebug_next_symbol_text;
 
-  psymtab_to_symtab_1 (objfile, self, self->filename);
+  self->expand_psymtab (objfile);
 
   /* Match with global symbols.  This only needs to be done once,
      after all of the symtabs and dependencies have been read in.  */
@@ -2618,6 +2618,7 @@
 
       /* The way to turn this into a symtab is to call...  */
       pst->legacy_read_symtab = mdebug_read_symtab;
+      pst->legacy_expand_psymtab = psymtab_to_symtab_1;
 
       /* Set up language for the pst.
          The language from the FDR is used if it is unambigious (e.g. cfront
@@ -3833,8 +3834,7 @@
    The flow of control and even the memory allocation differs.  FIXME.  */
 
 static void
-psymtab_to_symtab_1 (struct objfile *objfile,
-		     legacy_psymtab *pst, const char *filename)
+psymtab_to_symtab_1 (legacy_psymtab *pst, struct objfile *objfile)
 {
   bfd_size_type external_sym_size;
   bfd_size_type external_pdr_size;
@@ -3871,9 +3871,7 @@
 	    wrap_here ("");	/* Flush output */
 	    gdb_flush (gdb_stdout);
 	  }
-	/* We only pass the filename for debug purposes.  */
-	psymtab_to_symtab_1 (objfile, (legacy_psymtab *) pst->dependencies[i],
-			     pst->dependencies[i]->filename);
+	pst->dependencies[i]->expand_psymtab (objfile);
       }
 
   /* Do nothing if this is a dummy psymtab.  */
@@ -4665,6 +4663,7 @@
 
   /* The way to turn this into a symtab is to call...  */
   psymtab->legacy_read_symtab = mdebug_read_symtab;
+  psymtab->legacy_expand_psymtab = psymtab_to_symtab_1;
   return (psymtab);
 }
 
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index fc2ea81..c9bf4c4 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -129,6 +129,11 @@
      table.  */
   virtual void read_symtab (struct objfile *) = 0;
 
+  /* Psymtab expansion is done in two steps.  The first step is a call
+     to read_symtab; but while that is in progress, calls to
+     expand_psymtab can be made.  */
+  virtual void expand_psymtab (struct objfile *) = 0;
+
   /* Return the raw low text address of this partial_symtab.  */
   CORE_ADDR raw_text_low () const
   {
@@ -313,11 +318,21 @@
       (*legacy_read_symtab) (this, objf);
   }
 
+  void expand_psymtab (struct objfile *objf) override
+  {
+    (*legacy_expand_psymtab) (this, objf);
+  }
+
   /* Pointer to function which will read in the symtab corresponding to
      this psymtab.  */
 
   void (*legacy_read_symtab) (legacy_psymtab *, struct objfile *) = nullptr;
 
+  /* Pointer to function which will actually expand this psymtab into
+     a full symtab.  */
+
+  void (*legacy_expand_psymtab) (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
      format-dependent symbol reading routines.  For further detail examine
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 9a63af6..99ac82f 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1822,7 +1822,7 @@
 }
 
 static void
-xcoff_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
+xcoff_psymtab_to_symtab_1 (legacy_psymtab *pst, struct objfile *objfile)
 {
   int i;
 
@@ -1852,8 +1852,7 @@
 	    wrap_here ("");	/* Flush output */
 	    gdb_flush (gdb_stdout);
 	  }
-	xcoff_psymtab_to_symtab_1 (objfile,
-				   (legacy_psymtab *) pst->dependencies[i]);
+	pst->dependencies[i]->expand_psymtab (objfile);
       }
 
   if (((struct symloc *) pst->read_symtab_private)->numsyms != 0)
@@ -1881,7 +1880,7 @@
     {
       next_symbol_text_func = xcoff_next_symbol_text;
 
-      xcoff_psymtab_to_symtab_1 (objfile, self);
+      self->expand_psymtab (objfile);
 
       /* Match with global symbols.  This only needs to be done once,
          after all of the symtabs and dependencies have been read in.   */
@@ -2002,6 +2001,7 @@
     XOBNEW (&objfile->objfile_obstack, struct symloc);
   ((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
   result->legacy_read_symtab = xcoff_read_symtab;
+  result->legacy_expand_psymtab = xcoff_psymtab_to_symtab_1;
 
   /* Deduce the source language from the filename for this psymtab.  */
   psymtab_language = deduce_language_from_filename (filename);
@@ -2064,6 +2064,7 @@
       subpst->number_of_dependencies = 1;
 
       subpst->legacy_read_symtab = pst->legacy_read_symtab;
+      subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab;
     }
 
   if (num_includes == 0
