mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 09:14:14 +08:00
Remove quick_symbol_functions::relocated
quick_symbol_functions::relocated is only needed for psymtabs, and there it is only needed for Rust. However, because we've switched the DWARF reader away from psymtabs, this means there's no longer a need for this method at all.
This commit is contained in:
@ -667,10 +667,6 @@ objfile_relocate1 (struct objfile *objfile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify the quick symbol object. */
|
|
||||||
for (const auto &iter : objfile->qf)
|
|
||||||
iter->relocated ();
|
|
||||||
|
|
||||||
/* Relocate isolated symbols. */
|
/* Relocate isolated symbols. */
|
||||||
{
|
{
|
||||||
struct symbol *iter;
|
struct symbol *iter;
|
||||||
|
@ -536,17 +536,15 @@ struct psymbol_functions : public quick_symbol_functions
|
|||||||
CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override;
|
CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override;
|
||||||
|
|
||||||
struct compunit_symtab *find_compunit_symtab_by_address
|
struct compunit_symtab *find_compunit_symtab_by_address
|
||||||
(struct objfile *objfile, CORE_ADDR address) override;
|
(struct objfile *objfile, CORE_ADDR address) override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void map_symbol_filenames (struct objfile *objfile,
|
void map_symbol_filenames (struct objfile *objfile,
|
||||||
gdb::function_view<symbol_filename_ftype> fun,
|
gdb::function_view<symbol_filename_ftype> fun,
|
||||||
bool need_fullname) override;
|
bool need_fullname) override;
|
||||||
|
|
||||||
void relocated () override
|
|
||||||
{
|
|
||||||
m_psymbol_map.clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return a range adapter for the psymtabs. */
|
/* Return a range adapter for the psymtabs. */
|
||||||
psymtab_storage::partial_symtab_range partial_symbols
|
psymtab_storage::partial_symtab_range partial_symbols
|
||||||
(struct objfile *objfile);
|
(struct objfile *objfile);
|
||||||
@ -588,11 +586,6 @@ private:
|
|||||||
|
|
||||||
/* Storage for the partial symbols. */
|
/* Storage for the partial symbols. */
|
||||||
std::shared_ptr<psymtab_storage> m_partial_symtabs;
|
std::shared_ptr<psymtab_storage> m_partial_symtabs;
|
||||||
|
|
||||||
/* Map symbol addresses to the partial symtab that defines the
|
|
||||||
object at that address. */
|
|
||||||
|
|
||||||
std::vector<std::pair<CORE_ADDR, partial_symtab *>> m_psymbol_map;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PSYMPRIV_H */
|
#endif /* PSYMPRIV_H */
|
||||||
|
@ -1103,75 +1103,6 @@ psymbol_functions::has_unexpanded_symtabs (struct objfile *objfile)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function for psym_find_compunit_symtab_by_address that fills
|
|
||||||
in m_psymbol_map for a given range of psymbols. */
|
|
||||||
|
|
||||||
void
|
|
||||||
psymbol_functions::fill_psymbol_map
|
|
||||||
(struct objfile *objfile,
|
|
||||||
struct partial_symtab *psymtab,
|
|
||||||
std::set<CORE_ADDR> *seen_addrs,
|
|
||||||
const std::vector<partial_symbol *> &symbols)
|
|
||||||
{
|
|
||||||
for (partial_symbol *psym : symbols)
|
|
||||||
{
|
|
||||||
if (psym->aclass == LOC_STATIC)
|
|
||||||
{
|
|
||||||
CORE_ADDR addr = psym->address (objfile);
|
|
||||||
if (seen_addrs->find (addr) == seen_addrs->end ())
|
|
||||||
{
|
|
||||||
seen_addrs->insert (addr);
|
|
||||||
m_psymbol_map.emplace_back (addr, psymtab);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See find_compunit_symtab_by_address in quick_symbol_functions, in
|
|
||||||
symfile.h. */
|
|
||||||
|
|
||||||
compunit_symtab *
|
|
||||||
psymbol_functions::find_compunit_symtab_by_address (struct objfile *objfile,
|
|
||||||
CORE_ADDR address)
|
|
||||||
{
|
|
||||||
if (m_psymbol_map.empty ())
|
|
||||||
{
|
|
||||||
std::set<CORE_ADDR> seen_addrs;
|
|
||||||
|
|
||||||
for (partial_symtab *pst : partial_symbols (objfile))
|
|
||||||
{
|
|
||||||
fill_psymbol_map (objfile, pst,
|
|
||||||
&seen_addrs,
|
|
||||||
pst->global_psymbols);
|
|
||||||
fill_psymbol_map (objfile, pst,
|
|
||||||
&seen_addrs,
|
|
||||||
pst->static_psymbols);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_psymbol_map.shrink_to_fit ();
|
|
||||||
|
|
||||||
std::sort (m_psymbol_map.begin (), m_psymbol_map.end (),
|
|
||||||
[] (const std::pair<CORE_ADDR, partial_symtab *> &a,
|
|
||||||
const std::pair<CORE_ADDR, partial_symtab *> &b)
|
|
||||||
{
|
|
||||||
return a.first < b.first;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
auto iter = std::lower_bound
|
|
||||||
(m_psymbol_map.begin (), m_psymbol_map.end (), address,
|
|
||||||
[] (const std::pair<CORE_ADDR, partial_symtab *> &a,
|
|
||||||
CORE_ADDR b)
|
|
||||||
{
|
|
||||||
return a.first < b;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (iter == m_psymbol_map.end () || iter->first != address)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return psymtab_to_symtab (objfile, iter->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Partially fill a partial symtab. It will be completely filled at
|
/* Partially fill a partial symtab. It will be completely filled at
|
||||||
|
@ -212,13 +212,6 @@ struct quick_symbol_functions
|
|||||||
gdb::function_view<symbol_filename_ftype> fun,
|
gdb::function_view<symbol_filename_ftype> fun,
|
||||||
bool need_fullname) = 0;
|
bool need_fullname) = 0;
|
||||||
|
|
||||||
/* This is called when the objfile is relocated. It can be used to
|
|
||||||
clean up any internal caches. */
|
|
||||||
virtual void relocated ()
|
|
||||||
{
|
|
||||||
/* Do nothing. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return true if this class can lazily read the symbols. This may
|
/* Return true if this class can lazily read the symbols. This may
|
||||||
only return true if there are in fact symbols to be read, because
|
only return true if there are in fact symbols to be read, because
|
||||||
this is used in the implementation of 'has_partial_symbols'. */
|
this is used in the implementation of 'has_partial_symbols'. */
|
||||||
|
Reference in New Issue
Block a user