gem5  v20.1.0.0
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Loader::SymbolTable Class Reference

#include <symtab.hh>

Public Types

typedef std::shared_ptr< SymbolTableSymbolTablePtr
 
typedef SymbolVector::iterator iterator
 
typedef SymbolVector::const_iterator const_iterator
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
void clear ()
 
bool insert (const Symbol &symbol)
 
bool insert (const SymbolTable &other)
 
bool load (const std::string &file)
 
bool empty () const
 
SymbolTablePtr offset (Addr by) const
 
SymbolTablePtr mask (Addr m) const
 
SymbolTablePtr globals () const
 
SymbolTablePtr locals () const
 
SymbolTablePtr weaks () const
 
void serialize (const std::string &base, CheckpointOut &cp) const
 
void unserialize (const std::string &base, CheckpointIn &cp, Symbol::Binding default_binding=Symbol::Binding::Global)
 
const_iterator find (Addr address) const
 
const_iterator find (const std::string &name) const
 
const_iterator findNearest (Addr addr, Addr &nextaddr) const
 Find the nearest symbol equal to or less than the supplied address (e.g., the label for the enclosing function). More...
 
const_iterator findNearest (Addr addr) const
 Overload for findNearestSymbol() for callers who don't care about nextaddr. More...
 

Private Types

typedef std::vector< SymbolSymbolVector
 
typedef std::multimap< Addr, int > AddrMap
 
typedef std::map< std::string, int > NameMap
 
typedef std::function< void(SymbolTable &symtab, const Symbol &symbol)> SymTabOp
 
typedef std::function< bool(const Symbol &symbol)> SymTabFilter
 

Private Member Functions

bool upperBound (Addr addr, AddrMap::const_iterator &iter) const
 
SymbolTablePtr operate (SymTabOp op) const
 
SymbolTablePtr filter (SymTabFilter filter) const
 
SymbolTablePtr filterByBinding (Symbol::Binding binding) const
 

Private Attributes

SymbolVector symbols
 
AddrMap addrMap
 
NameMap nameMap
 

Detailed Description

Definition at line 59 of file symtab.hh.

Member Typedef Documentation

◆ AddrMap

typedef std::multimap<Addr, int> Loader::SymbolTable::AddrMap
private

Definition at line 67 of file symtab.hh.

◆ const_iterator

typedef SymbolVector::const_iterator Loader::SymbolTable::const_iterator

Definition at line 123 of file symtab.hh.

◆ iterator

typedef SymbolVector::iterator Loader::SymbolTable::iterator

Definition at line 122 of file symtab.hh.

◆ NameMap

typedef std::map<std::string, int> Loader::SymbolTable::NameMap
private

Definition at line 69 of file symtab.hh.

◆ SymbolTablePtr

Definition at line 62 of file symtab.hh.

◆ SymbolVector

Definition at line 65 of file symtab.hh.

◆ SymTabFilter

typedef std::function<bool(const Symbol &symbol)> Loader::SymbolTable::SymTabFilter
private

Definition at line 99 of file symtab.hh.

◆ SymTabOp

typedef std::function<void(SymbolTable &symtab, const Symbol &symbol)> Loader::SymbolTable::SymTabOp
private

Definition at line 89 of file symtab.hh.

Member Function Documentation

◆ begin()

const_iterator Loader::SymbolTable::begin ( ) const
inline

Definition at line 125 of file symtab.hh.

References symbols.

◆ clear()

void Loader::SymbolTable::clear ( )

Definition at line 50 of file symtab.cc.

References clear(), and Stats::nameMap().

Referenced by clear().

◆ empty()

bool Loader::SymbolTable::empty ( ) const
inline

Definition at line 134 of file symtab.hh.

References symbols.

◆ end()

const_iterator Loader::SymbolTable::end ( ) const
inline

◆ filter()

SymbolTablePtr Loader::SymbolTable::filter ( SymTabFilter  filter) const
inlineprivate

Definition at line 101 of file symtab.hh.

References insert(), and operate().

Referenced by filterByBinding().

◆ filterByBinding()

SymbolTablePtr Loader::SymbolTable::filterByBinding ( Symbol::Binding  binding) const
inlineprivate

Definition at line 113 of file symtab.hh.

References filter().

Referenced by globals(), locals(), and weaks().

◆ find() [1/2]

const_iterator Loader::SymbolTable::find ( Addr  address) const
inline

◆ find() [2/2]

const_iterator Loader::SymbolTable::find ( const std::string &  name) const
inline

Definition at line 193 of file symtab.hh.

References end(), ArmISA::i, name(), nameMap, and symbols.

◆ findNearest() [1/2]

const_iterator Loader::SymbolTable::findNearest ( Addr  addr) const
inline

Overload for findNearestSymbol() for callers who don't care about nextaddr.

Definition at line 223 of file symtab.hh.

References addr, addrMap, end(), ArmISA::i, symbols, and upperBound().

◆ findNearest() [2/2]

const_iterator Loader::SymbolTable::findNearest ( Addr  addr,
Addr nextaddr 
) const
inline

Find the nearest symbol equal to or less than the supplied address (e.g., the label for the enclosing function).

Parameters
addrThe address to look up.
nextaddrAddress of following symbol (for determining valid range of symbol).
Return values
Aconst_iterator which points to the symbol if found, or end.

Definition at line 209 of file symtab.hh.

References addr, addrMap, end(), ArmISA::i, symbols, and upperBound().

Referenced by SparcISA::BranchDisp::generateDisassembly(), ArmISA::ArmStaticInst::printMemSymbol(), ArmISA::ArmStaticInst::printTarget(), FunctionProfile::sample(), and BaseCPU::traceFunctionsInternal().

◆ globals()

SymbolTablePtr Loader::SymbolTable::globals ( ) const
inline

◆ insert() [1/2]

bool Loader::SymbolTable::insert ( const Symbol symbol)

◆ insert() [2/2]

bool Loader::SymbolTable::insert ( const SymbolTable other)

Definition at line 78 of file symtab.cc.

References nameMap, and Stats::nameMap().

◆ load()

bool Loader::SymbolTable::load ( const std::string &  file)

Definition at line 96 of file symtab.cc.

References addr, eat_white(), fatal, name(), and to_number().

Referenced by main().

◆ locals()

SymbolTablePtr Loader::SymbolTable::locals ( ) const
inline

Definition at line 165 of file symtab.hh.

References filterByBinding(), and Loader::Symbol::Local.

◆ mask()

SymbolTablePtr Loader::SymbolTable::mask ( Addr  m) const
inline

Definition at line 148 of file symtab.hh.

References Loader::Symbol::address, insert(), ArmISA::m, X86ISA::op, and operate().

◆ offset()

SymbolTablePtr Loader::SymbolTable::offset ( Addr  by) const
inline

Definition at line 137 of file symtab.hh.

References Loader::Symbol::address, insert(), X86ISA::op, and operate().

◆ operate()

SymbolTablePtr Loader::SymbolTable::operate ( SymTabOp  op) const
inlineprivate

Definition at line 91 of file symtab.hh.

References X86ISA::op, and symbols.

Referenced by filter(), mask(), and offset().

◆ serialize()

void Loader::SymbolTable::serialize ( const std::string &  base,
CheckpointOut cp 
) const

Definition at line 136 of file symtab.cc.

References X86ISA::base, csprintf(), ArmISA::i, and paramOut().

Referenced by KernelWorkload::serialize().

◆ unserialize()

void Loader::SymbolTable::unserialize ( const std::string &  base,
CheckpointIn cp,
Symbol::Binding  default_binding = Symbol::Binding::Global 
)

Definition at line 150 of file symtab.cc.

References X86ISA::base, csprintf(), ArmISA::i, name(), optParamIn(), and paramIn().

Referenced by KernelWorkload::unserialize().

◆ upperBound()

bool Loader::SymbolTable::upperBound ( Addr  addr,
AddrMap::const_iterator &  iter 
) const
inlineprivate

Definition at line 76 of file symtab.hh.

References addr, and addrMap.

Referenced by findNearest().

◆ weaks()

SymbolTablePtr Loader::SymbolTable::weaks ( ) const
inline

Definition at line 171 of file symtab.hh.

References filterByBinding(), and Loader::Symbol::Weak.

Member Data Documentation

◆ addrMap

AddrMap Loader::SymbolTable::addrMap
private

Definition at line 72 of file symtab.hh.

Referenced by find(), findNearest(), and upperBound().

◆ nameMap

NameMap Loader::SymbolTable::nameMap
private

Definition at line 73 of file symtab.hh.

Referenced by find(), and insert().

◆ symbols

SymbolVector Loader::SymbolTable::symbols
private

Definition at line 71 of file symtab.hh.

Referenced by begin(), empty(), end(), find(), findNearest(), and operate().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:03:06 for gem5 by doxygen 1.8.17