Make the current_program_space reference bubble up one level.
Change-Id: Ic349dc96b7d375ad7c66022d84657136f0de8c87
Reviewed-by: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
#include "symtab.h"
#include "value.h"
#include "dwarf2/loc.h"
+#include "objfiles.h"
/* Helper to get the imported symbol's real name. */
static const char *
ada_imported_read_variable (struct symbol *symbol, const frame_info_ptr &frame)
{
const char *name = get_imported_name (symbol);
- bound_minimal_symbol minsym = lookup_minimal_symbol_linkage (name, false);
+ bound_minimal_symbol minsym
+ = lookup_minimal_symbol_linkage (symbol->objfile ()->pspace (), name, false);
if (minsym.minsym == nullptr)
error (_("could not find imported name %s"), name);
return value_at (symbol->type (), minsym.value_address ());
/* See minsyms.h. */
bound_minimal_symbol
-lookup_minimal_symbol_linkage (const char *name, bool only_main)
+lookup_minimal_symbol_linkage (program_space *pspace, const char *name,
+ bool only_main)
{
- for (objfile *objfile : current_program_space->objfiles ())
+ for (objfile *objfile : pspace->objfiles ())
{
if (objfile->separate_debug_objfile_backlink != nullptr)
continue;
ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
/* A variant of lookup_minimal_symbol_linkage that iterates over all
- objfiles. If ONLY_MAIN is true, then only an objfile with
+ objfiles of PSPACE. If ONLY_MAIN is true, then only an objfile with
OBJF_MAINLINE will be considered. */
-extern bound_minimal_symbol lookup_minimal_symbol_linkage (const char *name,
- bool only_main)
+extern bound_minimal_symbol lookup_minimal_symbol_linkage
+ (program_space *pspace, const char *name, bool only_main)
ATTRIBUTE_NONNULL (1);
/* Look through all the current minimal symbol tables and find the
gdb_assert (this->aclass () == LOC_STATIC);
const char *linkage_name = this->linkage_name ();
- bound_minimal_symbol minsym = lookup_minimal_symbol_linkage (linkage_name,
- false);
+ bound_minimal_symbol minsym
+ = lookup_minimal_symbol_linkage (this->objfile ()->pspace (), linkage_name,
+ false);
if (minsym.minsym != nullptr)
return minsym.value_address ();
+
return this->m_value.address;
}
gdb_assert ((objf->flags & OBJF_MAINLINE) == 0);
const char *linkage_name = this->linkage_name ();
- bound_minimal_symbol found = lookup_minimal_symbol_linkage (linkage_name,
- true);
+ bound_minimal_symbol found
+ = lookup_minimal_symbol_linkage (objf->pspace (), linkage_name, true);
if (found.minsym != nullptr)
return found.value_address ();
+
return (this->m_value.address
+ objf->section_offsets[this->section_index ()]);
}