+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.
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. */
/* 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);
/* 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);
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;
/* 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)
/* 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)
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;
}
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;
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_)
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. */
};
/* 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 *);
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. */
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)
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,
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;
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);
stringtab_global = DBX_STRINGTAB (objfile);
- pst = (struct partial_symtab *) 0;
+ pst = (legacy_psymtab *) 0;
includes_allocated = 30;
includes_used = 0;
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;
? 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;
? 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;
/* 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,
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 "
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;
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;
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)
{
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);
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
}
\f
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;
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. */
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)
{
/* 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;
}
}
-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
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,
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,
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;
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)
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,
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 ()
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 ()
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);
{
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
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
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,
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 *,
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 *,
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. */
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 *,
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))
{
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
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;
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. */
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;
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 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;
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;
{
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;
/* 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);
}
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)
/* 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;
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)
{
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;
}
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;
}
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);
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;
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)
{
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;
#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;
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
{
{
/* 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;
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 *);
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)
{
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 */
};
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;
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. */
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;
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);
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;
/* 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;
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));
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
{ /* 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;
}
if (pst
&& gdbarch_sofun_address_maybe_missing (gdbarch))
{
- pst = (struct partial_symtab *) 0;
+ pst = (legacy_psymtab *) 0;
includes_used = 0;
dependencies_used = 0;
}
/* 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
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;
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);
}
/* 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. */
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);
}
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
{
!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
{
scoped_restore decrementer = increment_reading_symtab ();
- (*pst->read_symtab) (pst, objfile);
+ pst->read_symtab (objfile);
}
return pst->compunit_symtab;
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");
}
#define STABSREAD_H
struct objfile;
+struct legacy_psymtab;
enum language;
/* Definitions, prototypes, etc for stabs debugging format support
/* 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 *,
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 **);
/* 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;
/* 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. */
}
\f
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;
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)
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)
{
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);
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;
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;
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
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;
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;
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;
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);