58 SymbolTable::insert(
const Symbol &symbol)
60 if (symbol.
name.empty())
63 int idx = symbols.size();
65 if (!
nameMap.insert({ symbol.name, idx }).second)
70 addrMap.insert({ symbol.
address, idx });
72 symbols.emplace_back(symbol);
84 std::inserter(intersection, intersection.begin()),
86 if (!intersection.empty())
89 for (
const Symbol &symbol: other)
96 SymbolTable::load(
const string &filename)
99 ifstream file(filename.c_str());
102 fatal(
"file error: Can't open symbol table file %s\n", filename);
104 while (!file.eof()) {
105 getline(file, buffer);
110 if (idx == string::npos)
113 string address = buffer.substr(0, idx);
118 string name = buffer.substr(idx + 1);
127 if (!insert({ Symbol::Binding::Global,
name, addr }))
138 paramOut(cp, base +
".size", symbols.size());
141 for (
auto &symbol: symbols) {
155 paramIn(cp, base +
".size", size);
156 for (
int i = 0;
i < size; ++
i) {
164 binding = default_binding;
165 insert({binding,
name, address});
#define fatal(...)
This implements a cprintf based fatal() function.
const std::string & name()
Overload hash function for BasicBlockRange type.
SymbolTable debugSymbolTable
Global unified debugging symbol table (for target).
std::map< std::string, int > NameMap
std::string csprintf(const char *format, const Args &...args)
bool optParamIn(CheckpointIn &cp, const std::string &name, T ¶m, bool warn=true)
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
bool to_number(const std::string &value, VecPredRegContainer< NumBits, Packed > &p)
Helper functions used for serialization/de-serialization.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::ostream CheckpointOut
void eat_white(std::string &s)
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
void unserialize(ThreadContext &tc, CheckpointIn &cp)