Support loading in a symbol file.

arch/alpha/freebsd/system.cc:
arch/alpha/isa/decoder.isa:
arch/alpha/linux/system.cc:
arch/alpha/system.cc:
arch/alpha/tru64/system.cc:
    Let symbol files be read in so that profiling can happen on the binaries as well.
python/m5/objects/System.py:
    Add in symbol files.
sim/pseudo_inst.cc:
    Load in a specified symbol file.
sim/pseudo_inst.hh:
    Allow for symbols to be loaded.
sim/system.hh:
    Support symbol file.
util/m5/m5.c:
util/m5/m5op.S:
    Add support to m5 util for loading symbols (and readfile).

--HG--
extra : convert_revision : f10c1049bcd7b22b98c73052c0666b964aff222b
This commit is contained in:
Kevin Lim
2006-08-23 16:57:07 -04:00
parent de321175f2
commit 4a2c50bc8f
11 changed files with 96 additions and 0 deletions

View File

@@ -149,6 +149,54 @@ namespace AlphaPseudo
SimExit(when, "m5_exit instruction encountered");
}
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)
{

View File

@@ -51,6 +51,7 @@ namespace AlphaPseudo
void ivle(ExecContext *xc);
void m5exit(ExecContext *xc, Tick delay);
void m5exit_old(ExecContext *xc);
void loadsymbol(ExecContext *xc);
void resetstats(ExecContext *xc, Tick delay, Tick period);
void dumpstats(ExecContext *xc, Tick delay, Tick period);
void dumpresetstats(ExecContext *xc, Tick delay, Tick period);

View File

@@ -137,6 +137,7 @@ class System : public SimObject
std::string kernel_path;
std::string readfile;
std::string symbolfile;
};
protected: