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_expand_psymtab (legacy_psymtab *, struct objfile *);
static void read_dbx_symtab (minimal_symbol_reader &, struct objfile *);
static void
read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
{
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ struct gdbarch *gdbarch = objfile->arch ();
struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch. */
struct internal_nlist nlist;
CORE_ADDR text_addr;
if (psymtab_language == language_cplus)
{
std::string name (namestring, p - namestring);
- std::string new_name = cp_canonicalize_string (name.c_str ());
- if (!new_name.empty ())
+ gdb::unique_xmalloc_ptr<char> new_name
+ = cp_canonicalize_string (name.c_str ());
+ if (new_name != nullptr)
{
- sym_len = new_name.length ();
+ sym_len = strlen (new_name.get ());
sym_name = obstack_strdup (&objfile->objfile_obstack,
- new_name);
+ new_name.get ());
}
}
XOBNEW (&objfile->objfile_obstack, struct symloc);
LDSYMOFF (result) = ldsymoff;
result->legacy_read_symtab = dbx_read_symtab;
+ result->legacy_expand_psymtab = dbx_expand_psymtab;
SYMBOL_SIZE (result) = symbol_size;
SYMBOL_OFFSET (result) = symbol_table_offset;
STRING_OFFSET (result) = string_table_offset;
int textlow_not_set)
{
int i;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ struct gdbarch *gdbarch = objfile->arch ();
if (capping_symbol_offset != -1)
LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
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
is not empty, but we don't realize that. Fixing that without slowing
things down might be tricky. */
- discard_psymtab (objfile, pst);
+ objfile->partial_symtabs->discard_psymtab (pst);
/* Indicate that psymtab was thrown away. */
pst = NULL;
}
\f
static void
-dbx_psymtab_to_symtab_1 (struct objfile *objfile, legacy_psymtab *pst)
+dbx_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
{
- int i;
-
- if (pst->readin)
- {
- fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. "
- "Shouldn't happen.\n",
- pst->filename);
- return;
- }
+ gdb_assert (!pst->readin);
/* Read in all partial symtabs on which this one is dependent. */
- for (i = 0; i < pst->number_of_dependencies; i++)
- if (!pst->dependencies[i]->readin)
- {
- /* Inform about additional files that need to be read in. */
- if (info_verbose)
- {
- fputs_filtered (" ", gdb_stdout);
- wrap_here ("");
- fputs_filtered ("and ", gdb_stdout);
- wrap_here ("");
- printf_filtered ("%s...", pst->dependencies[i]->filename);
- wrap_here (""); /* Flush output. */
- gdb_flush (gdb_stdout);
- }
- dbx_psymtab_to_symtab_1 (objfile,
- (legacy_psymtab *) pst->dependencies[i]);
- }
+ pst->expand_dependencies (objfile);
if (LDSYMLEN (pst)) /* Otherwise it's a dummy. */
{
static void
dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile)
{
- if (self->readin)
- {
- fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. "
- "Shouldn't happen.\n",
- self->filename);
- return;
- }
+ gdb_assert (!self->readin);
if (LDSYMLEN (self) || self->number_of_dependencies)
{
- /* Print the message now, before reading the string table,
- to avoid disconcerting pauses. */
- if (info_verbose)
- {
- printf_filtered ("Reading in symbols for %s...", self->filename);
- gdb_flush (gdb_stdout);
- }
-
next_symbol_text_func = dbx_next_symbol_text;
{
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,
after all of the symtabs and dependencies have been read in. */
scan_file_globals (objfile);
-
- /* Finish up the debug error message. */
- if (info_verbose)
- printf_filtered ("done.\n");
}
}
const section_offsets §ion_offsets,
struct objfile *objfile, enum language language)
{
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ struct gdbarch *gdbarch = objfile->arch ();
struct context_stack *newobj;
struct context_stack cstk;
/* This remembers the address of the start of a function. It is