diff options
Diffstat (limited to 'sim/pseudo_inst.cc')
-rw-r--r-- | sim/pseudo_inst.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sim/pseudo_inst.cc b/sim/pseudo_inst.cc index 2d737c0a2..3b11eaaeb 100644 --- a/sim/pseudo_inst.cc +++ b/sim/pseudo_inst.cc @@ -150,6 +150,54 @@ namespace AlphaPseudo } void + loadsymbol(ExecContext *xc) + { + const string &filename = xc->getCpuPtr()->system->params()->symbolfile; + if (filename.empty()) { + return; + } + + std::string buffer; + ifstream file(filename.c_str()); + + if (!file) + fatal("file error: Can't open symbol table file %s\n", filename); + + while (!file.eof()) { + getline(file, buffer); + + if (buffer.empty()) + continue; + + int idx = buffer.find(' '); + if (idx == string::npos) + continue; + + string address = "0x" + buffer.substr(0, idx); + eat_white(address); + if (address.empty()) + continue; + + // Skip over letter and space + string symbol = buffer.substr(idx + 3); + eat_white(symbol); + if (symbol.empty()) + continue; + + Addr addr; + if (!to_number(address, addr)) + continue; + + if (!xc->getSystemPtr()->kernelSymtab->insert(addr, symbol)) + continue; + + + DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr); + } + file.close(); + } + + void resetstats(ExecContext *xc, Tick delay, Tick period) { if (!doStatisticsInsts) |