42#ifndef __BASE_LOADER_SYMTAB_HH__
43#define __BASE_LOADER_SYMTAB_HH__
84 const std::string &
name,
const Addr addr,
const size_t size)
110 void rename(
const std::string & new_name) {
207 for (
const auto &symbol:
symbols)
248 auto filt = [binding](
const Symbol &symbol) {
249 return symbol.binding() == binding;
264 auto filt = [symbol_type](
const Symbol &symbol) {
265 return symbol.type() == symbol_type;
321 Symbol(symbol.binding(), symbol.type(), symbol.name(),
322 symbol.address() + addr_offset));
339 Symbol(symbol.binding(), symbol.type(), symbol.name(),
340 symbol.address() &
m));
353 rename(std::function<std::string (
const std::string&)> func)
const
437 AddrMap::const_iterator
i =
addrMap.find(address);
476 AddrMap::const_iterator
i =
addrMap.end();
485 next_addr =
i->first;
498 AddrMap::const_iterator
i =
addrMap.end();
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
SymbolTablePtr functionSymbols() const
Generates a new symbol table containing only function symbols.
SymbolTablePtr locals() const
Generates a new symbol table containing only local symbols.
SymbolVector::const_iterator const_iterator
SymbolTablePtr weaks() const
Generates a new symbol table containing only weak symbols.
bool empty() const
Verifies whether the table is empty.
SymbolTablePtr globals() const
Generates a new symbol table containing only global symbols.
std::shared_ptr< SymbolTable > SymbolTablePtr
SymbolTablePtr rename(std::function< std::string(const std::string &)> func) const
Modify the symbols' name with a given transform function.
std::map< std::string, int > NameMap
Map a symbol name to an index into the symbol vector.
SymbolTablePtr filter(SymTabFilter filter) const
Applies a filter to the symbols of the table to generate a new table.
void clear()
Clears the table.
std::multimap< Addr, int > AddrMap
Map addresses to an index into the symbol vector.
const_iterator end() const
void unserialize(const std::string &base, CheckpointIn &cp, Symbol::Binding default_binding=Symbol::Binding::Global)
Populate the table by unserializing a checkpoint.
SymbolTablePtr operate(SymTabOp op) const
Create a derived symbol table by applying an operation on the symbols of the current table.
SymbolTablePtr filterByBinding(Symbol::Binding binding) const
Generate a new table by applying a filter that only accepts the symbols whose binding matches the giv...
std::function< void(SymbolTable &symtab, const Symbol &symbol)> SymTabOp
A function that applies an operation on a symbol with respect to a symbol table.
const_iterator findNearest(Addr addr) const
Overload for findNearestSymbol() for callers who don't care about nextaddr.
const_iterator begin() const
SymbolVector::iterator iterator
std::vector< Symbol > SymbolVector
Vector containing all the symbols in the table.
SymbolTablePtr filterBySymbolType(const Symbol::SymbolType &symbol_type) const
Generate a new table by applying a filter that only accepts the symbols whose type matches the given ...
const_iterator findNearest(Addr addr, Addr &next_addr) const
Find the nearest symbol equal to or less than the supplied address (e.g., the label for the enclosing...
SymbolTablePtr mask(Addr m) const
Generate a new table by a mask to the symbols of the current table.
bool upperBound(Addr addr, AddrMap::const_iterator &iter) const
Get the first address larger than the given address, if any.
const_iterator find(const std::string &name) const
Search for a symbol by its name.
SymbolTablePtr offset(Addr addr_offset) const
Generate a new table by applying an offset to the symbols of the current table.
std::function< bool(const Symbol &symbol)> SymTabFilter
A function that applies a condition to the symbol provided to decide whether the symbol is accepted,...
void serialize(const std::string &base, CheckpointOut &cp) const
Serialize the table's contents.
bool insert(const Symbol &symbol)
Insert a new symbol in the table if it does not already exist.
const_iterator find(Addr address) const
Search for a symbol by its address.
Symbol & operator=(const Symbol &other)=default
bool sizeIsValid() const
Return whether the Symbol size is valid or not.
size_t sizeOrDefault(const size_t default_size) const
Return the Symbol size if it is valid, otherwise return the default value supplied.
Symbol(const Binding binding, const SymbolType type, const std::string &name, const Addr addr, const size_t size)
Symbol(const Symbol &other)=default
void rename(const std::string &new_name)
void relocate(const Addr new_addr)
Symbol(const Binding binding, const SymbolType type, const std::string &name, const Addr addr)
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const std::string & name()