DebugTools: Simplify the symbol map

This commit is contained in:
Ty Lamontagne 2023-10-25 18:00:54 -04:00 committed by refractionpcsx2
parent 78bc0a52ea
commit 85539c7bb9
9 changed files with 253 additions and 481 deletions

View File

@ -574,7 +574,7 @@ void CpuWidget::onFuncListContextMenu(QPoint pos)
// Resolve the function name by fetching the symbolmap and filtering the address // Resolve the function name by fetching the symbolmap and filtering the address
const QListWidgetItem* selectedItem = m_ui.listFunctions->selectedItems().first(); const QListWidgetItem* selectedItem = m_ui.listFunctions->selectedItems().first();
const QString functionName = QString(m_cpu.GetSymbolMap().GetLabelString(selectedItem->data(256).toUInt()).c_str()); const QString functionName = QString(m_cpu.GetSymbolMap().GetLabelName(selectedItem->data(256).toUInt()).c_str());
QApplication::clipboard()->setText(functionName); QApplication::clipboard()->setText(functionName);
}); });
m_funclistContextMenu->addAction(copyName); m_funclistContextMenu->addAction(copyName);

View File

@ -219,7 +219,6 @@ void DisassemblyWidget::contextAddFunction()
newSize = prevSize - newSize; newSize = prevSize - newSize;
m_cpu->GetSymbolMap().AddFunction(funcName.toLocal8Bit().constData(), curAddress, newSize); m_cpu->GetSymbolMap().AddFunction(funcName.toLocal8Bit().constData(), curAddress, newSize);
m_cpu->GetSymbolMap().SortSymbols(); m_cpu->GetSymbolMap().SortSymbols();
m_cpu->GetSymbolMap().UpdateActiveSymbols();
} }
} }
else else
@ -232,7 +231,6 @@ void DisassemblyWidget::contextAddFunction()
m_cpu->GetSymbolMap().AddFunction(funcName.toLocal8Bit().constData(), m_selectedAddressStart, m_selectedAddressEnd + 4 - m_selectedAddressStart); m_cpu->GetSymbolMap().AddFunction(funcName.toLocal8Bit().constData(), m_selectedAddressStart, m_selectedAddressEnd + 4 - m_selectedAddressStart);
m_cpu->GetSymbolMap().SortSymbols(); m_cpu->GetSymbolMap().SortSymbols();
m_cpu->GetSymbolMap().UpdateActiveSymbols();
} }
} }
@ -250,9 +248,8 @@ void DisassemblyWidget::contextRemoveFunction()
m_cpu->GetSymbolMap().SetFunctionSize(previousFuncAddr, expandedSize); m_cpu->GetSymbolMap().SetFunctionSize(previousFuncAddr, expandedSize);
} }
m_cpu->GetSymbolMap().RemoveFunction(curFuncAddr, true); m_cpu->GetSymbolMap().RemoveFunction(curFuncAddr);
m_cpu->GetSymbolMap().SortSymbols(); m_cpu->GetSymbolMap().SortSymbols();
m_cpu->GetSymbolMap().UpdateActiveSymbols();
} }
} }
@ -262,7 +259,7 @@ void DisassemblyWidget::contextRenameFunction()
if (curFuncAddress != SymbolMap::INVALID_ADDRESS) if (curFuncAddress != SymbolMap::INVALID_ADDRESS)
{ {
bool ok; bool ok;
QString funcName = QInputDialog::getText(this, tr("Rename Function"), tr("Function name"), QLineEdit::Normal, m_cpu->GetSymbolMap().GetLabelString(curFuncAddress).c_str(), &ok); QString funcName = QInputDialog::getText(this, tr("Rename Function"), tr("Function name"), QLineEdit::Normal, m_cpu->GetSymbolMap().GetLabelName(curFuncAddress).c_str(), &ok);
if (!ok) if (!ok)
return; return;
@ -274,7 +271,6 @@ void DisassemblyWidget::contextRenameFunction()
{ {
m_cpu->GetSymbolMap().SetLabelName(funcName.toLocal8Bit().constData(), curFuncAddress); m_cpu->GetSymbolMap().SetLabelName(funcName.toLocal8Bit().constData(), curFuncAddress);
m_cpu->GetSymbolMap().SortSymbols(); m_cpu->GetSymbolMap().SortSymbols();
m_cpu->GetSymbolMap().UpdateActiveSymbols();
this->repaint(); this->repaint();
} }
} }
@ -713,7 +709,7 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon
const bool isConditionalMet = line.info.conditionMet; const bool isConditionalMet = line.info.conditionMet;
const bool isCurrentPC = m_cpu->getPC() == address; const bool isCurrentPC = m_cpu->getPC() == address;
const std::string addressSymbol = m_cpu->GetSymbolMap().GetLabelString(address); const std::string addressSymbol = m_cpu->GetSymbolMap().GetLabelName(address);
const auto demangler = demangler::CDemangler::createGcc(); const auto demangler = demangler::CDemangler::createGcc();

View File

@ -58,7 +58,7 @@ QVariant BreakpointModel::data(const QModelIndex& index, int role) const
case BreakpointColumns::OFFSET: case BreakpointColumns::OFFSET:
return QtUtils::FilledQStringFromValue(bp->addr, 16); return QtUtils::FilledQStringFromValue(bp->addr, 16);
case BreakpointColumns::SIZE_LABEL: case BreakpointColumns::SIZE_LABEL:
return m_cpu.GetSymbolMap().GetLabelString(bp->addr).c_str(); return m_cpu.GetSymbolMap().GetLabelName(bp->addr).c_str();
case BreakpointColumns::OPCODE: case BreakpointColumns::OPCODE:
// Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck) // Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck)
return m_cpu.disasm(bp->addr, true).c_str(); return m_cpu.disasm(bp->addr, true).c_str();
@ -111,7 +111,7 @@ QVariant BreakpointModel::data(const QModelIndex& index, int role) const
case BreakpointColumns::OFFSET: case BreakpointColumns::OFFSET:
return bp->addr; return bp->addr;
case BreakpointColumns::SIZE_LABEL: case BreakpointColumns::SIZE_LABEL:
return m_cpu.GetSymbolMap().GetLabelString(bp->addr).c_str(); return m_cpu.GetSymbolMap().GetLabelName(bp->addr).c_str();
case BreakpointColumns::OPCODE: case BreakpointColumns::OPCODE:
// Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck) // Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck)
return m_cpu.disasm(bp->addr, true).c_str(); return m_cpu.disasm(bp->addr, true).c_str();
@ -157,7 +157,7 @@ QVariant BreakpointModel::data(const QModelIndex& index, int role) const
case BreakpointColumns::OFFSET: case BreakpointColumns::OFFSET:
return QtUtils::FilledQStringFromValue(bp->addr, 16); return QtUtils::FilledQStringFromValue(bp->addr, 16);
case BreakpointColumns::SIZE_LABEL: case BreakpointColumns::SIZE_LABEL:
return m_cpu.GetSymbolMap().GetLabelString(bp->addr).c_str(); return m_cpu.GetSymbolMap().GetLabelName(bp->addr).c_str();
case BreakpointColumns::OPCODE: case BreakpointColumns::OPCODE:
// Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck) // Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck)
return m_cpu.disasm(bp->addr, true).c_str(); return m_cpu.disasm(bp->addr, true).c_str();

View File

@ -47,7 +47,7 @@ QVariant StackModel::data(const QModelIndex& index, int role) const
case StackModel::ENTRY: case StackModel::ENTRY:
return QtUtils::FilledQStringFromValue(stackFrame.entry, 16); return QtUtils::FilledQStringFromValue(stackFrame.entry, 16);
case StackModel::ENTRY_LABEL: case StackModel::ENTRY_LABEL:
return m_cpu.GetSymbolMap().GetLabelString(stackFrame.entry).c_str(); return m_cpu.GetSymbolMap().GetLabelName(stackFrame.entry).c_str();
case StackModel::PC: case StackModel::PC:
return QtUtils::FilledQStringFromValue(stackFrame.pc, 16); return QtUtils::FilledQStringFromValue(stackFrame.pc, 16);
case StackModel::PC_OPCODE: case StackModel::PC_OPCODE:
@ -66,7 +66,7 @@ QVariant StackModel::data(const QModelIndex& index, int role) const
case StackModel::ENTRY: case StackModel::ENTRY:
return stackFrame.entry; return stackFrame.entry;
case StackModel::ENTRY_LABEL: case StackModel::ENTRY_LABEL:
return m_cpu.GetSymbolMap().GetLabelString(stackFrame.entry).c_str(); return m_cpu.GetSymbolMap().GetLabelName(stackFrame.entry).c_str();
case StackModel::PC: case StackModel::PC:
return stackFrame.pc; return stackFrame.pc;
case StackModel::PC_OPCODE: case StackModel::PC_OPCODE:

View File

@ -305,7 +305,7 @@ void CDVDsys_SetFile(CDVD_SourceType srctype, std::string newfile)
symName = m_SourceFilename[enum_cast(srctype)].substr(0, n) + ".sym"; symName = m_SourceFilename[enum_cast(srctype)].substr(0, n) + ".sym";
R5900SymbolMap.LoadNocashSym(symName.c_str()); R5900SymbolMap.LoadNocashSym(symName.c_str());
R5900SymbolMap.UpdateActiveSymbols(); R5900SymbolMap.SortSymbols();
} }
} }

View File

@ -77,7 +77,7 @@ static void parseDisasm(SymbolMap& map, const char* disasm, char* opcode, char*
u32 branchTarget; u32 branchTarget;
sscanf(disasm+3,"0x%08x",&branchTarget); sscanf(disasm+3,"0x%08x",&branchTarget);
const std::string addressSymbol = map.GetLabelString(branchTarget); const std::string addressSymbol = map.GetLabelName(branchTarget);
if (!addressSymbol.empty() && insertSymbols) if (!addressSymbol.empty() && insertSymbols)
{ {
arguments += std::snprintf(arguments, arguments_size, "%s",addressSymbol.c_str()); arguments += std::snprintf(arguments, arguments_size, "%s",addressSymbol.c_str());
@ -777,7 +777,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
case MACRO_LI: case MACRO_LI:
dest.name = name; dest.name = name;
addressSymbol = cpu->GetSymbolMap().GetLabelString(immediate); addressSymbol = cpu->GetSymbolMap().GetLabelName(immediate);
if (!addressSymbol.empty() && insertSymbols) if (!addressSymbol.empty() && insertSymbols)
{ {
std::snprintf(buffer,std::size(buffer),"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str()); std::snprintf(buffer,std::size(buffer),"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str());
@ -793,7 +793,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
case MACRO_MEMORYIMM: case MACRO_MEMORYIMM:
dest.name = name; dest.name = name;
addressSymbol = cpu->GetSymbolMap().GetLabelString(immediate); addressSymbol = cpu->GetSymbolMap().GetLabelName(immediate);
if (!addressSymbol.empty() && insertSymbols) if (!addressSymbol.empty() && insertSymbols)
{ {
std::snprintf(buffer,std::size(buffer),"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str()); std::snprintf(buffer,std::size(buffer),"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str());
@ -988,7 +988,7 @@ void DisassemblyData::createLines()
case DATATYPE_WORD: case DATATYPE_WORD:
{ {
value = memRead32(pos); value = memRead32(pos);
const std::string label = cpu->GetSymbolMap().GetLabelString(value); const std::string label = cpu->GetSymbolMap().GetLabelName(value);
if (!label.empty()) if (!label.empty())
std::snprintf(buffer,std::size(buffer),"%s",label.c_str()); std::snprintf(buffer,std::size(buffer),"%s",label.c_str());
else else

View File

@ -26,35 +26,34 @@ SymbolMap R3000SymbolMap;
#define strcasecmp stricmp #define strcasecmp stricmp
#endif #endif
#define ARRAY_SIZE(x) (sizeof((x))/sizeof(*(x))) #define ARRAY_SIZE(x) (sizeof((x)) / sizeof(*(x)))
void SymbolMap::SortSymbols() { void SymbolMap::SortSymbols()
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
AssignFunctionIndices(); AssignFunctionIndices();
} }
void SymbolMap::Clear() { void SymbolMap::Clear()
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
functions.clear(); functions.clear();
labels.clear(); labels.clear();
data.clear(); data.clear();
activeFunctions.clear();
activeLabels.clear();
activeData.clear();
activeModuleEnds.clear();
modules.clear();
} }
bool SymbolMap::LoadNocashSym(const char *filename) { bool SymbolMap::LoadNocashSym(const std::string& filename)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
FILE *f = FileSystem::OpenCFile(filename, "r"); FILE* f = FileSystem::OpenCFile(filename.c_str(), "r");
if (!f) if (!f)
return false; return false;
while (!feof(f)) { while (!feof(f))
{
char line[256], value[256] = {0}; char line[256], value[256] = {0};
char *p = fgets(line, 256, f); char* p = fgets(line, 256, f);
if (p == NULL) if (p == NULL)
break; break;
@ -64,38 +63,53 @@ bool SymbolMap::LoadNocashSym(const char *filename) {
if (address == 0 && strcmp(value, "0") == 0) if (address == 0 && strcmp(value, "0") == 0)
continue; continue;
if (value[0] == '.') { if (value[0] == '.')
{
// data directives // data directives
char* s = strchr(value, ':'); char* s = strchr(value, ':');
if (s != NULL) { if (s != NULL)
{
*s = 0; *s = 0;
u32 size = 0; u32 size = 0;
if (sscanf(s + 1, "%04X", &size) != 1) if (sscanf(s + 1, "%04X", &size) != 1)
continue; continue;
if (strcasecmp(value, ".byt") == 0) { if (strcasecmp(value, ".byt") == 0)
{
AddData(address, size, DATATYPE_BYTE, 0); AddData(address, size, DATATYPE_BYTE, 0);
} else if (strcasecmp(value, ".wrd") == 0) { }
else if (strcasecmp(value, ".wrd") == 0)
{
AddData(address, size, DATATYPE_HALFWORD, 0); AddData(address, size, DATATYPE_HALFWORD, 0);
} else if (strcasecmp(value, ".dbl") == 0) { }
else if (strcasecmp(value, ".dbl") == 0)
{
AddData(address, size, DATATYPE_WORD, 0); AddData(address, size, DATATYPE_WORD, 0);
} else if (strcasecmp(value, ".asc") == 0) { }
else if (strcasecmp(value, ".asc") == 0)
{
AddData(address, size, DATATYPE_ASCII, 0); AddData(address, size, DATATYPE_ASCII, 0);
} }
} }
} else { // labels }
else
{ // labels
int size = 1; int size = 1;
char* seperator = strchr(value, ','); char* seperator = strchr(value, ',');
if (seperator != NULL) { if (seperator != NULL)
{
*seperator = 0; *seperator = 0;
sscanf(seperator+1,"%08X",&size); sscanf(seperator + 1, "%08X", &size);
} }
if (size != 1) { if (size != 1)
AddFunction(value, address,size, 0); {
} else { AddFunction(value, address, size);
AddLabel(value, address, 0); }
else
{
AddLabel(value, address);
} }
} }
} }
@ -104,16 +118,18 @@ bool SymbolMap::LoadNocashSym(const char *filename) {
return true; return true;
} }
SymbolType SymbolMap::GetSymbolType(u32 address) const { SymbolType SymbolMap::GetSymbolType(u32 address) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
if (activeFunctions.find(address) != activeFunctions.end()) if (functions.find(address) != functions.end())
return ST_FUNCTION; return ST_FUNCTION;
if (activeData.find(address) != activeData.end()) if (data.find(address) != data.end())
return ST_DATA; return ST_DATA;
return ST_NONE; return ST_NONE;
} }
bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask) const { bool SymbolMap::GetSymbolInfo(SymbolInfo* info, u32 address, SymbolType symmask) const
{
u32 functionAddress = INVALID_ADDRESS; u32 functionAddress = INVALID_ADDRESS;
u32 dataAddress = INVALID_ADDRESS; u32 dataAddress = INVALID_ADDRESS;
@ -123,9 +139,12 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask)
if (symmask & ST_DATA) if (symmask & ST_DATA)
dataAddress = GetDataStart(address); dataAddress = GetDataStart(address);
if (functionAddress == INVALID_ADDRESS || dataAddress == INVALID_ADDRESS) { if (functionAddress == INVALID_ADDRESS || dataAddress == INVALID_ADDRESS)
if (functionAddress != INVALID_ADDRESS) { {
if (info != NULL) { if (functionAddress != INVALID_ADDRESS)
{
if (info != NULL)
{
info->type = ST_FUNCTION; info->type = ST_FUNCTION;
info->address = functionAddress; info->address = functionAddress;
info->size = GetFunctionSize(functionAddress); info->size = GetFunctionSize(functionAddress);
@ -134,8 +153,10 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask)
return true; return true;
} }
if (dataAddress != INVALID_ADDRESS) { if (dataAddress != INVALID_ADDRESS)
if (info != NULL) { {
if (info != NULL)
{
info->type = ST_DATA; info->type = ST_DATA;
info->address = dataAddress; info->address = dataAddress;
info->size = GetDataSize(dataAddress); info->size = GetDataSize(dataAddress);
@ -148,7 +169,8 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask)
} }
// if both exist, return the function // if both exist, return the function
if (info != NULL) { if (info != NULL)
{
info->type = ST_FUNCTION; info->type = ST_FUNCTION;
info->address = functionAddress; info->address = functionAddress;
info->size = GetFunctionSize(functionAddress); info->size = GetFunctionSize(functionAddress);
@ -157,16 +179,17 @@ bool SymbolMap::GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask)
return true; return true;
} }
u32 SymbolMap::GetNextSymbolAddress(u32 address, SymbolType symmask) { u32 SymbolMap::GetNextSymbolAddress(u32 address, SymbolType symmask)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
const auto functionEntry = symmask & ST_FUNCTION ? activeFunctions.upper_bound(address) : activeFunctions.end(); const auto functionEntry = symmask & ST_FUNCTION ? functions.upper_bound(address) : functions.end();
const auto dataEntry = symmask & ST_DATA ? activeData.upper_bound(address) : activeData.end(); const auto dataEntry = symmask & ST_DATA ? data.upper_bound(address) : data.end();
if (functionEntry == activeFunctions.end() && dataEntry == activeData.end()) if (functionEntry == functions.end() && dataEntry == data.end())
return INVALID_ADDRESS; return INVALID_ADDRESS;
u32 funcAddress = (functionEntry != activeFunctions.end()) ? functionEntry->first : 0xFFFFFFFF; u32 funcAddress = (functionEntry != functions.end()) ? functionEntry->first : 0xFFFFFFFF;
u32 dataAddress = (dataEntry != activeData.end()) ? dataEntry->first : 0xFFFFFFFF; u32 dataAddress = (dataEntry != data.end()) ? dataEntry->first : 0xFFFFFFFF;
if (funcAddress <= dataAddress) if (funcAddress <= dataAddress)
return funcAddress; return funcAddress;
@ -174,20 +197,24 @@ u32 SymbolMap::GetNextSymbolAddress(u32 address, SymbolType symmask) {
return dataAddress; return dataAddress;
} }
std::string SymbolMap::GetDescription(unsigned int address) const { std::string SymbolMap::GetDescription(unsigned int address) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
const char* labelName = NULL; std::string labelName;
u32 funcStart = GetFunctionStart(address); u32 funcStart = GetFunctionStart(address);
if (funcStart != INVALID_ADDRESS) { if (funcStart != INVALID_ADDRESS)
{
labelName = GetLabelName(funcStart); labelName = GetLabelName(funcStart);
} else { }
else
{
u32 dataStart = GetDataStart(address); u32 dataStart = GetDataStart(address);
if (dataStart != INVALID_ADDRESS) if (dataStart != INVALID_ADDRESS)
labelName = GetLabelName(dataStart); labelName = GetLabelName(dataStart);
} }
if (labelName != NULL) if (!labelName.empty())
return labelName; return labelName;
char descriptionTemp[256]; char descriptionTemp[256];
@ -195,31 +222,34 @@ std::string SymbolMap::GetDescription(unsigned int address) const {
return descriptionTemp; return descriptionTemp;
} }
std::vector<SymbolEntry> SymbolMap::GetAllSymbols(SymbolType symmask) { std::vector<SymbolEntry> SymbolMap::GetAllSymbols(SymbolType symmask)
{
std::vector<SymbolEntry> result; std::vector<SymbolEntry> result;
if (symmask & ST_FUNCTION) { if (symmask & ST_FUNCTION)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
for (auto it = activeFunctions.begin(); it != activeFunctions.end(); it++) { for (auto it = functions.begin(); it != functions.end(); it++)
{
SymbolEntry entry; SymbolEntry entry;
entry.address = it->first; entry.address = it->first;
entry.size = GetFunctionSize(entry.address); entry.size = GetFunctionSize(entry.address);
const char* name = GetLabelName(entry.address); entry.name = GetLabelName(entry.address);
if (name != NULL)
entry.name = name;
result.push_back(entry); result.push_back(entry);
} }
} }
if (symmask & ST_DATA) { if (symmask & ST_DATA)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
for (auto it = activeData.begin(); it != activeData.end(); it++) { for (auto it = data.begin(); it != data.end(); it++)
{
SymbolEntry entry; SymbolEntry entry;
entry.address = it->first; entry.address = it->first;
entry.size = GetDataSize(entry.address); entry.size = GetDataSize(entry.address);
const char* name = GetLabelName(entry.address); entry.name = GetLabelName(entry.address);
if (name != NULL)
entry.name = name;
result.push_back(entry); result.push_back(entry);
} }
} }
@ -227,393 +257,179 @@ std::vector<SymbolEntry> SymbolMap::GetAllSymbols(SymbolType symmask) {
return result; return result;
} }
void SymbolMap::AddModule(const char *name, u32 address, u32 size) { void SymbolMap::AddFunction(const std::string& name, u32 address, u32 size)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
for (auto it = modules.begin(), end = modules.end(); it != end; ++it) { auto existing = functions.find(address);
if (!strcmp(it->name, name)) {
// Just reactivate that one.
it->start = address;
it->size = size;
activeModuleEnds.insert(std::make_pair(it->start + it->size, *it));
UpdateActiveSymbols();
return;
}
}
ModuleEntry mod; if (existing != functions.end())
strncpy(mod.name, name, ARRAY_SIZE(mod.name)); {
mod.name[ARRAY_SIZE(mod.name) - 1] = 0;
mod.start = address;
mod.size = size;
mod.index = (int)modules.size() + 1;
modules.push_back(mod);
activeModuleEnds.insert(std::make_pair(mod.start + mod.size, mod));
UpdateActiveSymbols();
}
void SymbolMap::UnloadModule(u32 address, u32 size) {
std::lock_guard<std::recursive_mutex> guard(m_lock);
activeModuleEnds.erase(address + size);
UpdateActiveSymbols();
}
u32 SymbolMap::GetModuleRelativeAddr(u32 address, int moduleIndex) const {
std::lock_guard<std::recursive_mutex> guard(m_lock);
if (moduleIndex == -1) {
moduleIndex = GetModuleIndex(address);
}
for (auto it = modules.begin(), end = modules.end(); it != end; ++it) {
if (it->index == moduleIndex) {
return address - it->start;
}
}
return address;
}
u32 SymbolMap::GetModuleAbsoluteAddr(u32 relative, int moduleIndex) const {
std::lock_guard<std::recursive_mutex> guard(m_lock);
for (auto it = modules.begin(), end = modules.end(); it != end; ++it) {
if (it->index == moduleIndex) {
return it->start + relative;
}
}
return relative;
}
int SymbolMap::GetModuleIndex(u32 address) const {
std::lock_guard<std::recursive_mutex> guard(m_lock);
auto iter = activeModuleEnds.upper_bound(address);
if (iter == activeModuleEnds.end())
return -1;
return iter->second.index;
}
bool SymbolMap::IsModuleActive(int moduleIndex) const {
if (moduleIndex == 0) {
return true;
}
std::lock_guard<std::recursive_mutex> guard(m_lock);
for (auto it = activeModuleEnds.begin(), end = activeModuleEnds.end(); it != end; ++it) {
if (it->second.index == moduleIndex) {
return true;
}
}
return false;
}
std::vector<LoadedModuleInfo> SymbolMap::getAllModules() const {
std::lock_guard<std::recursive_mutex> guard(m_lock);
std::vector<LoadedModuleInfo> result;
for (size_t i = 0; i < modules.size(); i++) {
LoadedModuleInfo m;
m.name = modules[i].name;
m.address = modules[i].start;
m.size = modules[i].size;
u32 key = modules[i].start + modules[i].size;
m.active = activeModuleEnds.find(key) != activeModuleEnds.end();
result.push_back(m);
}
return result;
}
void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleIndex) {
std::lock_guard<std::recursive_mutex> guard(m_lock);
if (moduleIndex == -1) {
moduleIndex = GetModuleIndex(address);
}
// Is there an existing one?
u32 relAddress = GetModuleRelativeAddr(address, moduleIndex);
auto symbolKey = std::make_pair(moduleIndex, relAddress);
auto existing = functions.find(symbolKey);
if (existing == functions.end()) {
// Fall back: maybe it's got moduleIndex = 0.
existing = functions.find(std::make_pair(0, address));
}
if (existing != functions.end()) {
existing->second.size = size; existing->second.size = size;
if (existing->second.module != moduleIndex) { }
existing->second.start = relAddress; else
existing->second.module = moduleIndex; {
}
// Refresh the active item if it exists.
auto active = activeFunctions.find(address);
if (active != activeFunctions.end() && active->second.module == moduleIndex) {
activeFunctions.erase(active);
activeFunctions.insert(std::make_pair(address, existing->second));
}
} else {
FunctionEntry func; FunctionEntry func;
func.start = relAddress; func.start = address;
func.size = size; func.size = size;
func.index = (int)functions.size(); func.index = (int)functions.size();
func.module = moduleIndex; functions[address] = func;
functions[symbolKey] = func;
if (IsModuleActive(moduleIndex)) { functions.insert(std::make_pair(address, func));
activeFunctions.insert(std::make_pair(address, func));
}
} }
AddLabel(name, address, moduleIndex); AddLabel(name, address);
} }
u32 SymbolMap::GetFunctionStart(u32 address) const { u32 SymbolMap::GetFunctionStart(u32 address) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeFunctions.upper_bound(address); auto it = functions.upper_bound(address);
if (it == activeFunctions.end()) { if (it == functions.end())
{
// check last element // check last element
auto rit = activeFunctions.rbegin(); auto rit = functions.rbegin();
if (rit != activeFunctions.rend()) { if (rit != functions.rend())
{
u32 start = rit->first; u32 start = rit->first;
u32 size = rit->second.size; u32 size = rit->second.size;
if (start <= address && start+size > address) if (start <= address && start + size > address)
return start; return start;
} }
// otherwise there's no function that contains this address // otherwise there's no function that contains this address
return INVALID_ADDRESS; return INVALID_ADDRESS;
} }
if (it != activeFunctions.begin()) { if (it != functions.begin())
{
it--; it--;
u32 start = it->first; u32 start = it->first;
u32 size = it->second.size; u32 size = it->second.size;
if (start <= address && start+size > address) if (start <= address && start + size > address)
return start; return start;
} }
return INVALID_ADDRESS; return INVALID_ADDRESS;
} }
u32 SymbolMap::GetFunctionSize(u32 startAddress) const { u32 SymbolMap::GetFunctionSize(u32 startAddress) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeFunctions.find(startAddress); auto it = functions.find(startAddress);
if (it == activeFunctions.end()) if (it == functions.end())
return INVALID_ADDRESS; return INVALID_ADDRESS;
return it->second.size; return it->second.size;
} }
int SymbolMap::GetFunctionNum(u32 address) const { int SymbolMap::GetFunctionNum(u32 address) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
u32 start = GetFunctionStart(address); u32 start = GetFunctionStart(address);
if (start == INVALID_ADDRESS) if (start == INVALID_ADDRESS)
return INVALID_ADDRESS; return INVALID_ADDRESS;
auto it = activeFunctions.find(start); auto it = functions.find(start);
if (it == activeFunctions.end()) if (it == functions.end())
return INVALID_ADDRESS; return INVALID_ADDRESS;
return it->second.index; return it->second.index;
} }
void SymbolMap::AssignFunctionIndices() { void SymbolMap::AssignFunctionIndices()
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
int index = 0; int index = 0;
for (auto mod = activeModuleEnds.begin(), modend = activeModuleEnds.end(); mod != modend; ++mod) { auto begin = functions.lower_bound(0);
int moduleIndex = mod->second.index; auto end = functions.upper_bound(0xFFFFFFFF);
auto begin = functions.lower_bound(std::make_pair(moduleIndex, 0)); for (auto it = begin; it != end; ++it)
auto end = functions.upper_bound(std::make_pair(moduleIndex, 0xFFFFFFFF)); {
for (auto it = begin; it != end; ++it) { it->second.index = index++;
it->second.index = index++;
}
} }
} }
void SymbolMap::UpdateActiveSymbols() { bool SymbolMap::SetFunctionSize(u32 startAddress, u32 newSize)
// return; (slow in debug mode) {
std::lock_guard<std::recursive_mutex> guard(m_lock);
std::map<int, u32> activeModuleIndexes;
for (auto it = activeModuleEnds.begin(), end = activeModuleEnds.end(); it != end; ++it) {
activeModuleIndexes[it->second.index] = it->second.start;
}
activeFunctions.clear();
activeLabels.clear();
activeData.clear();
for (auto it = functions.begin(), end = functions.end(); it != end; ++it) {
const auto mod = activeModuleIndexes.find(it->second.module);
if (it->second.module <= 0) {
activeFunctions.insert(std::make_pair(it->second.start, it->second));
} else if (mod != activeModuleIndexes.end()) {
activeFunctions.insert(std::make_pair(mod->second + it->second.start, it->second));
}
}
for (auto it = labels.begin(), end = labels.end(); it != end; ++it) {
const auto mod = activeModuleIndexes.find(it->second.module);
if (it->second.module <= 0) {
activeLabels.insert(std::make_pair(it->second.addr, it->second));
} else if (mod != activeModuleIndexes.end()) {
activeLabels.insert(std::make_pair(mod->second + it->second.addr, it->second));
}
}
for (auto it = data.begin(), end = data.end(); it != end; ++it) {
const auto mod = activeModuleIndexes.find(it->second.module);
if (it->second.module <= 0) {
activeData.insert(std::make_pair(it->second.start, it->second));
} else if (mod != activeModuleIndexes.end()) {
activeData.insert(std::make_pair(mod->second + it->second.start, it->second));
}
}
AssignFunctionIndices();
}
bool SymbolMap::SetFunctionSize(u32 startAddress, u32 newSize) {
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto funcInfo = activeFunctions.find(startAddress); auto funcInfo = functions.find(startAddress);
if (funcInfo != activeFunctions.end()) { if (funcInfo != functions.end())
auto symbolKey = std::make_pair(funcInfo->second.module, funcInfo->second.start); {
auto func = functions.find(symbolKey); funcInfo->second.size = newSize;
if (func != functions.end()) {
func->second.size = newSize;
UpdateActiveSymbols();
}
} }
// TODO: check for overlaps // TODO: check for overlaps
return true; return true;
} }
bool SymbolMap::RemoveFunction(u32 startAddress, bool removeName) { bool SymbolMap::RemoveFunction(u32 startAddress)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeFunctions.find(startAddress); auto it = functions.find(startAddress);
if (it == activeFunctions.end()) if (it == functions.end())
return false; return false;
auto symbolKey = std::make_pair(it->second.module, it->second.start); functions.erase(it);
auto it2 = functions.find(symbolKey);
if (it2 != functions.end()) {
functions.erase(it2);
}
activeFunctions.erase(it);
if (removeName) { labels.erase(startAddress);
auto labelIt = activeLabels.find(startAddress);
if (labelIt != activeLabels.end()) {
symbolKey = std::make_pair(labelIt->second.module, labelIt->second.addr);
auto labelIt2 = labels.find(symbolKey);
if (labelIt2 != labels.end()) {
labels.erase(labelIt2);
}
activeLabels.erase(labelIt);
}
}
return true; return true;
} }
void SymbolMap::AddLabel(const char* name, u32 address, int moduleIndex) { void SymbolMap::AddLabel(const std::string& name, u32 address)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
if (moduleIndex == -1) { auto existing = labels.find(address);
moduleIndex = GetModuleIndex(address);
if (existing != labels.end())
{
// Adding a function will automatically call this.
// We don't want to overwrite the name if it's already set because
// label names are added before our functions
} }
else
// Is there an existing one? {
u32 relAddress = GetModuleRelativeAddr(address, moduleIndex);
auto symbolKey = std::make_pair(moduleIndex, relAddress);
auto existing = labels.find(symbolKey);
if (existing == labels.end()) {
// Fall back: maybe it's got moduleIndex = 0.
existing = labels.find(std::make_pair(0, address));
}
if (existing != labels.end()) {
// We leave an existing label alone, rather than overwriting.
// But we'll still upgrade it to the correct module / relative address.
if (existing->second.module != moduleIndex) {
existing->second.addr = relAddress;
existing->second.module = moduleIndex;
// Refresh the active item if it exists.
auto active = activeLabels.find(address);
if (active != activeLabels.end() && active->second.module == moduleIndex) {
activeLabels.erase(active);
activeLabels.insert(std::make_pair(address, existing->second));
}
}
} else {
LabelEntry label; LabelEntry label;
label.addr = relAddress; label.addr = address;
label.module = moduleIndex; label.name = name;
strncpy(label.name, name, 128);
label.name[127] = 0;
labels[symbolKey] = label; labels[address] = label;
if (IsModuleActive(moduleIndex)) {
activeLabels.insert(std::make_pair(address, label));
}
} }
} }
void SymbolMap::SetLabelName(const char* name, u32 address, bool updateImmediately) { void SymbolMap::SetLabelName(const std::string& name, u32 address)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto labelInfo = activeLabels.find(address); auto labelInfo = labels.find(address);
if (labelInfo == activeLabels.end()) { if (labelInfo == labels.end())
{
AddLabel(name, address); AddLabel(name, address);
} else { }
auto symbolKey = std::make_pair(labelInfo->second.module, labelInfo->second.addr); else
auto label = labels.find(symbolKey); {
if (label != labels.end()) { labelInfo->second.name = name;
strncpy(label->second.name, name, ARRAY_SIZE(label->second.name));
label->second.name[ARRAY_SIZE(label->second.name) - 1] = 0;
// Allow the caller to skip this as it causes extreme startup slowdown
// when this gets called for every function identified by the function replacement code.
if (updateImmediately) {
UpdateActiveSymbols();
}
}
} }
} }
const char *SymbolMap::GetLabelName(u32 address) const { std::string SymbolMap::GetLabelName(u32 address) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeLabels.find(address); auto it = labels.find(address);
if (it == activeLabels.end())
return NULL;
return it->second.name;
}
const char *SymbolMap::GetLabelNameRel(u32 relAddress, int moduleIndex) const {
std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = labels.find(std::make_pair(moduleIndex, relAddress));
if (it == labels.end()) if (it == labels.end())
return NULL; return "";
return it->second.name; return it->second.name;
} }
std::string SymbolMap::GetLabelString(u32 address) const { bool SymbolMap::GetLabelValue(const std::string& name, u32& dest)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
const char *label = GetLabelName(address); for (auto it = labels.begin(); it != labels.end(); it++)
if (label == NULL) {
return ""; if (name == it->second.name)
return label; {
}
bool SymbolMap::GetLabelValue(const char* name, u32& dest) {
std::lock_guard<std::recursive_mutex> guard(m_lock);
for (auto it = activeLabels.begin(); it != activeLabels.end(); it++) {
if (strcasecmp(name, it->second.name) == 0) {
dest = it->first; dest = it->first;
return true; return true;
} }
@ -622,92 +438,74 @@ bool SymbolMap::GetLabelValue(const char* name, u32& dest) {
return false; return false;
} }
void SymbolMap::AddData(u32 address, u32 size, DataType type, int moduleIndex) { void SymbolMap::AddData(u32 address, u32 size, DataType type, int moduleIndex)
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
if (moduleIndex == -1) { auto existing = data.find(address);
moduleIndex = GetModuleIndex(address);
}
// Is there an existing one? if (existing != data.end())
u32 relAddress = GetModuleRelativeAddr(address, moduleIndex); {
auto symbolKey = std::make_pair(moduleIndex, relAddress);
auto existing = data.find(symbolKey);
if (existing == data.end()) {
// Fall back: maybe it's got moduleIndex = 0.
existing = data.find(std::make_pair(0, address));
}
if (existing != data.end()) {
existing->second.size = size; existing->second.size = size;
existing->second.type = type; existing->second.type = type;
if (existing->second.module != moduleIndex) { }
existing->second.module = moduleIndex; else
existing->second.start = relAddress; {
}
// Refresh the active item if it exists.
auto active = activeData.find(address);
if (active != activeData.end() && active->second.module == moduleIndex) {
activeData.erase(active);
activeData.insert(std::make_pair(address, existing->second));
}
} else {
DataEntry entry; DataEntry entry;
entry.start = relAddress; entry.start = address;
entry.size = size; entry.size = size;
entry.type = type; entry.type = type;
entry.module = moduleIndex;
data[symbolKey] = entry; data[address] = entry;
if (IsModuleActive(moduleIndex)) {
activeData.insert(std::make_pair(address, entry));
}
} }
} }
u32 SymbolMap::GetDataStart(u32 address) const { u32 SymbolMap::GetDataStart(u32 address) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeData.upper_bound(address); auto it = data.upper_bound(address);
if (it == activeData.end()) if (it == data.end())
{ {
// check last element // check last element
auto rit = activeData.rbegin(); auto rit = data.rbegin();
if (rit != activeData.rend()) if (rit != data.rend())
{ {
u32 start = rit->first; u32 start = rit->first;
u32 size = rit->second.size; u32 size = rit->second.size;
if (start <= address && start+size > address) if (start <= address && start + size > address)
return start; return start;
} }
// otherwise there's no data that contains this address // otherwise there's no data that contains this address
return INVALID_ADDRESS; return INVALID_ADDRESS;
} }
if (it != activeData.begin()) { if (it != data.begin())
{
it--; it--;
u32 start = it->first; u32 start = it->first;
u32 size = it->second.size; u32 size = it->second.size;
if (start <= address && start+size > address) if (start <= address && start + size > address)
return start; return start;
} }
return INVALID_ADDRESS; return INVALID_ADDRESS;
} }
u32 SymbolMap::GetDataSize(u32 startAddress) const { u32 SymbolMap::GetDataSize(u32 startAddress) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeData.find(startAddress); auto it = data.find(startAddress);
if (it == activeData.end()) if (it == data.end())
return INVALID_ADDRESS; return INVALID_ADDRESS;
return it->second.size; return it->second.size;
} }
DataType SymbolMap::GetDataType(u32 startAddress) const { DataType SymbolMap::GetDataType(u32 startAddress) const
{
std::lock_guard<std::recursive_mutex> guard(m_lock); std::lock_guard<std::recursive_mutex> guard(m_lock);
auto it = activeData.find(startAddress); auto it = data.find(startAddress);
if (it == activeData.end()) if (it == data.end())
return DATATYPE_NONE; return DATATYPE_NONE;
return it->second.type; return it->second.type;
} }

View File

@ -23,69 +23,71 @@
#include "common/Pcsx2Types.h" #include "common/Pcsx2Types.h"
enum SymbolType { enum SymbolType
ST_NONE = 0, {
ST_NONE = 0,
ST_FUNCTION = 1, ST_FUNCTION = 1,
ST_DATA = 2, ST_DATA = 2,
ST_ALL = 3, ST_ALL = 3,
}; };
struct SymbolInfo { struct SymbolInfo
{
SymbolType type; SymbolType type;
u32 address; u32 address;
u32 size; u32 size;
}; };
struct SymbolEntry { struct SymbolEntry
{
std::string name; std::string name;
u32 address; u32 address;
u32 size; u32 size;
}; };
struct LoadedModuleInfo { struct LoadedModuleInfo
{
std::string name; std::string name;
u32 address; u32 address;
u32 size; u32 size;
bool active; bool active;
}; };
enum DataType { enum DataType
DATATYPE_NONE, DATATYPE_BYTE, DATATYPE_HALFWORD, DATATYPE_WORD, DATATYPE_ASCII {
DATATYPE_NONE,
DATATYPE_BYTE,
DATATYPE_HALFWORD,
DATATYPE_WORD,
DATATYPE_ASCII
}; };
class SymbolMap { class SymbolMap
{
public: public:
SymbolMap() {} SymbolMap() {}
void Clear(); void Clear();
void SortSymbols(); void SortSymbols();
bool LoadNocashSym(const char *ilename); bool LoadNocashSym(const std::string& filename);
SymbolType GetSymbolType(u32 address) const; SymbolType GetSymbolType(u32 address) const;
bool GetSymbolInfo(SymbolInfo *info, u32 address, SymbolType symmask = ST_FUNCTION) const; bool GetSymbolInfo(SymbolInfo* info, u32 address, SymbolType symmask = ST_FUNCTION) const;
u32 GetNextSymbolAddress(u32 address, SymbolType symmask); u32 GetNextSymbolAddress(u32 address, SymbolType symmask);
std::string GetDescription(unsigned int address) const; std::string GetDescription(unsigned int address) const;
std::vector<SymbolEntry> GetAllSymbols(SymbolType symmask); std::vector<SymbolEntry> GetAllSymbols(SymbolType symmask);
void AddModule(const char *name, u32 address, u32 size); void AddFunction(const std::string& name, u32 address, u32 size);
void UnloadModule(u32 address, u32 size);
u32 GetModuleRelativeAddr(u32 address, int moduleIndex = -1) const;
u32 GetModuleAbsoluteAddr(u32 relative, int moduleIndex) const;
int GetModuleIndex(u32 address) const;
bool IsModuleActive(int moduleIndex) const;
std::vector<LoadedModuleInfo> getAllModules() const;
void AddFunction(const char* name, u32 address, u32 size, int moduleIndex = -1);
u32 GetFunctionStart(u32 address) const; u32 GetFunctionStart(u32 address) const;
int GetFunctionNum(u32 address) const; int GetFunctionNum(u32 address) const;
u32 GetFunctionSize(u32 startAddress) const; u32 GetFunctionSize(u32 startAddress) const;
bool SetFunctionSize(u32 startAddress, u32 newSize); bool SetFunctionSize(u32 startAddress, u32 newSize);
bool RemoveFunction(u32 startAddress, bool removeName); bool RemoveFunction(u32 startAddress);
void AddLabel(const char* name, u32 address, int moduleIndex = -1); void AddLabel(const std::string& name, u32 address);
std::string GetLabelString(u32 address) const; std::string GetLabelName(u32 address) const;
void SetLabelName(const char* name, u32 address, bool updateImmediately = true); void SetLabelName(const std::string& name, u32 address);
bool GetLabelValue(const char* name, u32& dest); bool GetLabelValue(const std::string& name, u32& dest);
void AddData(u32 address, u32 size, DataType type, int moduleIndex = -1); void AddData(u32 address, u32 size, DataType type, int moduleIndex = -1);
u32 GetDataStart(u32 address) const; u32 GetDataStart(u32 address) const;
@ -94,56 +96,34 @@ public:
static const u32 INVALID_ADDRESS = (u32)-1; static const u32 INVALID_ADDRESS = (u32)-1;
void UpdateActiveSymbols(); bool IsEmpty() const { return functions.empty() && labels.empty() && data.empty(); };
bool IsEmpty() const { return activeFunctions.empty() && activeLabels.empty() && activeData.empty(); };
private: private:
void AssignFunctionIndices(); void AssignFunctionIndices();
const char *GetLabelName(u32 address) const;
const char *GetLabelNameRel(u32 relAddress, int moduleIndex) const;
struct FunctionEntry { struct FunctionEntry
{
u32 start; u32 start;
u32 size; u32 size;
int index; int index;
int module;
}; };
struct LabelEntry { struct LabelEntry
{
u32 addr; u32 addr;
int module; std::string name;
char name[128];
}; };
struct DataEntry { struct DataEntry
{
DataType type; DataType type;
u32 start; u32 start;
u32 size; u32 size;
int module;
}; };
struct ModuleEntry { std::map<u32, FunctionEntry> functions;
// Note: this index is +1, 0 matches any for backwards-compat. std::map<u32, LabelEntry> labels;
int index; std::map<u32, DataEntry> data;
u32 start;
u32 size;
char name[128];
};
// These are flattened, read-only copies of the actual data in active modules only.
std::map<u32, const FunctionEntry> activeFunctions;
std::map<u32, const LabelEntry> activeLabels;
std::map<u32, const DataEntry> activeData;
// This is indexed by the end address of the module.
std::map<u32, const ModuleEntry> activeModuleEnds;
typedef std::pair<int, u32> SymbolKey;
// These are indexed by the module id and relative address in the module.
std::map<SymbolKey, FunctionEntry> functions;
std::map<SymbolKey, LabelEntry> labels;
std::map<SymbolKey, DataEntry> data;
std::vector<ModuleEntry> modules;
mutable std::recursive_mutex m_lock; mutable std::recursive_mutex m_lock;
}; };

View File

@ -962,8 +962,6 @@ void VMManager::HandleELFChange(bool verbose_patches_if_changed)
MIPSAnalyst::ScanForFunctions( MIPSAnalyst::ScanForFunctions(
R5900SymbolMap, s_elf_text_range.first, s_elf_text_range.first + s_elf_text_range.second, true); R5900SymbolMap, s_elf_text_range.first, s_elf_text_range.first + s_elf_text_range.second, true);
R5900SymbolMap.UpdateActiveSymbols();
R3000SymbolMap.UpdateActiveSymbols();
} }
void VMManager::UpdateELFInfo(std::string elf_path) void VMManager::UpdateELFInfo(std::string elf_path)