if (params()->early_kernel_symbols) {
kernelObj->loadGlobalSymbols(kernelSymtab, 0, 0, _loadAddrMask);
kernelObj->loadGlobalSymbols(
- Loader::debugSymbolTable, 0, 0, _loadAddrMask);
+ &Loader::debugSymbolTable, 0, 0, _loadAddrMask);
}
// Check if the kernel image has a symbol that tells us it supports
"Can't find a matching boot loader / kernel combination!");
if (bootldr)
- bootldr->loadGlobalSymbols(Loader::debugSymbolTable);
+ bootldr->loadGlobalSymbols(&Loader::debugSymbolTable);
}
void
if (params()->early_kernel_symbols) {
kernelObj->loadGlobalSymbols(kernelSymtab, 0, 0, _loadAddrMask);
kernelObj->loadGlobalSymbols(
- Loader::debugSymbolTable, 0, 0, _loadAddrMask);
+ &Loader::debugSymbolTable, 0, 0, _loadAddrMask);
}
// Setup boot data structure
panic("Tried to %s unmapped address %#x.\nPC: %#x, Instr: %s",
modeStr, addr, tc->pcState().pc(),
inst->disassemble(tc->pcState().pc(),
- Loader::debugSymbolTable));
+ &Loader::debugSymbolTable));
}
}
}
Addr junk;
char sm[50];
if (!TheISA::inUserMode(tc))
- Loader::debugSymbolTable->findNearestSymbol(
+ Loader::debugSymbolTable.findNearestSymbol(
tc->readIntReg(ReturnAddressReg), st, junk);
tc->getVirtProxy().readString(sm, sm_string, 50);
Addr sym_addr = 0;
if (!TheISA::inUserMode(tc)) {
- Loader::debugSymbolTable->findNearestSymbol(next_pc, sym, sym_addr);
+ Loader::debugSymbolTable.findNearestSymbol(next_pc, sym, sym_addr);
} else {
Linux::ThreadInfo ti(tc);
string app = ti.curTaskName();
std::string st;
Addr junk;
if (!TheISA::inUserMode(tc))
- Loader::debugSymbolTable->findNearestSymbol(
+ Loader::debugSymbolTable.findNearestSymbol(
tc->readIntReg(ReturnAddressReg), st, junk);
System *sys = tc->getSystemPtr();
StringWrap name(sys->name());
namespace Loader
{
-SymbolTable *debugSymbolTable = NULL;
+SymbolTable debugSymbolTable;
void
SymbolTable::clear()
bool insert(const Symbol &symbol);
bool insert(const SymbolTable &other);
bool load(const std::string &file);
+ bool empty() const { return symbols.empty(); }
void serialize(const std::string &base, CheckpointOut &cp) const;
void unserialize(const std::string &base, CheckpointIn &cp,
/// there should be one of these per System object for full system,
/// and per Process object for non-full-system, but so far one big
/// global one has worked well enough.
-extern SymbolTable *debugSymbolTable;
+extern SymbolTable debugSymbolTable;
} // namespace Loader
void
BaseCPU::traceFunctionsInternal(Addr pc)
{
- if (!Loader::debugSymbolTable)
+ if (Loader::debugSymbolTable.empty())
return;
// if pc enters different function, print new function symbol and
// update saved range. Otherwise do nothing.
if (pc < currentFunctionStart || pc >= currentFunctionEnd) {
- auto it = Loader::debugSymbolTable->findNearest(
+ auto it = Loader::debugSymbolTable.findNearest(
pc, currentFunctionEnd);
string sym_str;
- if (it == Loader::debugSymbolTable->end()) {
+ if (it == Loader::debugSymbolTable.end()) {
// no symbol found: use addr as label
sym_str = csprintf("%#x", pc);
currentFunctionStart = pc;
Addr cur_pc = pc.instAddr();
Loader::SymbolTable::const_iterator it;
- if (Loader::debugSymbolTable && Debug::ExecSymbol &&
- (!FullSystem || !inUserMode(thread)) &&
- (it = Loader::debugSymbolTable->findNearest(cur_pc)) !=
- Loader::debugSymbolTable->end()) {
+ if (Debug::ExecSymbol && (!FullSystem || !inUserMode(thread)) &&
+ (it = Loader::debugSymbolTable.findNearest(cur_pc)) !=
+ Loader::debugSymbolTable.end()) {
Addr delta = cur_pc - it->address;
if (delta)
ccprintf(outs, "@%s+%d", it->name, delta);
//
outs << setw(26) << left;
- outs << inst->disassemble(cur_pc, Loader::debugSymbolTable);
+ outs << inst->disassemble(cur_pc, &Loader::debugSymbolTable);
if (ran) {
outs << " : ";
auto *object = Loader::createObjectFile(file, true);
fatal_if(!object, "%s: Could not load %s.", name(), file);
- panic_if(!object->loadGlobalSymbols(Loader::debugSymbolTable),
+ panic_if(!object->loadGlobalSymbols(&Loader::debugSymbolTable),
"%s: Could not load symbols from %s.", name(), file);
Loader::MemoryImage image = object->buildImage();
_loadAddrMask(p.load_addr_mask), _loadAddrOffset(p.load_addr_offset),
kernelSymtab(new Loader::SymbolTable), commandLine(p.command_line)
{
- if (!Loader::debugSymbolTable)
- Loader::debugSymbolTable = new Loader::SymbolTable;
-
if (params().object_file == "") {
inform("No kernel set for full system simulation. "
"Assuming you know what you're doing.");
fatal_if(!kernelObj->loadLocalSymbols(kernelSymtab),
"Could not load kernel local symbols.");
- fatal_if(!kernelObj->loadGlobalSymbols(Loader::debugSymbolTable),
+ fatal_if(!kernelObj->loadGlobalSymbols(&Loader::debugSymbolTable),
"Could not load kernel symbols.");
- fatal_if(!kernelObj->loadLocalSymbols(Loader::debugSymbolTable),
+ fatal_if(!kernelObj->loadLocalSymbols(&Loader::debugSymbolTable),
"Could not load kernel local symbols.");
}
image = objFile->buildImage();
- if (!::Loader::debugSymbolTable) {
- ::Loader::debugSymbolTable = new ::Loader::SymbolTable();
- if (!objFile->loadGlobalSymbols(::Loader::debugSymbolTable) ||
- !objFile->loadLocalSymbols(::Loader::debugSymbolTable) ||
- !objFile->loadWeakSymbols(::Loader::debugSymbolTable)) {
- delete ::Loader::debugSymbolTable;
- ::Loader::debugSymbolTable = nullptr;
+ if (::Loader::debugSymbolTable.empty()) {
+ if (!objFile->loadGlobalSymbols(&::Loader::debugSymbolTable) ||
+ !objFile->loadLocalSymbols(&::Loader::debugSymbolTable) ||
+ !objFile->loadWeakSymbols(&::Loader::debugSymbolTable)) {
+ ::Loader::debugSymbolTable.clear();
}
}
}
tc->getSystemPtr()->workload->insertSymbol(
{ Loader::Symbol::Binding::Global, symbol, addr });
- Loader::debugSymbolTable->insert(
+ Loader::debugSymbolTable.insert(
{ Loader::Symbol::Binding::Global, symbol, addr });
}
ffdp->getFileName());
if (lib) {
- lib->loadAllSymbols(Loader::debugSymbolTable,
+ lib->loadAllSymbols(&Loader::debugSymbolTable,
lib->buildImage().minAddr(), start);
}
}