if (!print_for_objfile)
continue;
- psymbol_functions *psf
- = dynamic_cast<psymbol_functions *> (objfile->qf.get ());
- if (psf == nullptr)
- continue;
-
- psymtab_storage *partial_symtabs = psf->get_partial_symtabs ().get ();
-
- if (address_arg != NULL)
+ for (const auto &iter : objfile->qf)
{
- struct bound_minimal_symbol msymbol = { NULL, NULL };
+ psymbol_functions *psf
+ = dynamic_cast<psymbol_functions *> (iter.get ());
+ if (psf == nullptr)
+ continue;
- /* We don't assume each pc has a unique objfile (this is for
- debugging). */
- struct partial_symtab *ps
- = psf->find_pc_sect_psymtab (objfile, pc, section, msymbol);
- if (ps != NULL)
- {
- if (!printed_objfile_header)
- {
- outfile->printf ("\nPartial symtabs for objfile %s\n",
- objfile_name (objfile));
- printed_objfile_header = 1;
- }
- dump_psymtab (objfile, ps, outfile);
- dump_psymtab_addrmap (objfile, partial_symtabs, ps, outfile);
- found = 1;
- }
- }
- else
- {
- for (partial_symtab *ps : psf->require_partial_symbols (objfile))
+ psymtab_storage *partial_symtabs
+ = psf->get_partial_symtabs ().get ();
+
+ if (address_arg != NULL)
{
- int print_for_source = 0;
+ struct bound_minimal_symbol msymbol = { NULL, NULL };
- QUIT;
- if (source_arg != NULL)
- {
- print_for_source
- = compare_filenames_for_search (ps->filename, source_arg);
- found = 1;
- }
- if (source_arg == NULL
- || print_for_source)
+ /* We don't assume each pc has a unique objfile (this is for
+ debugging). */
+ struct partial_symtab *ps
+ = psf->find_pc_sect_psymtab (objfile, pc, section, msymbol);
+ if (ps != NULL)
{
if (!printed_objfile_header)
{
printed_objfile_header = 1;
}
dump_psymtab (objfile, ps, outfile);
- dump_psymtab_addrmap (objfile, partial_symtabs, ps,
- outfile);
+ dump_psymtab_addrmap (objfile, partial_symtabs, ps, outfile);
+ found = 1;
+ }
+ }
+ else
+ {
+ for (partial_symtab *ps : psf->require_partial_symbols (objfile))
+ {
+ int print_for_source = 0;
+
+ QUIT;
+ if (source_arg != NULL)
+ {
+ print_for_source
+ = compare_filenames_for_search (ps->filename, source_arg);
+ found = 1;
+ }
+ if (source_arg == NULL
+ || print_for_source)
+ {
+ if (!printed_objfile_header)
+ {
+ outfile->printf ("\nPartial symtabs for objfile %s\n",
+ objfile_name (objfile));
+ printed_objfile_header = 1;
+ }
+ dump_psymtab (objfile, ps, outfile);
+ dump_psymtab_addrmap (objfile, partial_symtabs, ps,
+ outfile);
+ }
}
}
- }
- /* If we're printing all the objfile's symbols dump the full addrmap. */
+ /* If we're printing all the objfile's symbols dump the full addrmap. */
- if (address_arg == NULL
- && source_arg == NULL
- && partial_symtabs->psymtabs_addrmap != NULL)
- {
- outfile->puts ("\n");
- dump_psymtab_addrmap (objfile, partial_symtabs, NULL, outfile);
+ if (address_arg == NULL
+ && source_arg == NULL
+ && partial_symtabs->psymtabs_addrmap != NULL)
+ {
+ outfile->puts ("\n");
+ dump_psymtab_addrmap (objfile, partial_symtabs, NULL, outfile);
+ }
}
}
actually find a symtab whose name matches. */
int printed_objfile_start = 0;
- psymbol_functions *psf
- = dynamic_cast<psymbol_functions *> (objfile->qf.get ());
- if (psf == nullptr)
- continue;
- for (partial_symtab *psymtab : psf->require_partial_symbols (objfile))
+ for (const auto &iter : objfile->qf)
{
- QUIT;
-
- if (! regexp
- || re_exec (psymtab->filename))
+ psymbol_functions *psf
+ = dynamic_cast<psymbol_functions *> (iter.get ());
+ if (psf == nullptr)
+ continue;
+ for (partial_symtab *psymtab : psf->require_partial_symbols (objfile))
{
- if (! printed_objfile_start)
- {
- printf_filtered ("{ objfile %s ", objfile_name (objfile));
- wrap_here (" ");
- printf_filtered ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
- printed_objfile_start = 1;
- }
+ QUIT;
- printf_filtered (" { psymtab %s ", psymtab->filename);
- wrap_here (" ");
- printf_filtered ("((struct partial_symtab *) %s)\n",
- host_address_to_string (psymtab));
-
- printf_filtered (" readin %s\n",
- psymtab->readin_p (objfile) ? "yes" : "no");
- printf_filtered (" fullname %s\n",
- psymtab->fullname
- ? psymtab->fullname : "(null)");
- printf_filtered (" text addresses ");
- fputs_filtered (paddress (gdbarch,
- psymtab->text_low (objfile)),
- gdb_stdout);
- printf_filtered (" -- ");
- fputs_filtered (paddress (gdbarch,
- psymtab->text_high (objfile)),
- gdb_stdout);
- printf_filtered ("\n");
- printf_filtered (" psymtabs_addrmap_supported %s\n",
- (psymtab->psymtabs_addrmap_supported
- ? "yes" : "no"));
- printf_filtered (" globals ");
- if (!psymtab->global_psymbols.empty ())
- printf_filtered
- ("(* (struct partial_symbol **) %s @ %d)\n",
- host_address_to_string (psymtab->global_psymbols.data ()),
- (int) psymtab->global_psymbols.size ());
- else
- printf_filtered ("(none)\n");
- printf_filtered (" statics ");
- if (!psymtab->static_psymbols.empty ())
- printf_filtered
- ("(* (struct partial_symbol **) %s @ %d)\n",
- host_address_to_string (psymtab->static_psymbols.data ()),
- (int) psymtab->static_psymbols.size ());
- else
- printf_filtered ("(none)\n");
- if (psymtab->user)
- printf_filtered (" user %s "
- "((struct partial_symtab *) %s)\n",
- psymtab->user->filename,
- host_address_to_string (psymtab->user));
- printf_filtered (" dependencies ");
- if (psymtab->number_of_dependencies)
+ if (! regexp
+ || re_exec (psymtab->filename))
{
- int i;
+ if (! printed_objfile_start)
+ {
+ printf_filtered ("{ objfile %s ", objfile_name (objfile));
+ wrap_here (" ");
+ printf_filtered ("((struct objfile *) %s)\n",
+ host_address_to_string (objfile));
+ printed_objfile_start = 1;
+ }
- printf_filtered ("{\n");
- for (i = 0; i < psymtab->number_of_dependencies; i++)
+ printf_filtered (" { psymtab %s ", psymtab->filename);
+ wrap_here (" ");
+ printf_filtered ("((struct partial_symtab *) %s)\n",
+ host_address_to_string (psymtab));
+
+ printf_filtered (" readin %s\n",
+ psymtab->readin_p (objfile) ? "yes" : "no");
+ printf_filtered (" fullname %s\n",
+ psymtab->fullname
+ ? psymtab->fullname : "(null)");
+ printf_filtered (" text addresses ");
+ fputs_filtered (paddress (gdbarch,
+ psymtab->text_low (objfile)),
+ gdb_stdout);
+ printf_filtered (" -- ");
+ fputs_filtered (paddress (gdbarch,
+ psymtab->text_high (objfile)),
+ gdb_stdout);
+ printf_filtered ("\n");
+ printf_filtered (" psymtabs_addrmap_supported %s\n",
+ (psymtab->psymtabs_addrmap_supported
+ ? "yes" : "no"));
+ printf_filtered (" globals ");
+ if (!psymtab->global_psymbols.empty ())
+ printf_filtered
+ ("(* (struct partial_symbol **) %s @ %d)\n",
+ host_address_to_string (psymtab->global_psymbols.data ()),
+ (int) psymtab->global_psymbols.size ());
+ else
+ printf_filtered ("(none)\n");
+ printf_filtered (" statics ");
+ if (!psymtab->static_psymbols.empty ())
+ printf_filtered
+ ("(* (struct partial_symbol **) %s @ %d)\n",
+ host_address_to_string (psymtab->static_psymbols.data ()),
+ (int) psymtab->static_psymbols.size ());
+ else
+ printf_filtered ("(none)\n");
+ if (psymtab->user)
+ printf_filtered (" user %s "
+ "((struct partial_symtab *) %s)\n",
+ psymtab->user->filename,
+ host_address_to_string (psymtab->user));
+ printf_filtered (" dependencies ");
+ if (psymtab->number_of_dependencies)
{
- struct partial_symtab *dep = psymtab->dependencies[i];
-
- /* Note the string concatenation there --- no
- comma. */
- printf_filtered (" psymtab %s "
- "((struct partial_symtab *) %s)\n",
- dep->filename,
- host_address_to_string (dep));
+ int i;
+
+ printf_filtered ("{\n");
+ for (i = 0; i < psymtab->number_of_dependencies; i++)
+ {
+ struct partial_symtab *dep = psymtab->dependencies[i];
+
+ /* Note the string concatenation there --- no
+ comma. */
+ printf_filtered (" psymtab %s "
+ "((struct partial_symtab *) %s)\n",
+ dep->filename,
+ host_address_to_string (dep));
+ }
+ printf_filtered (" }\n");
}
- printf_filtered (" }\n");
+ else
+ printf_filtered ("(none)\n");
+ printf_filtered (" }\n");
}
- else
- printf_filtered ("(none)\n");
- printf_filtered (" }\n");
}
}
for (objfile *objfile : current_program_space->objfiles ())
{
- psymbol_functions *psf
- = dynamic_cast<psymbol_functions *> (objfile->qf.get ());
- if (psf == nullptr)
- continue;
-
- for (partial_symtab *ps : psf->require_partial_symbols (objfile))
+ for (const auto &iter : objfile->qf)
{
- struct gdbarch *gdbarch = objfile->arch ();
-
- /* We don't call psymtab_to_symtab here because that may cause symtab
- expansion. When debugging a problem it helps if checkers leave
- things unchanged. */
- cust = ps->get_compunit_symtab (objfile);
+ psymbol_functions *psf
+ = dynamic_cast<psymbol_functions *> (iter.get ());
+ if (psf == nullptr)
+ continue;
- /* First do some checks that don't require the associated symtab. */
- if (ps->text_high (objfile) < ps->text_low (objfile))
+ for (partial_symtab *ps : psf->require_partial_symbols (objfile))
{
- printf_filtered ("Psymtab ");
- puts_filtered (ps->filename);
- printf_filtered (" covers bad range ");
- fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
- gdb_stdout);
- printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
- gdb_stdout);
- printf_filtered ("\n");
- continue;
- }
+ struct gdbarch *gdbarch = objfile->arch ();
- /* Now do checks requiring the associated symtab. */
- if (cust == NULL)
- continue;
- bv = COMPUNIT_BLOCKVECTOR (cust);
- b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
- for (partial_symbol *psym : ps->static_psymbols)
- {
- /* Skip symbols for inlined functions without address. These may
- or may not have a match in the full symtab. */
- if (psym->aclass == LOC_BLOCK
- && psym->ginfo.value.address == 0)
- continue;
+ /* We don't call psymtab_to_symtab here because that may cause symtab
+ expansion. When debugging a problem it helps if checkers leave
+ things unchanged. */
+ cust = ps->get_compunit_symtab (objfile);
- sym = block_lookup_symbol (b, psym->ginfo.search_name (),
- symbol_name_match_type::SEARCH_NAME,
- psym->domain);
- if (!sym)
+ /* First do some checks that don't require the associated symtab. */
+ if (ps->text_high (objfile) < ps->text_low (objfile))
{
- printf_filtered ("Static symbol `");
- puts_filtered (psym->ginfo.linkage_name ());
- printf_filtered ("' only found in ");
+ printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
- printf_filtered (" psymtab\n");
+ printf_filtered (" covers bad range ");
+ fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
+ gdb_stdout);
+ printf_filtered (" - ");
+ fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
+ gdb_stdout);
+ printf_filtered ("\n");
+ continue;
}
- }
- b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
- for (partial_symbol *psym : ps->global_psymbols)
- {
- sym = block_lookup_symbol (b, psym->ginfo.search_name (),
- symbol_name_match_type::SEARCH_NAME,
- psym->domain);
- if (!sym)
+
+ /* Now do checks requiring the associated symtab. */
+ if (cust == NULL)
+ continue;
+ bv = COMPUNIT_BLOCKVECTOR (cust);
+ b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ for (partial_symbol *psym : ps->static_psymbols)
+ {
+ /* Skip symbols for inlined functions without address. These may
+ or may not have a match in the full symtab. */
+ if (psym->aclass == LOC_BLOCK
+ && psym->ginfo.value.address == 0)
+ continue;
+
+ sym = block_lookup_symbol (b, psym->ginfo.search_name (),
+ symbol_name_match_type::SEARCH_NAME,
+ psym->domain);
+ if (!sym)
+ {
+ printf_filtered ("Static symbol `");
+ puts_filtered (psym->ginfo.linkage_name ());
+ printf_filtered ("' only found in ");
+ puts_filtered (ps->filename);
+ printf_filtered (" psymtab\n");
+ }
+ }
+ b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ for (partial_symbol *psym : ps->global_psymbols)
+ {
+ sym = block_lookup_symbol (b, psym->ginfo.search_name (),
+ symbol_name_match_type::SEARCH_NAME,
+ psym->domain);
+ if (!sym)
+ {
+ printf_filtered ("Global symbol `");
+ puts_filtered (psym->ginfo.linkage_name ());
+ printf_filtered ("' only found in ");
+ puts_filtered (ps->filename);
+ printf_filtered (" psymtab\n");
+ }
+ }
+ if (ps->raw_text_high () != 0
+ && (ps->text_low (objfile) < BLOCK_START (b)
+ || ps->text_high (objfile) > BLOCK_END (b)))
{
- printf_filtered ("Global symbol `");
- puts_filtered (psym->ginfo.linkage_name ());
- printf_filtered ("' only found in ");
+ printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
- printf_filtered (" psymtab\n");
+ printf_filtered (" covers ");
+ fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
+ gdb_stdout);
+ printf_filtered (" - ");
+ fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
+ gdb_stdout);
+ printf_filtered (" but symtab covers only ");
+ fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
+ printf_filtered (" - ");
+ fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
+ printf_filtered ("\n");
}
}
- if (ps->raw_text_high () != 0
- && (ps->text_low (objfile) < BLOCK_START (b)
- || ps->text_high (objfile) > BLOCK_END (b)))
- {
- printf_filtered ("Psymtab ");
- puts_filtered (ps->filename);
- printf_filtered (" covers ");
- fputs_filtered (paddress (gdbarch, ps->text_low (objfile)),
- gdb_stdout);
- printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, ps->text_high (objfile)),
- gdb_stdout);
- printf_filtered (" but symtab covers only ");
- fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
- printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout);
- printf_filtered ("\n");
- }
}
}
}
them, then that is an indication that they are in fact available. Without
this function the symbols may have been already read in but they also may
not be present in this objfile. */
- if ((flags & OBJF_PSYMTABS_READ) == 0
- && qf != nullptr
- && qf->can_lazily_read_symbols ())
- retval = true;
- else if (qf != nullptr)
- retval = qf->has_symbols (this);
+ for (const auto &iter : qf)
+ {
+ if ((flags & OBJF_PSYMTABS_READ) == 0
+ && iter->can_lazily_read_symbols ())
+ retval = true;
+ else
+ retval = iter->has_symbols (this);
+ if (retval)
+ break;
+ }
if (debug_symfile)
fprintf_filtered (gdb_stdlog, "qf->has_symbols (%s) = %d\n",
fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (%s)\n",
objfile_debug_name (this));
- if (qf != nullptr)
- retval = qf->find_last_source_symtab (this);
+ for (const auto &iter : qf)
+ {
+ retval = iter->find_last_source_symtab (this);
+ if (retval != nullptr)
+ break;
+ }
if (debug_symfile)
fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (...) = %s\n",
fprintf_filtered (gdb_stdlog, "qf->forget_cached_source_info (%s)\n",
objfile_debug_name (this));
- if (qf != nullptr)
- qf->forget_cached_source_info (this);
+ for (const auto &iter : qf)
+ iter->forget_cached_source_info (this);
}
bool
host_address_to_string (&callback));
bool retval = false;
- if (qf != nullptr)
- retval = (qf->map_symtabs_matching_filename
- (this, name, real_path, callback));
+ for (const auto &iter : qf)
+ {
+ retval = (iter->map_symtabs_matching_filename
+ (this, name, real_path, callback));
+ if (retval)
+ break;
+ }
if (debug_symfile)
fprintf_filtered (gdb_stdlog,
objfile_debug_name (this), kind, name,
domain_name (domain));
- if (qf != nullptr)
- retval = qf->lookup_symbol (this, kind, name, domain);
+ for (const auto &iter : qf)
+ {
+ retval = iter->lookup_symbol (this, kind, name, domain);
+ if (retval != nullptr)
+ break;
+ }
if (debug_symfile)
fprintf_filtered (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
fprintf_filtered (gdb_stdlog, "qf->print_stats (%s, %d)\n",
objfile_debug_name (this), print_bcache);
- if (qf != nullptr)
- qf->print_stats (this, print_bcache);
+ for (const auto &iter : qf)
+ iter->print_stats (this, print_bcache);
}
void
fprintf_filtered (gdb_stdlog, "qf->dump (%s)\n",
objfile_debug_name (this));
- if (qf != nullptr)
- qf->dump (this);
+ for (const auto &iter : qf)
+ iter->dump (this);
}
void
"qf->expand_symtabs_for_function (%s, \"%s\")\n",
objfile_debug_name (this), func_name);
- if (qf != nullptr)
- qf->expand_symtabs_for_function (this, func_name);
+ for (const auto &iter : qf)
+ iter->expand_symtabs_for_function (this, func_name);
}
void
fprintf_filtered (gdb_stdlog, "qf->expand_all_symtabs (%s)\n",
objfile_debug_name (this));
- if (qf != nullptr)
- qf->expand_all_symtabs (this);
+ for (const auto &iter : qf)
+ iter->expand_all_symtabs (this);
}
void
"qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
objfile_debug_name (this), fullname);
- if (qf != nullptr)
- qf->expand_symtabs_with_fullname (this, fullname);
+ for (const auto &iter : qf)
+ iter->expand_symtabs_with_fullname (this, fullname);
}
void
domain_name (domain), global,
host_address_to_string (ordered_compare));
- if (qf != nullptr)
- qf->map_matching_symbols (this, name, domain, global,
- callback, ordered_compare);
+ for (const auto &iter : qf)
+ iter->map_matching_symbols (this, name, domain, global,
+ callback, ordered_compare);
}
void
host_address_to_string (&expansion_notify),
search_domain_name (kind));
- if (qf != nullptr)
- qf->expand_symtabs_matching (this, file_matcher, lookup_name,
- symbol_matcher, expansion_notify, kind);
+ for (const auto &iter : qf)
+ iter->expand_symtabs_matching (this, file_matcher, lookup_name,
+ symbol_matcher, expansion_notify, kind);
}
struct compunit_symtab *
host_address_to_string (section),
warn_if_readin);
- if (qf != nullptr)
- retval = qf->find_pc_sect_compunit_symtab (this, msymbol, pc, section,
- warn_if_readin);
+ for (const auto &iter : qf)
+ {
+ retval = iter->find_pc_sect_compunit_symtab (this, msymbol, pc, section,
+ warn_if_readin);
+ if (retval != nullptr)
+ break;
+ }
if (debug_symfile)
fprintf_filtered (gdb_stdlog,
host_address_to_string (data),
need_fullname);
- if (qf != nullptr)
- qf->map_symbol_filenames (this, fun, data, need_fullname);
+ for (const auto &iter : qf)
+ iter->map_symbol_filenames (this, fun, data, need_fullname);
}
struct compunit_symtab *
hex_string (address));
struct compunit_symtab *result = NULL;
- if (qf != nullptr)
- result = qf->find_compunit_symtab_by_address (this, address);
+ for (const auto &iter : qf)
+ {
+ result = iter->find_compunit_symtab_by_address (this, address);
+ if (result != nullptr)
+ break;
+ }
if (debug_symfile)
fprintf_filtered (gdb_stdlog,
bool *symbol_found_p)
{
enum language result = language_unknown;
+ *symbol_found_p = false;
- if (qf != nullptr)
- result = qf->lookup_global_symbol_language (this, name, domain,
- symbol_found_p);
- else
- *symbol_found_p = false;
+ for (const auto &iter : qf)
+ {
+ result = iter->lookup_global_symbol_language (this, name, domain,
+ symbol_found_p);
+ if (*symbol_found_p)
+ break;
+ }
return result;
}
{
flags |= OBJF_PSYMTABS_READ;
- if (qf->can_lazily_read_symbols ())
+ bool printed = false;
+ for (const auto &iter : qf)
{
- if (verbose)
- printf_filtered (_("Reading symbols from %s...\n"),
- objfile_name (this));
- qf->read_partial_symbols (this);
-
- if (verbose && !objfile_has_symbols (this))
- printf_filtered (_("(No debugging symbols found in %s)\n"),
- objfile_name (this));
+ if (iter->can_lazily_read_symbols ())
+ {
+ if (verbose && !printed)
+ {
+ printf_filtered (_("Reading symbols from %s...\n"),
+ objfile_name (this));
+ printed = true;
+ }
+ iter->read_partial_symbols (this);
+ }
}
+ if (printed && !objfile_has_symbols (this))
+ printf_filtered (_("(No debugging symbols found in %s)\n"),
+ objfile_name (this));
}
}