Same rationale as the previous patches.
Change-Id: I4673cedaa902c9a327d24d73508b18cf60a2cd02
Approved-By: Tom Tromey <tom@tromey.com>
bool is_wild_match = lookup_name.ada ().wild_match_p ();
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- map_matching_symbols (objfile, lookup_name, domain, global, data);
+ map_matching_symbols (&objfile, lookup_name, domain, global, data);
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab *cu : objfile.compunits ())
{
const struct block *global_block
= cu->blockvector ()->global_block ();
std::string bracket_name = std::string ("<_ada_") + name + '>';
lookup_name_info name1 (bracket_name, symbol_name_match_type::FULL);
- for (objfile *objfile : current_program_space->objfiles ())
- map_matching_symbols (objfile, name1, domain, global, data);
+ for (objfile &objfile : current_program_space->objfiles ())
+ map_matching_symbols (&objfile, name1, domain, global, data);
}
}
/* Iterate over all objfiles irrespective of scope or linker
namespaces so we get all exceptions anywhere in the
progspace. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
if (match_name (msymbol->linkage_name (), lookup_name,
nullptr)
&& msymbol->type () != mst_solib_trampoline)
{
ada_exc_info info
- = {name, msymbol->value_address (objfile)};
+ = {name, msymbol->value_address (&objfile)};
exceptions->push_back (info);
}
/* Iterate over all objfiles irrespective of scope or linker namespaces
so we get all exceptions anywhere in the progspace. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
auto callback = [&] (compunit_symtab *s)
{
the regular expression used to do the matching refers to the
natural name. So match against the decoded name. */
auto any = lookup_name_info::match_any ();
- objfile->search
+ objfile.search
(nullptr,
&any,
[&] (const char *search_name)
anything that isn't a text symbol (everything else will be
handled by the psymtab code above). */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
/* Go through the symtabs and check the externs and statics for
symbols which match. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
auto callback = [&] (compunit_symtab *s)
{
return true;
};
- objfile->search
+ objfile.search
(nullptr, &lookup_name, nullptr, callback,
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
SEARCH_ALL_DOMAINS);
{
/* Since the setting was off, we may not have observed the objfiles and
therefore not looked up the required symbols. Do so now. */
- for (objfile *objfile : current_program_space->objfiles ())
- if (agent_look_up_symbols (objfile) == 0)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (agent_look_up_symbols (&objfile) == 0)
break;
}
if (target_use_agent (can_use) == 0)
{
const char *const func_name = "_ovly_debug_event";
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data;
CORE_ADDR addr;
- bp_objfile_data = get_breakpoint_objfile_data (objfile);
+ bp_objfile_data = get_breakpoint_objfile_data (&objfile);
if (msym_not_found_p (bp_objfile_data->overlay_msym.minsym))
continue;
{
bound_minimal_symbol m
= lookup_minimal_symbol_text (current_program_space, func_name,
- objfile);
+ &objfile);
if (m.minsym == NULL)
{
/* Avoid future lookups in this objfile. */
}
addr = bp_objfile_data->overlay_msym.value_address ();
- b = create_internal_breakpoint (objfile->arch (), addr,
+ b = create_internal_breakpoint (objfile.arch (), addr,
bp_overlay_event);
b->locspec = new_explicit_location_spec_function (func_name);
{
set_current_program_space (pspace);
- for (objfile *obj : pspace->objfiles ())
+ for (objfile &obj : pspace->objfiles ())
{
/* Skip separate debug object, it's handled in the loop below. */
- if (obj->separate_debug_objfile_backlink != nullptr)
+ if (obj.separate_debug_objfile_backlink != nullptr)
continue;
/* Try a probe kind breakpoint on main objfile. */
- if (create_longjmp_master_breakpoint_probe (obj))
+ if (create_longjmp_master_breakpoint_probe (&obj))
continue;
/* Try longjmp_names kind breakpoints on main and separate_debug
objfiles. */
- for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+ for (objfile *debug_objfile : obj.separate_debug_objfiles ())
if (create_longjmp_master_breakpoint_names (debug_objfile))
break;
}
{
set_current_program_space (pspace);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
struct breakpoint *b;
struct breakpoint_objfile_data *bp_objfile_data;
- bp_objfile_data = get_breakpoint_objfile_data (objfile);
+ bp_objfile_data = get_breakpoint_objfile_data (&objfile);
if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym))
continue;
{
bound_minimal_symbol m
= lookup_minimal_symbol (current_program_space, func_name,
- objfile);
+ &objfile);
if (m.minsym == NULL || (m.minsym->type () != mst_text
&& m.minsym->type () != mst_file_text))
{
bp_objfile_data->terminate_msym = m;
}
- b = create_internal_breakpoint (objfile->arch (),
+ b = create_internal_breakpoint (objfile.arch (),
bp_objfile_data->terminate_msym,
bp_std_terminate_master);
b->locspec = new_explicit_location_spec_function (func_name);
static void
create_exception_master_breakpoint (void)
{
- for (objfile *obj : current_program_space->objfiles ())
+ for (objfile &obj : current_program_space->objfiles ())
{
/* Skip separate debug object. */
- if (obj->separate_debug_objfile_backlink)
+ if (obj.separate_debug_objfile_backlink)
continue;
/* Try a probe kind breakpoint. */
- if (create_exception_master_breakpoint_probe (obj))
+ if (create_exception_master_breakpoint_probe (&obj))
continue;
/* Iterate over main and separate debug objects and try an
_Unwind_DebugHook kind breakpoint. */
- for (objfile *debug_objfile : obj->separate_debug_objfiles ())
+ for (objfile *debug_objfile : obj.separate_debug_objfiles ())
if (create_exception_master_breakpoint_hook (debug_objfile))
break;
}
static struct dwarf2_fde *
dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
CORE_ADDR offset;
- if (objfile->obfd == nullptr)
+ if (objfile.obfd == nullptr)
continue;
- comp_unit *unit = find_comp_unit (objfile);
+ comp_unit *unit = find_comp_unit (&objfile);
if (unit == NULL)
{
- dwarf2_build_frame_info (objfile);
- unit = find_comp_unit (objfile);
+ dwarf2_build_frame_info (&objfile);
+ unit = find_comp_unit (&objfile);
}
gdb_assert (unit != NULL);
if (fde_table->empty ())
continue;
- gdb_assert (!objfile->section_offsets.empty ());
- offset = objfile->text_section_offset ();
+ gdb_assert (!objfile.section_offsets.empty ());
+ offset = objfile.text_section_offset ();
gdb_assert (!fde_table->empty ());
unrelocated_addr seek_pc = (unrelocated_addr) (*pc - offset);
{
*pc = (CORE_ADDR) (*it)->initial_location + offset;
if (out_per_objfile != nullptr)
- *out_per_objfile = get_dwarf2_per_objfile (objfile);
+ *out_per_objfile = get_dwarf2_per_objfile (&objfile);
return *it;
}
dw_index_kind index_kind
= (opts.dwarf_5 ? dw_index_kind::DEBUG_NAMES : dw_index_kind::GDB_INDEX);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* If the objfile does not correspond to an actual file, skip it. */
- if ((objfile->flags & OBJF_NOT_FILENAME) != 0)
+ if ((objfile.flags & OBJF_NOT_FILENAME) != 0)
continue;
- dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (&objfile);
if (per_objfile != NULL)
{
try
{
- const char *basename = lbasename (objfile_name (objfile));
+ const char *basename = lbasename (objfile_name (&objfile));
const dwz_file *dwz = per_objfile->per_bfd->get_dwz_file ();
const char *dwz_basename = NULL;
{
exception_fprintf (gdb_stderr, except,
_("Error while writing index for `%s': "),
- objfile_name (objfile));
+ objfile_name (&objfile));
}
}
/* See if this region of memory lies inside a known file on disk.
If so, we can avoid copying its contents by clearing SEC_LOAD. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &objsec : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &objsec : objfile.sections ())
{
- bfd *abfd = objfile->obfd.get ();
+ bfd *abfd = objfile.obfd.get ();
asection *asec = objsec.the_bfd_section;
bfd_vma align = (bfd_vma) 1 << bfd_section_alignment (asec);
bfd_vma start = objsec.addr () & -align;
This BFD was synthesized from reading target memory,
we don't want to omit that. */
- if (objfile->separate_debug_objfile_backlink == NULL
+ if (objfile.separate_debug_objfile_backlink == NULL
&& ((vaddr >= start && vaddr + size <= end)
|| (start >= vaddr && end <= vaddr + size))
&& !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
bfd_vma temp_bottom = 0, temp_top = 0;
/* Call callback function for each objfile section. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &objsec : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &objsec : objfile.sections ())
{
asection *isec = objsec.the_bfd_section;
flagword flags = bfd_section_flags (isec);
/* Separate debug info files are irrelevant for gcore. */
- if (objfile->separate_debug_objfile_backlink != NULL)
+ if (objfile.separate_debug_objfile_backlink != NULL)
continue;
if ((flags & SEC_ALLOC) || (flags & SEC_LOAD))
result = SCM_EOL;
- for (objfile *objf : current_program_space->objfiles ())
+ for (objfile &objf : current_program_space->objfiles ())
{
- SCM item = ofscm_scm_from_objfile (objf);
+ SCM item = ofscm_scm_from_objfile (&objf);
result = scm_cons (item, result);
}
static SCM
ppscm_find_pretty_printer_from_objfiles (SCM value)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (objfile);
+ objfile_smob *o_smob = ofscm_objfile_smob_from_objfile (&objfile);
SCM pp
= ppscm_search_pp_list (ofscm_objfile_smob_pretty_printers (o_smob),
value);
result = SCM_EOL;
- for (objfile *objfile : p_smob->pspace->objfiles ())
+ for (objfile &objfile : p_smob->pspace->objfiles ())
{
- if (objfile->separate_debug_objfile_backlink == NULL)
+ if (objfile.separate_debug_objfile_backlink == NULL)
{
- SCM item = ofscm_scm_from_objfile (objfile);
+ SCM item = ofscm_scm_from_objfile (&objfile);
result = scm_cons (item, result);
}
return NULL;
}
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
struct hppa_unwind_info *ui;
ui = NULL;
- struct hppa_objfile_private *priv = hppa_objfile_priv_data.get (objfile);
+ struct hppa_objfile_private *priv = hppa_objfile_priv_data.get (&objfile);
if (priv)
ui = priv->unwind_info;
if (!ui)
{
- read_unwind_info (objfile);
- priv = hppa_objfile_priv_data.get (objfile);
+ read_unwind_info (&objfile);
+ priv = hppa_objfile_priv_data.get (&objfile);
if (priv == NULL)
error (_("Internal error reading unwind information."));
ui = priv->unwind_info;
if (!libunwind_is_initialized ())
return -UNW_ENOINFO;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
void *buf = NULL;
- text_sec = objfile->sections + SECT_OFF_TEXT (objfile);
+ text_sec = objfile.sections + SECT_OFF_TEXT ((&objfile));
ip = text_sec->addr ();
- ret = ia64_find_unwind_table (objfile, ip, &di, &buf);
+ ret = ia64_find_unwind_table (&objfile, ip, &di, &buf);
if (ret >= 0)
{
addr = libunwind_find_dyn_list (as, &di, arg);
gdb_printf (gdb_stdlog,
"dynamic unwind table in objfile %s "
"at %s (gp=%s)\n",
- bfd_get_filename (objfile->obfd),
+ bfd_get_filename (objfile.obfd),
hex_string (addr), hex_string (di.gp));
*dilap = addr;
return 0;
std::optional<ui_out_emit_table> table_emitter;
/* Print a line for each JIT-ed objfile. */
- for (objfile *obj : inf->pspace->objfiles ())
+ for (objfile &obj : inf->pspace->objfiles ())
{
- if (obj->jited_data == nullptr)
+ if (obj.jited_data == nullptr)
continue;
if (!printed_header)
/* The +2 allows for the leading '0x', then one character for
every 4-bits. */
- int addr_width = 2 + (gdbarch_ptr_bit (obj->arch ()) / 4);
+ int addr_width = 2 + (gdbarch_ptr_bit (obj.arch ()) / 4);
/* The std::max here selects between the width of an address (as
a string) and the width of the column header string. */
ui_out_emit_tuple tuple_emitter (current_uiout, "jit-objfile");
- current_uiout->field_core_addr ("jit_code_entry-address", obj->arch (),
- obj->jited_data->addr);
- current_uiout->field_core_addr ("symfile-address", obj->arch (),
- obj->jited_data->symfile_addr);
+ current_uiout->field_core_addr ("jit_code_entry-address", obj.arch (),
+ obj.jited_data->addr);
+ current_uiout->field_core_addr ("symfile-address", obj.arch (),
+ obj.jited_data->symfile_addr);
current_uiout->field_unsigned ("symfile-size",
- obj->jited_data->symfile_size);
+ obj.jited_data->symfile_size);
current_uiout->text ("\n");
}
}
static struct objfile *
jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
{
- for (objfile *objf : current_program_space->objfiles ())
+ for (objfile &objf : current_program_space->objfiles ())
{
- if (objf->jited_data != nullptr && objf->jited_data->addr == entry_addr)
- return objf;
+ if (objf.jited_data != nullptr && objf.jited_data->addr == entry_addr)
+ return &objf;
}
return NULL;
for (bp_location &iter : b->locations ())
{
- for (objfile *objf : iter.pspace->objfiles ())
+ for (objfile &objf : iter.pspace->objfiles ())
{
- jiter_objfile_data *jiter_data = objf->jiter_data.get ();
+ jiter_objfile_data *jiter_data = objf.jiter_data.get ();
if (jiter_data != nullptr
&& jiter_data->jit_breakpoint == iter.owner)
static void
jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
{
- for (objfile *the_objfile : pspace->objfiles ())
+ for (objfile &the_objfile : pspace->objfiles ())
{
/* Skip separate debug objects. */
- if (the_objfile->separate_debug_objfile_backlink != nullptr)
+ if (the_objfile.separate_debug_objfile_backlink != nullptr)
continue;
- if (the_objfile->skip_jit_symbol_lookup)
+ if (the_objfile.skip_jit_symbol_lookup)
continue;
/* Lookup the registration symbol. If it is missing, then we
assume we are not attached to a JIT. */
bound_minimal_symbol reg_symbol
- = lookup_minimal_symbol_text (pspace, jit_break_name, the_objfile);
+ = lookup_minimal_symbol_text (pspace, jit_break_name, &the_objfile);
if (reg_symbol.minsym == NULL
|| reg_symbol.value_address () == 0)
{
/* No need to repeat the lookup the next time. */
- the_objfile->skip_jit_symbol_lookup = true;
+ the_objfile.skip_jit_symbol_lookup = true;
continue;
}
bound_minimal_symbol desc_symbol
= lookup_minimal_symbol_linkage (jit_descriptor_name,
- the_objfile, true);
+ &the_objfile, true);
if (desc_symbol.minsym == NULL
|| desc_symbol.value_address () == 0)
{
/* No need to repeat the lookup the next time. */
- the_objfile->skip_jit_symbol_lookup = true;
+ the_objfile.skip_jit_symbol_lookup = true;
continue;
}
jiter_objfile_data *objf_data
- = get_jiter_objfile_data (the_objfile);
+ = get_jiter_objfile_data (&the_objfile);
objf_data->register_code = reg_symbol.minsym;
objf_data->descriptor = desc_symbol.minsym;
- CORE_ADDR addr = objf_data->register_code->value_address (the_objfile);
+ CORE_ADDR addr = objf_data->register_code->value_address (&the_objfile);
jit_debug_printf ("breakpoint_addr = %s", paddress (gdbarch, addr));
/* Check if we need to re-create the breakpoint. */
jit_breakpoint_re_set_internal (gdbarch, pspace);
- for (objfile *jiter : pspace->objfiles ())
+ for (objfile &jiter : pspace->objfiles ())
{
- if (jiter->jiter_data == nullptr)
+ if (jiter.jiter_data == nullptr)
continue;
/* Read the descriptor so we can check the version number and load
any already JITed functions. */
- if (!jit_read_descriptor (gdbarch, &descriptor, jiter))
+ if (!jit_read_descriptor (gdbarch, &descriptor, &jiter))
continue;
/* Check that the version number agrees with that we support. */
static void
jit_inferior_exit_hook (struct inferior *inf)
{
- for (objfile *objf : current_program_space->objfiles_safe ())
+ for (objfile &objf : current_program_space->objfiles_safe ())
{
- if (objf->jited_data != nullptr && objf->jited_data->addr != 0)
- objf->unlink ();
+ if (objf.jited_data != nullptr && objf.jited_data->addr != 0)
+ objf.unlink ();
}
}
set_current_program_space (pspace);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
auto expand_callback = [&] (compunit_symtab *cu)
{
return true;
};
- objfile->search (nullptr, &lookup_name, nullptr, expand_callback,
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, domain);
+ objfile.search (nullptr, &lookup_name, nullptr, expand_callback,
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, domain);
}
}
}
set_current_program_space (pspace);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- iterate_over_minimal_symbols (objfile, name,
+ iterate_over_minimal_symbols (&objfile, name,
[&] (struct minimal_symbol *msym)
{
- add_minsym (msym, objfile, nullptr,
+ add_minsym (msym, &objfile, nullptr,
info->state->list_mode,
&minsyms);
return false;
if (!auto_load_thread_db)
return false;
- for (objfile *obj : current_program_space->objfiles ())
- if (libpthread_objfile_p (obj))
+ for (objfile &obj : current_program_space->objfiles ())
+ if (libpthread_objfile_p (&obj))
{
- if (try_thread_db_load_from_pdir_1 (obj, subdir))
+ if (try_thread_db_load_from_pdir_1 (&obj, subdir))
return true;
/* We may have found the separate-debug-info version of
libpthread, and it may live in a directory without a matching
libthread_db. */
- if (obj->separate_debug_objfile_backlink != NULL)
- return try_thread_db_load_from_pdir_1 (obj->separate_debug_objfile_backlink,
+ if (obj.separate_debug_objfile_backlink != NULL)
+ return try_thread_db_load_from_pdir_1 (obj.separate_debug_objfile_backlink,
subdir);
return false;
static bool
has_libpthread (void)
{
- for (objfile *obj : current_program_space->objfiles ())
- if (libpthread_objfile_p (obj))
+ for (objfile &obj : current_program_space->objfiles ())
+ if (libpthread_objfile_p (&obj))
return true;
return false;
We wait until now because it is common to add to the source search
path in local_gdbinit. */
global_auto_load = save_auto_load;
- for (objfile *objfile : current_program_space->objfiles ())
- load_auto_scripts_for_objfile (objfile);
+ for (objfile &objfile : current_program_space->objfiles ())
+ load_auto_scripts_for_objfile (&objfile);
/* Process '-x' and '-ex' options. */
execute_cmdargs (&cmdarg_vec, CMDARG_FILE, CMDARG_COMMAND, &ret);
gdb::option::process_options
(&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
- for (objfile *ofile : current_program_space->objfiles ())
+ for (objfile &ofile : current_program_space->objfiles ())
{
- if (ofile->obfd == current_program_space->exec_bfd ())
- maint_print_all_sections (_("Exec file: "), ofile->obfd.get (),
- ofile, arg);
+ if (ofile.obfd == current_program_space->exec_bfd ())
+ maint_print_all_sections (_("Exec file: "), ofile.obfd.get (),
+ &ofile, arg);
else if (opts.all_objects)
- maint_print_all_sections (_("Object file: "), ofile->obfd.get (),
- ofile, arg);
+ maint_print_all_sections (_("Object file: "), ofile.obfd.get (),
+ &ofile, arg);
}
if (current_program_space->core_bfd () != nullptr)
int arg_len = p - arg;
p = skip_spaces (p + 1);
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &iter : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &iter : objfile.sections ())
{
if (strncmp (iter.the_bfd_section->name, arg, arg_len) == 0)
goto found;
current_program_space may be NULL. */
if (current_program_space != NULL)
{
- for (objfile *o : current_program_space->objfiles ())
+ for (objfile &o : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : o->compunits ())
+ for (compunit_symtab *cu : o.compunits ())
{
++nr_compunit_symtabs;
nr_blocks += cu->blockvector ()->num_blocks ();
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
if (found.external_symbol.minsym != NULL)
break;
- if (objf == NULL || objf == objfile
- || objf == objfile->separate_debug_objfile_backlink)
+ if (objf == NULL || objf == &objfile
+ || objf == objfile.separate_debug_objfile_backlink)
{
symbol_lookup_debug_printf ("lookup_minimal_symbol (%s, %s, %s, %s)",
host_address_to_string (pspace),
name, sfile != NULL ? sfile : "NULL",
- objfile_debug_name (objfile));
+ objfile_debug_name (&objfile));
/* Do two passes: the first over the ordinary hash table,
and the second over the demangled hash table. */
- lookup_minimal_symbol_mangled (name, sfile, objfile,
- objfile->per_bfd->msymbol_hash,
+ lookup_minimal_symbol_mangled (name, sfile, &objfile,
+ objfile.per_bfd->msymbol_hash,
mangled_hash, mangled_cmp, found);
/* If not found, try the demangled hash table. */
table (usually just zero or one languages). */
for (unsigned iter = 0; iter < nr_languages; ++iter)
{
- if (!objfile->per_bfd->demangled_hash_languages.test (iter))
+ if (!objfile.per_bfd->demangled_hash_languages.test (iter))
continue;
enum language lang = (enum language) iter;
= language_def (lang)->get_symbol_name_matcher
(lookup_name);
struct minimal_symbol **msymbol_demangled_hash
- = objfile->per_bfd->msymbol_demangled_hash;
+ = objfile.per_bfd->msymbol_demangled_hash;
- lookup_minimal_symbol_demangled (lookup_name, sfile, objfile,
+ lookup_minimal_symbol_demangled (lookup_name, sfile, &objfile,
msymbol_demangled_hash,
hash, match, found);
lookup_minimal_symbol_linkage (program_space *pspace, const char *name,
bool match_static_type, bool only_main)
{
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- if (objfile->separate_debug_objfile_backlink != nullptr)
+ if (objfile.separate_debug_objfile_backlink != nullptr)
continue;
- if (only_main && (objfile->flags & OBJF_MAINLINE) == 0)
+ if (only_main && (objfile.flags & OBJF_MAINLINE) == 0)
continue;
bound_minimal_symbol minsym
- = lookup_minimal_symbol_linkage (name, objfile, match_static_type);
+ = lookup_minimal_symbol_linkage (name, &objfile, match_static_type);
if (minsym.minsym != nullptr)
return minsym;
}
if (objf == nullptr)
{
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
if (found_symbol.minsym != NULL)
break;
- search (objfile);
+ search (&objfile);
}
}
else
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (objf == NULL || objf == objfile
- || objf == objfile->separate_debug_objfile_backlink)
+ if (objf == NULL || objf == &objfile
+ || objf == objfile.separate_debug_objfile_backlink)
{
- for (msymbol = objfile->per_bfd->msymbol_hash[hash];
+ for (msymbol = objfile.per_bfd->msymbol_hash[hash];
msymbol != NULL;
msymbol = msymbol->hash_next)
{
- if (msymbol->value_address (objfile) == pc
+ if (msymbol->value_address (&objfile) == pc
&& strcmp (msymbol->linkage_name (), name) == 0)
return msymbol;
}
if (tsymbol != NULL)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
/* Also handle minimal symbols pointing to function
descriptors. */
/* Ignore data symbols that are not function
descriptors. */
- if (msymbol_is_function (objfile, msymbol, &func))
+ if (msymbol_is_function (&objfile, msymbol, &func))
return func;
}
}
}
/* First time through is JUST to get max length and count. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
sym_arr = XALLOCAVEC (struct symbol *, matches);
matches = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
}
/* First time through is JUST to get max length and count. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
regexp ? regexp : "*");
sym_arr = XALLOCAVEC (struct symbol *, matches);
matches = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
name = msymbol->natural_name ();
gdb_assert (symbol_names != NULL);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
unsigned int *objc_csym;
unsigned int objfile_csym = 0;
- objc_csym = objc_objfile_data.get (objfile);
+ objc_csym = objc_objfile_data.get (&objfile);
if (objc_csym != NULL && *objc_csym == 0)
/* There are no ObjC symbols in this objfile. Skip it entirely. */
continue;
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
}
if (objc_csym == NULL)
- objc_csym = objc_objfile_data.emplace (objfile, objfile_csym);
+ objc_csym = objc_objfile_data.emplace (&objfile, objfile_csym);
else
/* Count of ObjC methods in this objfile should be constant. */
gdb_assert (*objc_csym == objfile_csym);
bool
have_partial_symbols (program_space *pspace)
{
- for (objfile *ofp : pspace->objfiles ())
- if (ofp->has_partial_symbols ())
+ for (objfile &ofp : pspace->objfiles ())
+ if (ofp.has_partial_symbols ())
return true;
return false;
bool
have_full_symbols (program_space *pspace)
{
- for (objfile *ofp : pspace->objfiles ())
- if (ofp->has_full_symbols ())
+ for (objfile &ofp : pspace->objfiles ())
+ if (ofp.has_full_symbols ())
return true;
return false;
void
objfile_purge_solibs (program_space *pspace)
{
- for (objfile *objf : pspace->objfiles_safe ())
+ for (objfile &objf : pspace->objfiles_safe ())
{
/* We assume that the solib package has been purged already, or will
be soon. */
- if (!(objf->flags & OBJF_USERLOADED) && (objf->flags & OBJF_SHARED))
- objf->unlink ();
+ if (!(objf.flags & OBJF_USERLOADED) && (objf.flags & OBJF_SHARED))
+ objf.unlink ();
}
}
bool
have_minimal_symbols (program_space *pspace)
{
- for (objfile *ofp : pspace->objfiles ())
- if (ofp->per_bfd->minimal_symbol_count > 0)
+ for (objfile &ofp : pspace->objfiles ())
+ if (ofp.per_bfd->minimal_symbol_count > 0)
return true;
return false;
{
/* Sort on sequence number of the objfile in the chain. */
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile == objfile1)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (&objfile == objfile1)
return true;
- else if (objfile == objfile2)
+ else if (&objfile == objfile2)
return false;
/* We should have found one of the objfiles before getting here. */
xfree (map);
alloc_size = 0;
- for (objfile *objfile : pspace->objfiles ())
- for (obj_section &s : objfile->sections ())
- if (insert_section_p (objfile->obfd.get (), s.the_bfd_section))
+ for (objfile &objfile : pspace->objfiles ())
+ for (obj_section &s : objfile.sections ())
+ if (insert_section_p (objfile.obfd.get (), s.the_bfd_section))
alloc_size += 1;
/* This happens on detach/attach (e.g. in gdb.base/attach.exp). */
map = XNEWVEC (struct obj_section *, alloc_size);
i = 0;
- for (objfile *objfile : pspace->objfiles ())
- for (obj_section &s : objfile->sections ())
- if (insert_section_p (objfile->obfd.get (), s.the_bfd_section))
+ for (objfile &objfile : pspace->objfiles ())
+ for (obj_section &s : objfile.sections ())
+ if (insert_section_p (objfile.obfd.get (), s.the_bfd_section))
map[i++] = &s;
std::sort (map, map + alloc_size, sort_cmp);
shared_objfile_contains_address_p (struct program_space *pspace,
CORE_ADDR address)
{
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- if ((objfile->flags & OBJF_SHARED) != 0
- && is_addr_in_objfile (address, objfile))
+ if ((objfile.flags & OBJF_SHARED) != 0
+ && is_addr_in_objfile (address, &objfile))
return true;
}
error_no_arg (_("address"));
addr = parse_and_eval_address (arg);
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &osect : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
{
/* Only process each object file once, even if there's a separate
debug file. */
- if (objfile->separate_debug_objfile_backlink)
+ if (objfile.separate_debug_objfile_backlink)
continue;
sect_addr = overlay_mapped_address (addr, &osect);
const char *loc_string;
matches = 1;
- offset = sect_addr - msymbol->value_address (objfile);
+ offset = sect_addr - msymbol->value_address (&objfile);
mapped = section_is_mapped (&osect) ? _("mapped") : _("unmapped");
sec_name = osect.the_bfd_section->name;
msym_name = msymbol->print_name ();
const char *name,
std::vector<symtab_and_line> *result)
{
- for (objfile *objfile : search_pspace->objfiles ())
+ for (objfile &objfile : search_pspace->objfiles ())
{
- if (!objfile->sf || !objfile->sf->sym_probe_fns)
+ if (!objfile.sf || !objfile.sf->sym_probe_fns)
continue;
if (objfile_namestr
- && FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0
- && FILENAME_CMP (lbasename (objfile_name (objfile)),
+ && FILENAME_CMP (objfile_name (&objfile), objfile_namestr) != 0
+ && FILENAME_CMP (lbasename (objfile_name (&objfile)),
objfile_namestr) != 0)
continue;
const std::vector<std::unique_ptr<probe>> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
for (auto &p : probes)
{
continue;
symtab_and_line sal;
- sal.pc = p->get_relocated_address (objfile);
+ sal.pc = p->get_relocated_address (&objfile);
sal.explicit_pc = 1;
sal.section = find_pc_overlay (sal.pc);
sal.pspace = search_pspace;
sal.prob = p.get ();
- sal.objfile = objfile;
+ sal.objfile = &objfile;
result->push_back (std::move (sal));
}
result.objfile = NULL;
result.prob = NULL;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (!objfile->sf || !objfile->sf->sym_probe_fns
- || objfile->sect_index_text == -1)
+ if (!objfile.sf || !objfile.sf->sym_probe_fns
+ || objfile.sect_index_text == -1)
continue;
/* If this proves too inefficient, we can replace with a hash. */
const std::vector<std::unique_ptr<probe>> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
for (auto &p : probes)
- if (p->get_relocated_address (objfile) == pc)
+ if (p->get_relocated_address (&objfile) == pc)
{
- result.objfile = objfile;
+ result.objfile = &objfile;
result.prob = p.get ();
return result;
}
obj_pat.emplace (objname.c_str (), REG_NOSUB,
_("Invalid object file regexp"));
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (! objfile->sf || ! objfile->sf->sym_probe_fns)
+ if (! objfile.sf || ! objfile.sf->sym_probe_fns)
continue;
if (obj_pat)
{
- if (obj_pat->exec (objfile_name (objfile), 0, NULL, 0) != 0)
+ if (obj_pat->exec (objfile_name (&objfile), 0, NULL, 0) != 0)
continue;
}
const std::vector<std::unique_ptr<probe>> &probes
- = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+ = objfile.sf->sym_probe_fns->sym_get_probes (&objfile);
for (auto &p : probes)
{
&& probe_pat->exec (p->get_name ().c_str (), 0, NULL, 0) != 0)
continue;
- result.emplace_back (p.get (), objfile);
+ result.emplace_back (p.get (), &objfile);
}
}
return m_solib_ops->iterate_over_objfiles_in_search_order
(cb, current_objfile);
- for (const auto objfile : this->objfiles ())
- if (cb (objfile))
+ for (auto &objfile : this->objfiles ())
+ if (cb (&objfile))
return;
}
struct objfile *
program_space::objfile_for_address (CORE_ADDR address)
{
- for (auto iter : objfiles ())
+ for (auto &iter : objfiles ())
{
/* Don't check separate debug objfiles. */
- if (iter->separate_debug_objfile_backlink != nullptr)
+ if (iter.separate_debug_objfile_backlink != nullptr)
continue;
- if (is_addr_in_objfile (address, iter))
- return iter;
+ if (is_addr_in_objfile (address, &iter))
+ return &iter;
}
return nullptr;
}
#include "gdbsupport/owning_intrusive_list.h"
#include "gdbsupport/refcounted-object.h"
#include "gdbsupport/gdb_ref_ptr.h"
-#include "gdbsupport/reference-to-pointer-iterator.h"
#include <vector>
struct target_ops;
a program space. */
~program_space ();
- using objfiles_iterator
- = reference_to_pointer_iterator<intrusive_list<objfile>::iterator>;
+ using objfiles_iterator = intrusive_list<objfile>::iterator;
using objfiles_range = iterator_range<objfiles_iterator>;
/* Return an iterable object that can be used to iterate over all
objfiles. The basic use is in a foreach, like:
- for (objfile *objf : pspace->objfiles ()) { ... } */
+ for (objfile &objf : pspace->objfiles ()) { ... } */
objfiles_range objfiles ()
{
return objfiles_range (objfiles_iterator (m_objfiles_list.begin ()));
/* An iterable object that can be used to iterate over all objfiles.
The basic use is in a foreach, like:
- for (objfile *objf : pspace->objfiles_safe ()) { ... }
+ for (objfile &objf : pspace->objfiles_safe ()) { ... }
This variant uses a basic_safe_iterator so that objfiles can be
deleted during iteration. */
}
found = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
int printed_objfile_header = 0;
int print_for_objfile = 1;
QUIT;
if (objfile_arg != NULL)
print_for_objfile
- = compare_filenames_for_search (objfile_name (objfile),
+ = compare_filenames_for_search (objfile_name (&objfile),
objfile_arg);
if (!print_for_objfile)
continue;
- for (const auto &iter : objfile->qf)
+ for (const auto &iter : objfile.qf)
{
psymbol_functions *psf
= dynamic_cast<psymbol_functions *> (iter.get ());
/* 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);
+ = 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));
+ objfile_name (&objfile));
printed_objfile_header = 1;
}
- dump_psymtab (objfile, ps, outfile);
+ dump_psymtab (&objfile, ps, outfile);
found = 1;
}
}
else
{
- for (partial_symtab *ps : psf->partial_symbols (objfile))
+ for (partial_symtab *ps : psf->partial_symbols (&objfile))
{
int print_for_source = 0;
if (!printed_objfile_header)
{
outfile->printf ("\nPartial symtabs for objfile %s\n",
- objfile_name (objfile));
+ objfile_name (&objfile));
printed_objfile_header = 1;
}
- dump_psymtab (objfile, ps, outfile);
+ dump_psymtab (&objfile, ps, outfile);
}
}
}
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- struct gdbarch *gdbarch = objfile->arch ();
+ struct gdbarch *gdbarch = objfile.arch ();
/* We don't want to print anything for this objfile until we
actually find a symtab whose name matches. */
int printed_objfile_start = 0;
- for (const auto &iter : objfile->qf)
+ for (const auto &iter : objfile.qf)
{
psymbol_functions *psf
= dynamic_cast<psymbol_functions *> (iter.get ());
if (psf == nullptr)
continue;
- for (partial_symtab *psymtab : psf->partial_symbols (objfile))
+ for (partial_symtab *psymtab : psf->partial_symbols (&objfile))
{
QUIT;
{
if (! printed_objfile_start)
{
- gdb_printf ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (&objfile));
gdb_stdout->wrap_here (2);
gdb_printf ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ host_address_to_string (&objfile));
printed_objfile_start = 1;
}
host_address_to_string (psymtab));
gdb_printf (" readin %s\n",
- psymtab->readin_p (objfile) ? "yes" : "no");
+ psymtab->readin_p (&objfile) ? "yes" : "no");
gdb_printf (" fullname %s\n",
psymtab->fullname
? psymtab->fullname : "(null)");
gdb_printf (" text addresses ");
gdb_puts (paddress (gdbarch,
- psymtab->text_low (objfile)));
+ psymtab->text_low (&objfile)));
gdb_printf (" -- ");
gdb_puts (paddress (gdbarch,
- psymtab->text_high (objfile)));
+ psymtab->text_high (&objfile)));
gdb_printf ("\n");
gdb_printf (" globals ");
if (!psymtab->global_psymbols.empty ())
const struct blockvector *bv;
const struct block *b;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (const auto &iter : objfile->qf)
+ for (const auto &iter : objfile.qf)
{
psymbol_functions *psf
= dynamic_cast<psymbol_functions *> (iter.get ());
if (psf == nullptr)
continue;
- for (partial_symtab *ps : psf->partial_symbols (objfile))
+ for (partial_symtab *ps : psf->partial_symbols (&objfile))
{
- struct gdbarch *gdbarch = objfile->arch ();
+ 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);
+ cust = ps->get_compunit_symtab (&objfile);
/* First do some checks that don't require the associated symtab. */
- if (ps->text_high (objfile) < ps->text_low (objfile))
+ if (ps->text_high (&objfile) < ps->text_low (&objfile))
{
gdb_printf ("Psymtab ");
gdb_puts (ps->filename);
gdb_printf (" covers bad range ");
- gdb_puts (paddress (gdbarch, ps->text_low (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_low (&objfile)));
gdb_printf (" - ");
- gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_high (&objfile)));
gdb_printf ("\n");
continue;
}
}
}
if (ps->unrelocated_text_high () != unrelocated_addr (0)
- && (ps->text_low (objfile) < b->start ()
- || ps->text_high (objfile) > b->end ()))
+ && (ps->text_low (&objfile) < b->start ()
+ || ps->text_high (&objfile) > b->end ()))
{
gdb_printf ("Psymtab ");
gdb_puts (ps->filename);
gdb_printf (" covers ");
- gdb_puts (paddress (gdbarch, ps->text_low (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_low (&objfile)));
gdb_printf (" - ");
- gdb_puts (paddress (gdbarch, ps->text_high (objfile)));
+ gdb_puts (paddress (gdbarch, ps->text_high (&objfile)));
gdb_printf (" but symtab covers only ");
gdb_puts (paddress (gdbarch, b->start ()));
gdb_printf (" - ");
static PyObject *
find_pretty_printer_from_objfiles (PyObject *value)
{
- for (objfile *obj : current_program_space->objfiles ())
+ for (objfile &obj : current_program_space->objfiles ())
{
- gdbpy_ref<> objf = objfile_to_objfile_object (obj);
+ gdbpy_ref<> objf = objfile_to_objfile_object (&obj);
if (objf == NULL)
{
/* Ignore the error and continue. */
if (self->pspace != NULL)
{
- for (objfile *objf : self->pspace->objfiles ())
+ for (objfile &objf : self->pspace->objfiles ())
{
- gdbpy_ref<> item = objfile_to_objfile_object (objf);
+ gdbpy_ref<> item = objfile_to_objfile_object (&objf);
if (item == nullptr
|| PyList_Append (list.get (), item.get ()) == -1)
/* Expand any symtabs that contain potentially matching symbols. */
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
auto callback = [&] (compunit_symtab *cust)
{
return true;
};
- if (!objfile->search (nullptr, &lookup_name, nullptr, callback,
- SEARCH_STATIC_BLOCK, flags))
+ if (!objfile.search (nullptr, &lookup_name, nullptr, callback,
+ SEARCH_STATIC_BLOCK, flags))
return nullptr;
}
}
/* Gather debug method matchers registered with the object files.
This could be done differently by iterating over each objfile's matcher
list individually, but there's no data yet to show it's needed. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
+ gdbpy_ref<> py_objfile = objfile_to_objfile_object (&objfile);
if (py_objfile == NULL)
{
if (debug_base == 0)
debug_base = default_debug_base;
- for (objfile *objfile : m_pspace->objfiles ())
+ for (objfile &objfile : m_pspace->objfiles ())
{
- if (checked_current_objfile && objfile == current_objfile)
+ if (checked_current_objfile && &objfile == current_objfile)
continue;
/* Try to determine the namespace into which objfile was loaded.
If we fail, e.g. for manually added symbol files or for the main
executable, we assume that they were added to the initial
namespace. */
- const solib *solib = find_solib_for_objfile (objfile);
+ const solib *solib = find_solib_for_objfile (&objfile);
CORE_ADDR solib_base = find_debug_base_for_solib (solib);
if (solib_base == 0)
solib_base = default_debug_base;
if (solib_base != debug_base)
continue;
- if (cb (objfile))
+ if (cb (&objfile))
return;
}
}
(iterate_over_objfiles_in_search_order_cb_ftype cb,
objfile *current_objfile) const
{
- for (objfile *objfile : m_pspace->objfiles ())
- if (cb (objfile))
+ for (objfile &objfile : m_pspace->objfiles ())
+ if (cb (&objfile))
return;
}
{
/* Have we already loaded this shared object? */
so.objfile = nullptr;
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile->addr_low == so.addr_low)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (objfile.addr_low == so.addr_low)
{
- so.objfile = objfile;
+ so.objfile = &objfile;
break;
}
struct symtab *new_symtab = nullptr;
- for (objfile *ofp : current_program_space->objfiles ())
+ for (objfile &ofp : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : ofp->compunits ())
+ for (compunit_symtab *cu : ofp.compunits ())
{
for (symtab *symtab : cu->filetabs ())
{
if (new_symtab != nullptr)
return;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- symtab *s = objfile->find_last_source_symtab ();
+ symtab *s = objfile.find_last_source_symtab ();
if (s)
new_symtab = s;
}
forget_cached_source_info (void)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- objfile->forget_cached_source_info ();
+ for (objfile &objfile : pspace->objfiles ())
+ objfile.forget_cached_source_info ();
g_source_cache.clear ();
last_source_visited = NULL;
set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
if (debug_symfile)
{
- if (!symfile_debug_installed (objfile))
- install_symfile_debug_logging (objfile);
+ if (!symfile_debug_installed (&objfile))
+ install_symfile_debug_logging (&objfile);
}
else
{
- if (symfile_debug_installed (objfile))
- uninstall_symfile_debug_logging (objfile);
+ if (symfile_debug_installed (&objfile))
+ uninstall_symfile_debug_logging (&objfile);
}
}
}
CORE_ADDR addr = parse_and_eval_address (args);
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if ((objfile->flags & OBJF_USERLOADED) != 0
- && (objfile->flags & OBJF_SHARED) != 0
- && objfile->pspace () == current_program_space
- && is_addr_in_objfile (addr, objfile))
+ if ((objfile.flags & OBJF_USERLOADED) != 0
+ && (objfile.flags & OBJF_SHARED) != 0
+ && objfile.pspace () == current_program_space
+ && is_addr_in_objfile (addr, &objfile))
{
- objf = objfile;
+ objf = &objfile;
break;
}
}
if (filename.empty ())
error (_("remove-symbol-file: no symbol file provided"));
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if ((objfile->flags & OBJF_USERLOADED) != 0
- && (objfile->flags & OBJF_SHARED) != 0
- && objfile->pspace () == current_program_space
- && filename_cmp (filename.c_str (), objfile_name (objfile)) == 0)
+ if ((objfile.flags & OBJF_USERLOADED) != 0
+ && (objfile.flags & OBJF_SHARED) != 0
+ && objfile.pspace () == current_program_space
+ && filename_cmp (filename.c_str (), objfile_name (&objfile)) == 0)
{
- objf = objfile;
+ objf = &objfile;
break;
}
}
indicate when the executable was last reloaded. */
reopen_exec_file ();
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- if (objfile->obfd.get () == NULL)
+ if (objfile.obfd.get () == NULL)
continue;
/* Separate debug objfiles are handled in the main objfile. */
- if (objfile->separate_debug_objfile_backlink)
+ if (objfile.separate_debug_objfile_backlink)
continue;
/* When a in-memory BFD is initially created, it's mtime (as
about reloading BFDs that changed on disk.
Just skip any in-memory BFD. */
- if (objfile->obfd.get ()->flags & BFD_IN_MEMORY)
+ if (objfile.obfd.get ()->flags & BFD_IN_MEMORY)
continue;
struct stat new_statbuf;
- int res = gdb_bfd_stat (objfile->obfd.get (), &new_statbuf);
+ int res = gdb_bfd_stat (objfile.obfd.get (), &new_statbuf);
if (res != 0)
{
/* If this object is from an archive (what you usually create
though a `shared library' on AIX is also an archive), then you
should stat on the archive name, not member name. */
const char *filename;
- if (objfile->obfd->my_archive)
- filename = bfd_get_filename (objfile->obfd->my_archive);
+ if (objfile.obfd->my_archive)
+ filename = bfd_get_filename (objfile.obfd->my_archive);
else
- filename = objfile_name (objfile);
+ filename = objfile_name (&objfile);
warning (_("`%ps' has disappeared; keeping its symbols."),
styled_string (file_name_style.style (), filename));
continue;
}
time_t new_modtime = new_statbuf.st_mtime;
- if (new_modtime != objfile->mtime)
+ if (new_modtime != objfile.mtime)
{
gdb_printf (_("`%ps' has changed; re-reading symbols.\n"),
styled_string (file_name_style.style (),
- objfile_name (objfile)));
+ objfile_name (&objfile)));
/* There are various functions like symbol_file_add,
symfile_bfd_open, syms_from_objfile, etc., which might
/* If we get an error, blow away this objfile (not sure if
that is the correct response for things like shared
libraries). */
- scoped_objfile_unlinker objfile_holder (objfile);
+ scoped_objfile_unlinker objfile_holder (&objfile);
/* We need to do this whenever any symbols go away. */
clear_symtab_users_cleanup defer_clear_users (0);
/* Free the separate debug objfiles. It will be
automatically recreated by sym_read. */
- free_objfile_separate_debug (objfile);
+ free_objfile_separate_debug (&objfile);
/* Clear the stale source cache. */
forget_cached_source_info ();
/* Remove any references to this objfile in the global
value lists. */
- preserve_values (objfile);
+ preserve_values (&objfile);
/* Nuke all the state that we will re-read. Much of the following
code which sets things to NULL really is necessary to tell
Try to keep the freeing order compatible with free_objfile. */
- if (objfile->sf != NULL)
+ if (objfile.sf != NULL)
{
- (*objfile->sf->sym_finish) (objfile);
+ (*objfile.sf->sym_finish) (&objfile);
}
- objfile->registry_fields.clear_registry ();
+ objfile.registry_fields.clear_registry ();
/* Clean up any state BFD has sitting around. */
{
- gdb_bfd_ref_ptr obfd = objfile->obfd;
+ gdb_bfd_ref_ptr obfd = objfile.obfd;
const char *obfd_filename;
- obfd_filename = bfd_get_filename (objfile->obfd.get ());
+ obfd_filename = bfd_get_filename (objfile.obfd.get ());
/* Open the new BFD before freeing the old one, so that
the filename remains live. */
gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget));
- objfile->obfd = std::move (temp);
- if (objfile->obfd == NULL)
+ objfile.obfd = std::move (temp);
+ if (objfile.obfd == NULL)
error (_("Can't open %s to read symbols."), obfd_filename);
}
- std::string original_name = objfile->original_name;
+ std::string original_name = objfile.original_name;
/* bfd_openr sets cacheable to true, which is what we want. */
- if (!bfd_check_format (objfile->obfd.get (), bfd_object))
- error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
+ if (!bfd_check_format (objfile.obfd.get (), bfd_object))
+ error (_("Can't read symbols from %s: %s."), objfile_name (&objfile),
bfd_errmsg (bfd_get_error ()));
/* NB: after this call to obstack_free, objfiles_changed
will need to be called (see discussion below). */
- obstack_free (&objfile->objfile_obstack, 0);
- objfile->sections_start = NULL;
- objfile->section_offsets.clear ();
- objfile->sect_index_bss = -1;
- objfile->sect_index_data = -1;
- objfile->sect_index_rodata = -1;
- objfile->sect_index_text = -1;
- objfile->compunit_symtabs = NULL;
- objfile->template_symbols = NULL;
- objfile->static_links.clear ();
+ obstack_free (&objfile.objfile_obstack, 0);
+ objfile.sections_start = NULL;
+ objfile.section_offsets.clear ();
+ objfile.sect_index_bss = -1;
+ objfile.sect_index_data = -1;
+ objfile.sect_index_rodata = -1;
+ objfile.sect_index_text = -1;
+ objfile.compunit_symtabs = NULL;
+ objfile.template_symbols = NULL;
+ objfile.static_links.clear ();
/* obstack_init also initializes the obstack so it is
empty. We could use obstack_specify_allocation but
gdb_obstack.h specifies the alloc/dealloc functions. */
- obstack_init (&objfile->objfile_obstack);
+ obstack_init (&objfile.objfile_obstack);
/* set_objfile_per_bfd potentially allocates the per-bfd
data on the objfile's obstack (if sharing data across
multiple users is not possible), so it's important to
do it *after* the obstack has been initialized. */
- set_objfile_per_bfd (objfile);
+ set_objfile_per_bfd (&objfile);
- objfile->original_name
- = obstack_strdup (&objfile->objfile_obstack, original_name);
+ objfile.original_name
+ = obstack_strdup (&objfile.objfile_obstack, original_name);
/* Reset the sym_fns pointer. The ELF reader can change it
based on whether .gdb_index is present, and we need it to
start over. PR symtab/15885 */
- objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd.get ()));
- objfile->qf.clear ();
+ objfile_set_sym_fns (&objfile, find_sym_fns (objfile.obfd.get ()));
+ objfile.qf.clear ();
- build_objfile_section_table (objfile);
+ build_objfile_section_table (&objfile);
/* What the hell is sym_new_init for, anyway? The concept of
distinguishing between the main file and additional files
in this way seems rather dubious. */
- if (objfile == current_program_space->symfile_object_file)
+ if (&objfile == current_program_space->symfile_object_file)
{
- (*objfile->sf->sym_new_init) (objfile);
+ (*objfile.sf->sym_new_init) (&objfile);
}
- (*objfile->sf->sym_init) (objfile);
+ (*objfile.sf->sym_init) (&objfile);
clear_complaints ();
/* We are about to read new symbols and potentially also
objfiles_changed (current_program_space);
/* Recompute section offsets and section indices. */
- objfile->sf->sym_offsets (objfile, {});
+ objfile.sf->sym_offsets (&objfile, {});
- read_symbols (objfile, 0);
+ read_symbols (&objfile, 0);
- if ((objfile->flags & OBJF_READNOW))
+ if ((objfile.flags & OBJF_READNOW))
{
- const int mainline = objfile->flags & OBJF_MAINLINE;
+ const int mainline = objfile.flags & OBJF_MAINLINE;
const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
&& readnow_symbol_files);
if (should_print)
gdb_printf (_("Expanding full symbols from %ps...\n"),
styled_string (file_name_style.style (),
- objfile_name (objfile)));
+ objfile_name (&objfile)));
- objfile->expand_all_symtabs ();
+ objfile.expand_all_symtabs ();
}
- if (!objfile->has_symbols ())
+ if (!objfile.has_symbols ())
{
gdb_stdout->wrap_here (0);
gdb_printf (_("(no debugging symbols found)\n"));
/* If the mtime has changed between the time we set new_modtime
and now, we *want* this to be out of date, so don't call stat
again now. */
- objfile->mtime = new_modtime;
- init_entry_point_info (objfile);
+ objfile.mtime = new_modtime;
+ init_entry_point_info (&objfile);
- new_objfiles.push_back (objfile);
+ new_objfiles.push_back (&objfile);
}
}
static void
overlay_invalidate_all (program_space *pspace)
{
- for (objfile *objfile : pspace->objfiles ())
- for (obj_section § : objfile->sections ())
+ for (objfile &objfile : pspace->objfiles ())
+ for (obj_section § : objfile.sections ())
if (section_is_overlay (§))
sect.ovly_mapped = -1;
}
if (overlay_debugging)
{
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &osect : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
if (section_is_overlay (&osect))
{
if (pc_in_mapped_range (pc, &osect))
{
if (overlay_debugging)
{
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &osect : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
if (pc_in_mapped_range (pc, &osect) && section_is_mapped (&osect))
return &osect;
}
if (overlay_debugging)
{
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &osect : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &osect : objfile.sections ())
if (section_is_mapped (&osect))
{
- struct gdbarch *gdbarch = objfile->arch ();
+ struct gdbarch *gdbarch = objfile.arch ();
const char *name;
bfd_vma lma, vma;
int size;
error (_("Argument required: name of an overlay section"));
/* First, find a section matching the user supplied argument. */
- for (objfile *obj_file : current_program_space->objfiles ())
- for (obj_section &sec : obj_file->sections ())
+ for (objfile &obj_file : current_program_space->objfiles ())
+ for (obj_section &sec : obj_file.sections ())
if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
/* Next, make a pass and unmap any sections that are
overlapped by this new section: */
- for (objfile *objfile2 : current_program_space->objfiles ())
- for (obj_section &sec2 : objfile2->sections ())
+ for (objfile &objfile2 : current_program_space->objfiles ())
+ for (obj_section &sec2 : objfile2.sections ())
if (sec2.ovly_mapped && &sec != &sec2 && sections_overlap (&sec,
&sec2))
{
error (_("Argument required: name of an overlay section"));
/* First, find a section matching the user supplied argument. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section &sec : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section &sec : objfile.sections ())
if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
{
if (!sec.ovly_mapped)
return;
/* Now may as well update all sections, even if only one was requested. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section § : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section § : objfile.sections ())
if (section_is_overlay (§))
{
int i;
void
map_symbol_filenames (symbol_filename_listener fun, bool need_fullname)
{
- for (objfile *objfile : current_program_space->objfiles ())
- objfile->map_symbol_filenames (fun, need_fullname);
+ for (objfile &objfile : current_program_space->objfiles ())
+ objfile.map_symbol_filenames (fun, need_fullname);
}
#if GDB_SELF_TEST
int i, linetables, blockvectors;
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
QUIT;
- gdb_printf (_("Statistics for '%s':\n"), objfile_name (objfile));
- if (OBJSTAT (objfile, n_stabs) > 0)
+ gdb_printf (_("Statistics for '%s':\n"), objfile_name (&objfile));
+ if (OBJSTAT ((&objfile), n_stabs) > 0)
gdb_printf (_(" Number of \"stab\" symbols read: %d\n"),
- OBJSTAT (objfile, n_stabs));
- if (objfile->per_bfd->n_minsyms > 0)
+ OBJSTAT ((&objfile), n_stabs));
+ if (objfile.per_bfd->n_minsyms > 0)
gdb_printf (_(" Number of \"minimal\" symbols read: %d\n"),
- objfile->per_bfd->n_minsyms);
- if (OBJSTAT (objfile, n_syms) > 0)
+ objfile.per_bfd->n_minsyms);
+ if (OBJSTAT ((&objfile), n_syms) > 0)
gdb_printf (_(" Number of \"full\" symbols read: %d\n"),
- OBJSTAT (objfile, n_syms));
- if (OBJSTAT (objfile, n_types) > 0)
+ OBJSTAT ((&objfile), n_syms));
+ if (OBJSTAT ((&objfile), n_types) > 0)
gdb_printf (_(" Number of \"types\" defined: %d\n"),
- OBJSTAT (objfile, n_types));
+ OBJSTAT ((&objfile), n_types));
i = linetables = 0;
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab *cu : objfile.compunits ())
{
for (symtab *s : cu->filetabs ())
{
linetables++;
}
}
- blockvectors = std::distance (objfile->compunits ().begin (),
- objfile->compunits ().end ());
+ blockvectors = std::distance (objfile.compunits ().begin (),
+ objfile.compunits ().end ());
gdb_printf (_(" Number of symbol tables: %d\n"), i);
gdb_printf (_(" Number of symbol tables with line tables: %d\n"),
linetables);
gdb_printf (_(" Number of symbol tables with blockvectors: %d\n"),
blockvectors);
- objfile->print_stats (false);
+ objfile.print_stats (false);
- if (OBJSTAT (objfile, sz_strtab) > 0)
+ if (OBJSTAT ((&objfile), sz_strtab) > 0)
gdb_printf (_(" Space used by string tables: %d\n"),
- OBJSTAT (objfile, sz_strtab));
+ OBJSTAT ((&objfile), sz_strtab));
gdb_printf (_(" Total memory used for objfile obstack: %s\n"),
pulongest (obstack_memory_used (&objfile
- ->objfile_obstack)));
+ .objfile_obstack)));
gdb_printf (_(" Total memory used for BFD obstack: %s\n"),
- pulongest (obstack_memory_used (&objfile->per_bfd
+ pulongest (obstack_memory_used (&objfile.per_bfd
->storage_obstack)));
gdb_printf (_(" Total memory used for string cache: %d\n"),
- objfile->per_bfd->string_cache.memory_used ());
+ objfile.per_bfd->string_cache.memory_used ());
gdb_printf (_("Byte cache statistics for '%s':\n"),
- objfile_name (objfile));
- objfile->per_bfd->string_cache.print_statistics ("string cache");
- objfile->print_stats (true);
+ objfile_name (&objfile));
+ objfile.per_bfd->string_cache.print_statistics ("string cache");
+ objfile.print_stats (true);
}
}
{
int found = 0;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
int print_for_objfile = 1;
if (objfile_arg != NULL)
print_for_objfile
- = compare_filenames_for_search (objfile_name (objfile),
+ = compare_filenames_for_search (objfile_name (&objfile),
objfile_arg);
if (!print_for_objfile)
continue;
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab *cu : objfile.compunits ())
{
for (symtab *s : cu->filetabs ())
{
outfile = &arg_outfile;
}
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
QUIT;
if (objfile_arg == NULL
- || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
- dump_msymbols (objfile, outfile);
+ || compare_filenames_for_search (objfile_name (&objfile), objfile_arg))
+ dump_msymbols (&objfile, outfile);
}
}
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
QUIT;
if (! regexp
- || re_exec (objfile_name (objfile)))
- dump_objfile (objfile);
+ || re_exec (objfile_name (&objfile)))
+ dump_objfile (&objfile);
}
}
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
/* We don't want to print anything for this objfile until we
actually find a symtab whose name matches. */
int printed_objfile_start = 0;
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab *cust : objfile.compunits ())
{
int printed_compunit_symtab_start = 0;
{
if (! printed_objfile_start)
{
- gdb_printf ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (&objfile));
gdb_stdout->wrap_here (2);
gdb_printf ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ host_address_to_string (&objfile));
printed_objfile_start = 1;
}
if (! printed_compunit_symtab_start)
maintenance_check_symtabs (const char *ignore, int from_tty)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
/* We don't want to print anything for this objfile until we
actually find something worth printing. */
int printed_objfile_start = 0;
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab *cust : objfile.compunits ())
{
int found_something = 0;
struct symtab *symtab = cust->primary_filetab ();
{
if (! printed_objfile_start)
{
- gdb_printf ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (&objfile));
gdb_stdout->wrap_here (2);
gdb_printf ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ host_address_to_string (&objfile));
printed_objfile_start = 1;
}
gdb_printf (" { symtab %s\n",
if (regexp == nullptr)
{
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- objfile->expand_all_symtabs ();
+ for (objfile &objfile : pspace->objfiles ())
+ objfile.expand_all_symtabs ();
return;
}
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- objfile->search
+ for (objfile &objfile : pspace->objfiles ())
+ objfile.search
([&] (const char *filename, bool basenames)
{
/* KISS: Only apply the regexp to the complete file name. */
re_comp (regexp);
for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
{
- for (compunit_symtab *cust : objfile->compunits ())
+ for (compunit_symtab *cust : objfile.compunits ())
{
for (symtab *symtab : cust->filetabs ())
{
gdb_assert (IS_ABSOLUTE_PATH (real_path.get ()));
}
- for (objfile *objfile : pspace->objfiles ())
+ for (objfile &objfile : pspace->objfiles ())
if (iterate_over_some_symtabs (name, real_path.get (),
- objfile->compunit_symtabs, nullptr,
+ objfile.compunit_symtabs, nullptr,
callback))
return;
/* Same search rules as above apply here, but now we look through the
psymtabs. */
- for (objfile *objfile : pspace->objfiles ())
- if (objfile->map_symtabs_matching_filename (name, real_path.get (),
+ for (objfile &objfile : pspace->objfiles ())
+ if (objfile.map_symtabs_matching_filename (name, real_path.get (),
callback))
return;
}
/* Otherwise check that they are in corresponding objfiles. */
struct objfile *obj = NULL;
- for (objfile *objfile : current_program_space->objfiles ())
- if (objfile->obfd == first->owner)
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (objfile.obfd == first->owner)
{
- obj = objfile;
+ obj = &objfile;
break;
}
gdb_assert (obj != NULL);
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
/* Search all the global symbols. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK,
+ t = basic_lookup_transparent_type_quick (&objfile, GLOBAL_BLOCK,
flags, lookup_name);
if (t)
return t;
/* Now search the static file-level symbols. Not strictly correct,
but more useful than an error. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK,
+ t = basic_lookup_transparent_type_quick (&objfile, STATIC_BLOCK,
flags, lookup_name);
if (t)
return t;
It also happens for objfiles that have their functions reordered.
For these, the symtab we are looking for is not necessarily read in. */
- for (objfile *obj_file : current_program_space->objfiles ())
+ for (objfile &obj_file : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : obj_file->compunits ())
+ for (compunit_symtab *cust : obj_file.compunits ())
{
const struct blockvector *bv = cust->blockvector ();
const struct block *global_block = bv->global_block ();
stabs and coff debugging info, we continue on if a psymtab
can't be found. */
struct compunit_symtab *result
- = obj_file->find_pc_sect_compunit_symtab (msymbol, pc,
- section, 0);
+ = obj_file.find_pc_sect_compunit_symtab (msymbol, pc,
+ section, 0);
if (result != nullptr)
return result;
const struct block *b = bv->block (b_index);
for (struct symbol *sym : block_iterator_range (b))
{
- if (matching_obj_sections (sym->obj_section (obj_file),
+ if (matching_obj_sections (sym->obj_section (&obj_file),
section))
{
found_sym = sym;
/* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs). */
- for (objfile *objf : current_program_space->objfiles ())
+ for (objfile &objf : current_program_space->objfiles ())
{
struct compunit_symtab *result
- = objf->find_pc_sect_compunit_symtab (msymbol, pc, section, 1);
+ = objf.find_pc_sect_compunit_symtab (msymbol, pc, section, 1);
if (result != NULL)
return result;
}
return nullptr;
};
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* If this objfile was read with -readnow, then we need to
search the symtabs directly. */
- if ((objfile->flags & OBJF_READNOW) != 0)
+ if ((objfile.flags & OBJF_READNOW) != 0)
{
- for (compunit_symtab *symtab : objfile->compunits ())
+ for (compunit_symtab *symtab : objfile.compunits ())
{
struct symbol *sym = search_symtab (symtab, address);
if (sym != nullptr)
else
{
struct compunit_symtab *symtab
- = objfile->find_compunit_symtab_by_address (address);
+ = objfile.find_compunit_symtab_by_address (address);
if (symtab != NULL)
{
struct symbol *sym = search_symtab (symtab, address);
else
best = 0;
- for (objfile *objfile : current_program_space->objfiles ())
- objfile->expand_symtabs_with_fullname (symtab_to_fullname (sym_tab));
+ for (objfile &objfile : current_program_space->objfiles ())
+ objfile.expand_symtabs_with_fullname (symtab_to_fullname (sym_tab));
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab *cu : objfile.compunits ())
{
for (symtab *s : cu->filetabs ())
{
gdb_assert (group_by_objfile || uiout->is_mi_like_p ());
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
if (group_by_objfile)
{
output_tuple.emplace (uiout, nullptr);
- uiout->field_string ("filename", objfile_name (objfile),
+ uiout->field_string ("filename", objfile_name (&objfile),
file_name_style.style ());
uiout->text (":\n");
- bool debug_fully_readin = !objfile->has_unexpanded_symtabs ();
+ bool debug_fully_readin = !objfile.has_unexpanded_symtabs ();
if (uiout->is_mi_like_p ())
{
const char *debug_info_state;
- if (objfile->has_symbols ())
+ if (objfile.has_symbols ())
{
if (debug_fully_readin)
debug_info_state = "fully-read";
if (!debug_fully_readin)
uiout->text ("(Full debug information has not yet been read "
"for this file.)\n");
- if (!objfile->has_symbols ())
+ if (!objfile.has_symbols ())
uiout->text ("(Objfile has no debug information.)\n");
uiout->text ("\n");
}
sources_list.emplace (uiout, "sources");
}
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab *cu : objfile.compunits ())
{
for (symtab *s : cu->filetabs ())
{
if (group_by_objfile)
{
- objfile->map_symbol_filenames (data, true /* need_fullname */);
+ objfile.map_symbol_filenames (data, true /* need_fullname */);
if (data.printed_filename_p ())
uiout->text ("\n\n");
data.reset_output ();
bool found_msymbol = false;
std::set<symbol_search> result_set;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* Expand symtabs within objfile that possibly contain matching
symbols. */
- found_msymbol |= expand_symtabs (objfile, preg);
+ found_msymbol |= expand_symtabs (&objfile, preg);
/* Find matching symbols within OBJFILE and add them in to the
RESULT_SET set. Use a set here so that we can easily detect
duplicates as we go, and can therefore track how many unique
matches we have found so far. */
- if (!add_matching_symbols (objfile, preg, treg, &result_set))
+ if (!add_matching_symbols (&objfile, preg, treg, &result_set))
break;
}
{
gdb_assert ((m_kind & (SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN))
!= 0);
- for (objfile *objfile : current_program_space->objfiles ())
- if (!add_matching_msymbols (objfile, preg, &result))
+ for (objfile &objfile : current_program_space->objfiles ())
+ if (!add_matching_msymbols (&objfile, preg, &result))
break;
}
if (code == TYPE_CODE_UNDEF)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (minimal_symbol *msymbol : objfile->msymbols ())
+ for (minimal_symbol *msymbol : objfile.msymbols ())
{
QUIT;
}
/* Add completions for all currently loaded symbol tables. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
/* Look through the partial symtabs for all symbols which begin by
matching SYM_TEXT. Expand all CUs that you find to the list. */
- objfile->search
+ objfile.search
(nullptr, &lookup_name, nullptr,
[&] (compunit_symtab *symtab)
{
filename_seen_cache filenames_seen;
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cu : objfile->compunits ())
+ for (compunit_symtab *cu : objfile.compunits ())
{
for (symtab *s : cu->filetabs ())
{
relies on the order of objfile creation -- which still isn't
guaranteed to get the correct answer, but is just probably more
accurate. */
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile &objfile : current_program_space->objfiles ())
{
- objfile->compute_main_name ();
+ objfile.compute_main_name ();
- if (objfile->per_bfd->name_of_main != NULL)
+ if (objfile.per_bfd->name_of_main != NULL)
{
set_main_name (pspace,
- objfile->per_bfd->name_of_main,
- objfile->per_bfd->language_of_main);
+ objfile.per_bfd->name_of_main,
+ objfile.per_bfd->language_of_main);
return;
}
}
return;
}
- for (objfile *objfile : m_pspace->objfiles ())
- if (objfile != current_objfile)
+ for (objfile &objfile : m_pspace->objfiles ())
+ if (&objfile != current_objfile)
{
- if (cb (objfile))
+ if (cb (&objfile))
return;
}
}
i = 0;
/* we have interest for sections with same VMA */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section § : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section § : objfile.sections ())
if (section_is_overlay (§))
{
sect.ovly_mapped = (lma == bfd_section_lma (sect.the_bfd_section));
return;
/* Update all sections, even if only one was requested. */
- for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section § : objfile->sections ())
+ for (objfile &objfile : current_program_space->objfiles ())
+ for (obj_section § : objfile.sections ())
{
if (!section_is_overlay (§))
continue;