@@ -13884,7 +13884,7 @@ static struct cmd_list_element *show_ada_list;
static void
ada_new_objfile_observer (struct objfile *objfile)
{
- ada_clear_symbol_cache (objfile->pspace);
+ ada_clear_symbol_cache (objfile->pspace ());
}
/* This module's 'free_objfile' observer. */
@@ -13892,7 +13892,7 @@ ada_new_objfile_observer (struct objfile *objfile)
static void
ada_free_objfile_observer (struct objfile *objfile)
{
- ada_clear_symbol_cache (objfile->pspace);
+ ada_clear_symbol_cache (objfile->pspace ());
}
/* Charsets known to GNAT. */
@@ -1495,7 +1495,7 @@ ada_tasks_clear_pspace_data (program_space *pspace)
static void
ada_tasks_new_objfile_observer (objfile *objfile)
{
- ada_tasks_clear_pspace_data (objfile->pspace);
+ ada_tasks_clear_pspace_data (objfile->pspace ());
}
/* The qcs command line flags for the "task apply" commands. Keep
@@ -457,7 +457,7 @@ annotate_source_line (struct symtab *s, int line, int mid_statement,
/* Update the current symtab and line. */
symtab_and_line sal;
- sal.pspace = s->compunit ()->objfile ()->pspace;
+ sal.pspace = s->compunit ()->objfile ()->pspace ();
sal.symtab = s;
sal.line = line;
set_current_source_symtab_and_line (sal);
@@ -783,7 +783,7 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
/* Add this script to the hash table too so
"info auto-load ${lang}-scripts" can print it. */
pspace_info
- = get_auto_load_pspace_data_for_loading (objfile->pspace);
+ = get_auto_load_pspace_data_for_loading (objfile->pspace ());
maybe_add_script_file (pspace_info, is_safe, debugfile, debugfile,
language);
@@ -1048,7 +1048,7 @@ source_section_scripts (struct objfile *objfile, const char *section_name,
const char *start, const char *end)
{
auto_load_pspace_info *pspace_info
- = get_auto_load_pspace_data_for_loading (objfile->pspace);
+ = get_auto_load_pspace_data_for_loading (objfile->pspace ());
for (const char *p = start; p < end; ++p)
{
@@ -8092,7 +8092,7 @@ disable_breakpoints_in_freed_objfile (struct objfile *objfile)
if (loc.shlib_disabled != 0)
continue;
- if (objfile->pspace != loc.pspace)
+ if (objfile->pspace () != loc.pspace)
continue;
if (loc.loc_type != bp_loc_hardware_breakpoint
@@ -250,7 +250,7 @@ gdbscm_objfile_progspace (SCM self)
objfile_smob *o_smob
= ofscm_get_valid_objfile_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- return psscm_scm_from_pspace (o_smob->objfile->pspace);
+ return psscm_scm_from_pspace (o_smob->objfile->pspace ());
}
/* (objfile-pretty-printers <gdb:objfile>) -> list
@@ -2172,7 +2172,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
for (const auto &sym : ls->labels.label_symbols)
{
struct program_space *pspace
- = sym.symbol->symtab ()->compunit ()->objfile ()->pspace;
+ = sym.symbol->symtab ()->compunit ()->objfile ()->pspace ();
if (symbol_to_sal (&sal, state->funfirstline, sym.symbol)
&& maybe_add_address (state->addr_set, pspace, sal.pc))
@@ -2194,7 +2194,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
for (const auto &sym : ls->function_symbols)
{
program_space *pspace
- = sym.symbol->symtab ()->compunit ()->objfile ()->pspace;
+ = sym.symbol->symtab ()->compunit ()->objfile ()->pspace ();
set_current_program_space (pspace);
/* Don't skip to the first line of the function if we
@@ -2256,7 +2256,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
for (const auto &elem : ls->minimal_symbols)
{
- program_space *pspace = elem.objfile->pspace;
+ program_space *pspace = elem.objfile->pspace ();
set_current_program_space (pspace);
minsym_found (state, elem.objfile, elem.minsym, &sals);
}
@@ -3437,7 +3437,7 @@ lookup_prefix_sym (struct linespec_state *state,
{
/* Program spaces that are executing startup should have
been filtered out earlier. */
- program_space *pspace = elt->compunit ()->objfile ()->pspace;
+ program_space *pspace = elt->compunit ()->objfile ()->pspace ();
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
@@ -3459,8 +3459,8 @@ compare_symbols (const block_symbol &a, const block_symbol &b)
{
uintptr_t uia, uib;
- uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace;
- uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace;
+ uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace ();
+ uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace ();
if (uia < uib)
return true;
@@ -3483,8 +3483,8 @@ compare_msymbols (const bound_minimal_symbol &a, const bound_minimal_symbol &b)
{
uintptr_t uia, uib;
- uia = (uintptr_t) a.objfile->pspace;
- uib = (uintptr_t) a.objfile->pspace;
+ uia = (uintptr_t) a.objfile->pspace ();
+ uib = (uintptr_t) a.objfile->pspace ();
if (uia < uib)
return true;
@@ -3584,7 +3584,7 @@ find_method (struct linespec_state *self,
/* Program spaces that are executing startup should have
been filtered out earlier. */
- pspace = sym->symtab ()->compunit ()->objfile ()->pspace;
+ pspace = sym->symtab ()->compunit ()->objfile ()->pspace ();
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
t = check_typedef (sym->type ());
@@ -3596,7 +3596,7 @@ find_method (struct linespec_state *self,
if (ix == sym_classes->size () - 1
|| (pspace
!= (sym_classes->at (ix + 1).symbol->symtab ()
- ->compunit ()->objfile ()->pspace)))
+ ->compunit ()->objfile ()->pspace ())))
{
/* If we did not find a direct implementation anywhere in
this program space, consider superclasses. */
@@ -3963,7 +3963,7 @@ find_label_symbols (struct linespec_state *self,
{
fn_sym = elt.symbol;
set_current_program_space
- (fn_sym->symtab ()->compunit ()->objfile ()->pspace);
+ (fn_sym->symtab ()->compunit ()->objfile ()->pspace ());
block = fn_sym->value_block ();
find_label_symbols_in_block (block, name, fn_sym, completion_mode,
@@ -3992,7 +3992,7 @@ decode_digits_list_mode (struct linespec_state *self,
/* The logic above should ensure this. */
gdb_assert (elt != NULL);
- program_space *pspace = elt->compunit ()->objfile ()->pspace;
+ program_space *pspace = elt->compunit ()->objfile ()->pspace ();
set_current_program_space (pspace);
/* Simplistic search just for the list command. */
@@ -4027,7 +4027,7 @@ decode_digits_ordinary (struct linespec_state *self,
/* The logic above should ensure this. */
gdb_assert (elt != NULL);
- program_space *pspace = elt->compunit ()->objfile ()->pspace;
+ program_space *pspace = elt->compunit ()->objfile ()->pspace ();
set_current_program_space (pspace);
pcs = find_pcs_for_symtab_line (elt, line, best_entry);
@@ -4153,7 +4153,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
sal.section = msymbol->obj_section (objfile);
- if (maybe_add_address (self->addr_set, objfile->pspace, sal.pc))
+ if (maybe_add_address (self->addr_set, objfile->pspace (), sal.pc))
add_sal_to_sals (self, result, &sal, msymbol->natural_name (), 0);
}
@@ -4228,7 +4228,7 @@ search_minsyms_for_name (struct collect_info *info,
}
else
{
- program_space *pspace = symtab->compunit ()->objfile ()->pspace;
+ program_space *pspace = symtab->compunit ()->objfile ()->pspace ();
if (search_pspace == NULL || pspace == search_pspace)
{
@@ -4322,13 +4322,13 @@ add_matching_symbols_to_info (const char *name,
{ return info->add_symbol (bsym); });
search_minsyms_for_name (info, lookup_name, pspace, NULL);
}
- else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace)
+ else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace ())
{
int prev_len = info->result.symbols->size ();
/* Program spaces that are executing startup should have
been filtered out earlier. */
- program_space *elt_pspace = elt->compunit ()->objfile ()->pspace;
+ program_space *elt_pspace = elt->compunit ()->objfile ()->pspace ();
gdb_assert (!elt_pspace->executing_startup);
set_current_program_space (elt_pspace);
iterate_over_file_blocks (elt, lookup_name, SEARCH_VFT,
@@ -4369,7 +4369,7 @@ symbol_to_sal (struct symtab_and_line *result,
result->symbol = sym;
result->line = sym->line ();
result->pc = sym->value_address ();
- result->pspace = result->symtab->compunit ()->objfile ()->pspace;
+ result->pspace = result->symtab->compunit ()->objfile ()->pspace ();
result->explicit_pc = 1;
return 1;
}
@@ -4385,7 +4385,7 @@ symbol_to_sal (struct symtab_and_line *result,
result->symbol = sym;
result->line = sym->line ();
result->pc = sym->value_address ();
- result->pspace = result->symtab->compunit ()->objfile ()->pspace;
+ result->pspace = result->symtab->compunit ()->objfile ()->pspace ();
return 1;
}
}
@@ -308,7 +308,7 @@ build_objfile_section_table (struct objfile *objfile)
objfile::objfile (gdb_bfd_ref_ptr bfd_, const char *name, objfile_flags flags_)
: flags (flags_),
- pspace (current_program_space),
+ m_pspace (current_program_space),
obfd (std::move (bfd_))
{
const char *expanded_name;
@@ -568,7 +568,7 @@ objfile::~objfile ()
}
/* Rebuild section map next time we need it. */
- get_objfile_pspace_data (pspace)->section_map_dirty = 1;
+ get_objfile_pspace_data (m_pspace)->section_map_dirty = 1;
}
@@ -646,7 +646,7 @@ objfile_relocate1 (struct objfile *objfile,
objfile->section_offsets[i] = new_offsets[i];
/* Rebuild section map next time we need it. */
- get_objfile_pspace_data (objfile->pspace)->section_map_dirty = 1;
+ get_objfile_pspace_data (objfile->pspace ())->section_map_dirty = 1;
/* Update the table in exec_ops, used to read memory. */
for (obj_section *s : objfile->sections ())
@@ -445,6 +445,9 @@ struct objfile
DISABLE_COPY_AND_ASSIGN (objfile);
+ /* Return the program space associated with this objfile. */
+ program_space *pspace () { return m_pspace; }
+
/* A range adapter that makes it possible to iterate over all
compunits in one objfile. */
@@ -716,10 +719,12 @@ struct objfile
objfile_flags flags;
+private:
/* The program space associated with this objfile. */
- struct program_space *pspace;
+ program_space *m_pspace;
+public:
/* List of compunits.
These are used to do symbol lookups and file/line-number lookups. */
@@ -2294,11 +2294,11 @@ disable_display_command (const char *args, int from_tty)
static void
clear_dangling_display_expressions (struct objfile *objfile)
{
- program_space *pspace = objfile->pspace;
+ program_space *pspace = objfile->pspace ();
if (objfile->separate_debug_objfile_backlink)
{
objfile = objfile->separate_debug_objfile_backlink;
- gdb_assert (objfile->pspace == pspace);
+ gdb_assert (objfile->pspace () == pspace);
}
for (auto &d : all_displays)
@@ -183,7 +183,7 @@ objfpy_get_progspace (PyObject *self, void *closure)
objfile_object *obj = (objfile_object *) self;
if (obj->objfile)
- return pspace_to_pspace_object (obj->objfile->pspace).release ();
+ return pspace_to_pspace_object (obj->objfile->pspace ()).release ();
Py_RETURN_NONE;
}
@@ -15444,7 +15444,7 @@ remote_objfile_changed_check_symbols (program_space *pspace)
static void
remote_new_objfile (struct objfile *objfile)
{
- remote_objfile_changed_check_symbols (objfile->pspace);
+ remote_objfile_changed_check_symbols (objfile->pspace ());
}
/* Pull all the tracepoints defined on the target and create local
@@ -1496,7 +1496,7 @@ svr4_current_sos ()
CORE_ADDR
svr4_fetch_objfile_link_map (struct objfile *objfile)
{
- struct svr4_info *info = get_svr4_info (objfile->pspace);
+ struct svr4_info *info = get_svr4_info (objfile->pspace ());
/* Cause svr4_current_sos() to be run if it hasn't been already. */
if (info->main_lm_addr == 0)
@@ -1625,7 +1625,7 @@ probes_table_htab_remove_objfile_probes (void **slot, void *info)
struct objfile *objfile = (struct objfile *) info;
if (pa->objfile == objfile)
- htab_clear_slot (get_svr4_info (objfile->pspace)->probes_table.get (),
+ htab_clear_slot (get_svr4_info (objfile->pspace ())->probes_table.get (),
slot);
return 1;
@@ -1636,7 +1636,7 @@ probes_table_htab_remove_objfile_probes (void **slot, void *info)
static void
probes_table_remove_objfile_probes (struct objfile *objfile)
{
- svr4_info *info = get_svr4_info (objfile->pspace);
+ svr4_info *info = get_svr4_info (objfile->pspace ());
if (info->probes_table != nullptr)
htab_traverse_noresize (info->probes_table.get (),
probes_table_htab_remove_objfile_probes, objfile);
@@ -1700,7 +1700,7 @@ remove_user_added_objfile (struct objfile *objfile)
{
if (objfile->flags & OBJF_USERLOADED)
{
- for (solib &so : objfile->pspace->solibs ())
+ for (solib &so : objfile->pspace ()->solibs ())
if (so.objfile == objfile)
so.objfile = nullptr;
}
@@ -2387,7 +2387,7 @@ remove_symbol_file_command (const char *args, int from_tty)
{
if ((objfile->flags & OBJF_USERLOADED) != 0
&& (objfile->flags & OBJF_SHARED) != 0
- && objfile->pspace == pspace
+ && objfile->pspace () == pspace
&& is_addr_in_objfile (addr, objfile))
{
objf = objfile;
@@ -2408,7 +2408,7 @@ remove_symbol_file_command (const char *args, int from_tty)
{
if ((objfile->flags & OBJF_USERLOADED) != 0
&& (objfile->flags & OBJF_SHARED) != 0
- && objfile->pspace == pspace
+ && objfile->pspace () == pspace
&& filename_cmp (filename.get (), objfile_name (objfile)) == 0)
{
objf = objfile;
@@ -3722,7 +3722,7 @@ static void
symfile_free_objfile (struct objfile *objfile)
{
/* Remove the target sections owned by this objfile. */
- objfile->pspace->remove_target_sections (objfile);
+ objfile->pspace ()->remove_target_sections (objfile);
}
/* Wrapper around the quick_symbol_functions expand_symtabs_matching "method".
@@ -1755,7 +1755,7 @@ maintenance_print_symbol_cache_statistics (const char *args, int from_tty)
static void
symtab_new_objfile_observer (struct objfile *objfile)
{
- symbol_cache_flush (objfile->pspace);
+ symbol_cache_flush (objfile->pspace ());
}
/* This module's 'all_objfiles_removed' observer. */
@@ -1774,7 +1774,7 @@ symtab_all_objfiles_removed (program_space *pspace)
static void
symtab_free_objfile_observer (struct objfile *objfile)
{
- symbol_cache_flush (objfile->pspace);
+ symbol_cache_flush (objfile->pspace ());
}
/* See symtab.h. */