forked from Imagelibrary/binutils-gdb
gdb: add program_space parameter to lookup_minimal_symbol_linkage
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>
This commit is contained in:
committed by
Simon Marchi
parent
3b996cc7ae
commit
2e7c4d0fe5
@@ -20,6 +20,7 @@
|
||||
#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 *
|
||||
@@ -34,7 +35,8 @@ static struct value *
|
||||
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 ());
|
||||
|
||||
@@ -584,9 +584,10 @@ lookup_minimal_symbol_linkage (const char *name, struct objfile *objf)
|
||||
/* 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;
|
||||
|
||||
@@ -234,11 +234,11 @@ extern bound_minimal_symbol lookup_minimal_symbol_linkage (const char *name,
|
||||
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
|
||||
|
||||
11
gdb/symtab.c
11
gdb/symtab.c
@@ -6775,10 +6775,12 @@ symbol::get_maybe_copied_address () const
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -6791,10 +6793,11 @@ minimal_symbol::get_maybe_copied_address (objfile *objf) const
|
||||
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 ()]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user