+2020-01-26 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.
+
2020-01-26 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_read_symtab): Remove prints. Add assert.
}
void read_symtab (struct objfile *) override;
+ void expand_psymtab (struct objfile *) override;
struct ctf_context *context;
};
/* 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 (struct ctf_context *cp, ctf_id_t tid);
/* 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;
struct ctf_context *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)
set_symbol_address (ccp->of, sym, sym->linkage_name ());
}
- pst->readin = true;
+ readin = true;
}
/* Expand partial symbol table PST into a full symbol table.
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);
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 *);
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;
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
}
\f
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;
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. */
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,
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);
dwarf2_per_objfile->reading_partial_symbols = 0;
- psymtab_to_symtab_1 (this);
+ expand_psymtab (objfile);
process_cu_includes (dwarf2_per_objfile);
}
/* 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)
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;
}
}
void read_symtab (struct objfile *) override;
+ void expand_psymtab (struct objfile *) override;
struct dwarf2_per_cu_data *per_cu_data;
};
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 *);
{
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. */
/* 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
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;
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. */
/* 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);
}
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
{
(*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
}
\f
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;
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)
{
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. */
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);
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