Move the symbol map to the heap, deallocate it when no game is running.

This commit is contained in:
Henrik Rydgard 2015-10-31 23:01:19 +01:00
parent 8b2da19a55
commit b998131581
21 changed files with 93 additions and 79 deletions

View File

@ -38,7 +38,7 @@ MemCheck::MemCheck()
void MemCheck::Log(u32 addr, bool write, int size, u32 pc)
{
if (result & MEMCHECK_LOG)
NOTICE_LOG(MEMMAP, "CHK %s%i at %08x (%s), PC=%08x (%s)", write ? "Write" : "Read", size * 8, addr, symbolMap.GetDescription(addr).c_str(), pc, symbolMap.GetDescription(pc).c_str());
NOTICE_LOG(MEMMAP, "CHK %s%i at %08x (%s), PC=%08x (%s)", write ? "Write" : "Read", size * 8, addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str());
}
void MemCheck::Action(u32 addr, bool write, int size, u32 pc)

View File

@ -75,7 +75,7 @@ void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertS
u32 branchTarget;
sscanf(disasm+3,"%08x",&branchTarget);
const std::string addressSymbol = symbolMap.GetLabelString(branchTarget);
const std::string addressSymbol = g_symbolMap->GetLabelString(branchTarget);
if (!addressSymbol.empty() && insertSymbols)
{
arguments += sprintf(arguments,"%s",addressSymbol.c_str());
@ -159,18 +159,18 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024)
}
SymbolInfo info;
if (!symbolMap.GetSymbolInfo(&info,address,ST_ALL))
if (!g_symbolMap->GetSymbolInfo(&info,address,ST_ALL))
{
if (address % 4)
{
u32 next = std::min<u32>((address+3) & ~3,symbolMap.GetNextSymbolAddress(address,ST_ALL));
u32 next = std::min<u32>((address+3) & ~3,g_symbolMap->GetNextSymbolAddress(address,ST_ALL));
DisassemblyData* data = new DisassemblyData(address,next-address,DATATYPE_BYTE);
entries[address] = data;
address = next;
continue;
}
u32 next = symbolMap.GetNextSymbolAddress(address,ST_ALL);
u32 next = g_symbolMap->GetNextSymbolAddress(address,ST_ALL);
if ((next % 4) && next != (u32)-1)
{
@ -204,7 +204,7 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024)
break;
case ST_DATA:
{
DisassemblyData* data = new DisassemblyData(info.address,info.size,symbolMap.GetDataType(info.address));
DisassemblyData* data = new DisassemblyData(info.address,info.size,g_symbolMap->GetDataType(info.address));
entries[info.address] = data;
address = info.address+info.size;
}
@ -286,7 +286,8 @@ u32 DisassemblyManager::getNthPreviousAddress(u32 address, int n)
while (Memory::IsValidAddress(address))
{
auto it = findDisassemblyEntry(entries,address,false);
if (it == entries.end())
break;
while (it != entries.end())
{
DisassemblyEntry* entry = it->second;
@ -313,7 +314,10 @@ u32 DisassemblyManager::getNthNextAddress(u32 address, int n)
while (Memory::IsValidAddress(address))
{
auto it = findDisassemblyEntry(entries,address,false);
if (it == entries.end()) {
break;
}
while (it != entries.end())
{
DisassemblyEntry* entry = it->second;
@ -544,7 +548,7 @@ void DisassemblyFunction::load()
u32 funcPos = address;
u32 funcEnd = address+size;
u32 nextData = symbolMap.GetNextSymbolAddress(funcPos-1,ST_DATA);
u32 nextData = g_symbolMap->GetNextSymbolAddress(funcPos-1,ST_DATA);
u32 opcodeSequenceStart = funcPos;
while (funcPos < funcEnd)
{
@ -553,12 +557,12 @@ void DisassemblyFunction::load()
if (opcodeSequenceStart != funcPos)
addOpcodeSequence(opcodeSequenceStart,funcPos);
DisassemblyData* data = new DisassemblyData(funcPos,symbolMap.GetDataSize(funcPos),symbolMap.GetDataType(funcPos));
DisassemblyData* data = new DisassemblyData(funcPos,g_symbolMap->GetDataSize(funcPos),g_symbolMap->GetDataType(funcPos));
entries[funcPos] = data;
lineAddresses.push_back(funcPos);
funcPos += data->getTotalSize();
nextData = symbolMap.GetNextSymbolAddress(funcPos-1,ST_DATA);
nextData = g_symbolMap->GetNextSymbolAddress(funcPos-1,ST_DATA);
opcodeSequenceStart = funcPos;
continue;
}
@ -766,7 +770,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
case MACRO_LI:
dest.name = name;
addressSymbol = symbolMap.GetLabelString(immediate);
addressSymbol = g_symbolMap->GetLabelString(immediate);
if (!addressSymbol.empty() && insertSymbols)
{
sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol.c_str());
@ -782,7 +786,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
case MACRO_MEMORYIMM:
dest.name = name;
addressSymbol = symbolMap.GetLabelString(immediate);
addressSymbol = g_symbolMap->GetLabelString(immediate);
if (!addressSymbol.empty() && insertSymbols)
{
sprintf(buffer,"%s,%s",DisassemblyManager::getCpu()->GetRegName(0,rt),addressSymbol.c_str());
@ -984,7 +988,7 @@ void DisassemblyData::createLines()
case DATATYPE_WORD:
{
value = Memory::Read_U32(pos);
const std::string label = symbolMap.GetLabelString(value);
const std::string label = g_symbolMap->GetLabelString(value);
if (!label.empty())
snprintf(buffer, sizeof(buffer), "%s", label.c_str());
else

View File

@ -37,7 +37,7 @@
#include "Core/MemMap.h"
#include "Core/Debugger/SymbolMap.h"
SymbolMap symbolMap;
SymbolMap *g_symbolMap;
void SymbolMap::SortSymbols() {
lock_guard guard(lock_);

View File

@ -173,5 +173,5 @@ private:
bool sawUnknownModule;
};
extern SymbolMap symbolMap;
extern SymbolMap *g_symbolMap;

View File

@ -663,10 +663,10 @@ bool ElfReader::LoadSymbols()
switch (type)
{
case STT_OBJECT:
symbolMap.AddData(value,size,DATATYPE_BYTE);
g_symbolMap->AddData(value,size,DATATYPE_BYTE);
break;
case STT_FUNC:
symbolMap.AddFunction(name,value,size);
g_symbolMap->AddFunction(name,value,size);
break;
default:
continue;

View File

@ -1270,7 +1270,7 @@ bool CanReplaceJalTo(u32 dest, const ReplacementTableEntry **entry, u32 *funcSiz
return false;
// Make sure we don't replace if there are any breakpoints inside.
*funcSize = symbolMap.GetFunctionSize(dest);
*funcSize = g_symbolMap->GetFunctionSize(dest);
if (*funcSize == SymbolMap::INVALID_ADDRESS) {
if (CBreakPoints::IsAddressBreakPoint(dest)) {
return false;

View File

@ -227,7 +227,7 @@ public:
} else {
userMemory.Free(memoryBlockAddr);
}
symbolMap.UnloadModule(memoryBlockAddr, memoryBlockSize);
g_symbolMap->UnloadModule(memoryBlockAddr, memoryBlockSize);
}
}
const char *GetName() override { return nm.name; }
@ -286,7 +286,7 @@ public:
char moduleName[29] = {0};
strncpy(moduleName, nm.name, ARRAY_SIZE(nm.name));
if (memoryBlockAddr != 0) {
symbolMap.AddModule(moduleName, memoryBlockAddr, memoryBlockSize);
g_symbolMap->AddModule(moduleName, memoryBlockAddr, memoryBlockSize);
}
}
}
@ -305,7 +305,7 @@ public:
// Add the symbol to the symbol map for debugging.
char temp[256];
sprintf(temp,"zz_%s", GetFuncName(func.moduleName, func.nid));
symbolMap.AddFunction(temp,func.stubAddr,8);
g_symbolMap->AddFunction(temp,func.stubAddr,8);
// Keep track and actually hook it up if possible.
importedFuncs.push_back(func);
@ -999,7 +999,7 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, bool fromT
}
if (!module->isFake && module->memoryBlockAddr != 0) {
symbolMap.AddModule(moduleName, module->memoryBlockAddr, module->memoryBlockSize);
g_symbolMap->AddModule(moduleName, module->memoryBlockAddr, module->memoryBlockSize);
}
SectionID textSection = reader.GetSectionByName(".text");

View File

@ -23,6 +23,6 @@
Host *host;
bool Host::AttemptLoadSymbolMap() {
symbolMap.Clear();
g_symbolMap->Clear();
return false;
}

View File

@ -940,9 +940,9 @@ skip:
// Use pre-existing symbol map info if available. May be more reliable.
SymbolInfo syminfo;
if (addrNextSym <= addr) {
addrNextSym = symbolMap.FindPossibleFunctionAtAfter(addr);
addrNextSym = g_symbolMap->FindPossibleFunctionAtAfter(addr);
}
if (addrNextSym <= addr && symbolMap.GetSymbolInfo(&syminfo, addr, ST_FUNCTION)) {
if (addrNextSym <= addr && g_symbolMap->GetSymbolInfo(&syminfo, addr, ST_FUNCTION)) {
addr = syminfo.address + syminfo.size - 4;
// We still need to insert the func for hashing purposes.
@ -1073,7 +1073,7 @@ skip:
iter->size = iter->end - iter->start + 4;
if (insertSymbols && !iter->foundInSymbolMap) {
char temp[256];
symbolMap.AddFunction(DefaultFunctionName(temp, iter->start), iter->start, iter->end - iter->start + 4);
g_symbolMap->AddFunction(DefaultFunctionName(temp, iter->start), iter->start, iter->end - iter->start + 4);
}
}
@ -1183,7 +1183,7 @@ skip:
continue;
}
// Functions with default names aren't very interesting either.
const std::string name = symbolMap.GetLabelString(f.start);
const std::string name = g_symbolMap->GetLabelString(f.start);
if (IsDefaultFunction(name)) {
continue;
}
@ -1252,11 +1252,11 @@ skip:
if (f.hash == mf->hash && f.size == mf->size) {
strncpy(f.name, mf->name, sizeof(mf->name) - 1);
std::string existingLabel = symbolMap.GetLabelString(f.start);
std::string existingLabel = g_symbolMap->GetLabelString(f.start);
char defaultLabel[256];
// If it was renamed, keep it. Only change the name if it's still the default.
if (existingLabel.empty() || existingLabel == DefaultFunctionName(defaultLabel, f.start)) {
symbolMap.SetLabelName(mf->name, f.start);
g_symbolMap->SetLabelName(mf->name, f.start);
}
}
}

View File

@ -79,7 +79,7 @@ bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address)
args.memoryFile = &file;
args.errorsResult = &errors;
symbolMap.GetLabels(args.labels);
g_symbolMap->GetLabels(args.labels);
errorText = L"";
if (!runArmips(args))

View File

@ -111,7 +111,7 @@ public:
bool parseSymbol(char* str, uint32_t& symbolValue) override
{
return symbolMap.GetLabelValue(str,symbolValue);
return g_symbolMap->GetLabelValue(str,symbolValue);
}
uint32_t getReferenceValue(uint32_t referenceIndex) override
@ -220,13 +220,13 @@ void MIPSDebugInterface::toggleBreakpoint(unsigned int address)
int MIPSDebugInterface::getColor(unsigned int address)
{
int colors[6] = {0xe0FFFF,0xFFe0e0,0xe8e8FF,0xFFe0FF,0xe0FFe0,0xFFFFe0};
int n=symbolMap.GetFunctionNum(address);
int n=g_symbolMap->GetFunctionNum(address);
if (n==-1) return 0xFFFFFF;
return colors[n%6];
}
std::string MIPSDebugInterface::getDescription(unsigned int address)
{
return symbolMap.GetDescription(address);
return g_symbolMap->GetDescription(address);
}
bool MIPSDebugInterface::initExpression(const char* exp, PostfixExpression& dest)

View File

@ -38,7 +38,7 @@ namespace MIPSStackWalk {
static u32 GuessEntry(u32 pc) {
SymbolInfo info;
if (symbolMap.GetSymbolInfo(&info, pc)) {
if (g_symbolMap->GetSymbolInfo(&info, pc)) {
return info.address;
}
return INVALIDTARGET;

View File

@ -470,7 +470,7 @@ bool Jit::DescribeCodePtr(const u8 *ptr, std::string &name) {
name = "UnknownOrDeletedBlock";
} else if (jitAddr != (u32)-1) {
char temp[1024];
const std::string label = symbolMap.GetDescription(jitAddr);
const std::string label = g_symbolMap->GetDescription(jitAddr);
if (!label.empty())
snprintf(temp, sizeof(temp), "%08x_%s", jitAddr, label.c_str());
else
@ -552,7 +552,7 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op)
return;
}
u32 funcSize = symbolMap.GetFunctionSize(GetCompilerPC());
u32 funcSize = g_symbolMap->GetFunctionSize(GetCompilerPC());
bool disabled = (entry->flags & REPFLAG_DISABLED) != 0;
if (!disabled && funcSize != SymbolMap::INVALID_ADDRESS && funcSize > sizeof(u32)) {
// We don't need to disable hooks, the code will still run.

View File

@ -35,6 +35,7 @@
#include "Core/MIPS/MIPS.h"
#include "Core/MIPS/MIPSAnalyst.h"
#include "Debugger/SymbolMap.h"
#include "Core/Host.h"
#include "Core/System.h"
#include "Core/HLE/HLE.h"
@ -170,6 +171,8 @@ void CPU_Shutdown();
void CPU_Init() {
coreState = CORE_POWERUP;
currentMIPS = &mipsr4k;
g_symbolMap = new SymbolMap();
// Default memory settings
// Seems to be the safest place currently..
@ -266,6 +269,9 @@ void CPU_Shutdown() {
loadedFile = nullptr;
delete coreParameter.mountIsoLoader;
delete g_symbolMap;
g_symbolMap = nullptr;
coreParameter.mountIsoLoader = nullptr;
}

View File

@ -206,7 +206,7 @@ bool CtrlDisAsmView::getDisasmAddressText(u32 address, char* dest, bool abbrevia
if (displaySymbols)
{
const std::string addressSymbol = symbolMap.GetLabelString(address);
const std::string addressSymbol = g_symbolMap->GetLabelString(address);
if (!addressSymbol.empty())
{
for (int k = 0; addressSymbol[k] != 0; k++)
@ -969,15 +969,15 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
break;
case ID_DISASM_RENAMEFUNCTION:
{
u32 funcBegin = symbolMap.GetFunctionStart(curAddress);
u32 funcBegin = g_symbolMap->GetFunctionStart(curAddress);
if (funcBegin != -1)
{
char name[256];
std::string newname;
strncpy_s(name, symbolMap.GetLabelString(funcBegin).c_str(),_TRUNCATE);
strncpy_s(name, g_symbolMap->GetLabelString(funcBegin).c_str(),_TRUNCATE);
if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), L"New function name", name, newname)) {
symbolMap.SetLabelName(newname.c_str(),funcBegin);
u32 funcSize = symbolMap.GetFunctionSize(curAddress);
g_symbolMap->SetLabelName(newname.c_str(),funcBegin);
u32 funcSize = g_symbolMap->GetFunctionSize(curAddress);
MIPSAnalyst::RegisterFunction(funcBegin, funcSize, newname.c_str());
MIPSAnalyst::UpdateHashMap();
MIPSAnalyst::ApplyHashMap();
@ -994,18 +994,18 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_DISASM_REMOVEFUNCTION:
{
char statusBarTextBuff[256];
u32 funcBegin = symbolMap.GetFunctionStart(curAddress);
u32 funcBegin = g_symbolMap->GetFunctionStart(curAddress);
if (funcBegin != -1)
{
u32 prevBegin = symbolMap.GetFunctionStart(funcBegin-1);
u32 prevBegin = g_symbolMap->GetFunctionStart(funcBegin-1);
if (prevBegin != -1)
{
u32 expandedSize = symbolMap.GetFunctionSize(prevBegin)+symbolMap.GetFunctionSize(funcBegin);
symbolMap.SetFunctionSize(prevBegin,expandedSize);
u32 expandedSize = g_symbolMap->GetFunctionSize(prevBegin) + g_symbolMap->GetFunctionSize(funcBegin);
g_symbolMap->SetFunctionSize(prevBegin,expandedSize);
}
symbolMap.RemoveFunction(funcBegin,true);
symbolMap.SortSymbols();
g_symbolMap->RemoveFunction(funcBegin,true);
g_symbolMap->SortSymbols();
manager.clear();
SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0);
@ -1021,7 +1021,7 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_DISASM_ADDFUNCTION:
{
char statusBarTextBuff[256];
u32 prevBegin = symbolMap.GetFunctionStart(curAddress);
u32 prevBegin = g_symbolMap->GetFunctionStart(curAddress);
if (prevBegin != -1)
{
if (prevBegin == curAddress)
@ -1032,14 +1032,14 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
else
{
char symname[128];
u32 prevSize = symbolMap.GetFunctionSize(prevBegin);
u32 prevSize = g_symbolMap->GetFunctionSize(prevBegin);
u32 newSize = curAddress-prevBegin;
symbolMap.SetFunctionSize(prevBegin,newSize);
g_symbolMap->SetFunctionSize(prevBegin,newSize);
newSize = prevSize-newSize;
snprintf(symname,128,"u_un_%08X",curAddress);
symbolMap.AddFunction(symname,curAddress,newSize);
symbolMap.SortSymbols();
g_symbolMap->AddFunction(symname,curAddress,newSize);
g_symbolMap->SortSymbols();
manager.clear();
SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0);
@ -1050,8 +1050,8 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
char symname[128];
int newSize = selectRangeEnd - selectRangeStart;
snprintf(symname, 128, "u_un_%08X", selectRangeStart);
symbolMap.AddFunction(symname, selectRangeStart, newSize);
symbolMap.SortSymbols();
g_symbolMap->AddFunction(symname, selectRangeStart, newSize);
g_symbolMap->SortSymbols();
SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0);
}
@ -1111,7 +1111,7 @@ void CtrlDisAsmView::updateStatusBarText()
// TODO: Could also be a float...
{
u32 data = Memory::Read_U32(line.info.dataAddress);
const std::string addressSymbol = symbolMap.GetLabelString(data);
const std::string addressSymbol = g_symbolMap->GetLabelString(data);
if (!addressSymbol.empty())
{
snprintf(text, sizeof(text), "[%08X] = %s (%08X)",line.info.dataAddress,addressSymbol.c_str(),data);
@ -1129,7 +1129,7 @@ void CtrlDisAsmView::updateStatusBarText()
if (line.info.isBranch)
{
const std::string addressSymbol = symbolMap.GetLabelString(line.info.branchTarget);
const std::string addressSymbol = g_symbolMap->GetLabelString(line.info.branchTarget);
if (addressSymbol.empty())
{
snprintf(text, sizeof(text), "%08X", line.info.branchTarget);
@ -1138,12 +1138,12 @@ void CtrlDisAsmView::updateStatusBarText()
}
}
} else if (line.type == DISTYPE_DATA) {
u32 start = symbolMap.GetDataStart(curAddress);
u32 start = g_symbolMap->GetDataStart(curAddress);
if (start == -1)
start = curAddress;
u32 diff = curAddress-start;
const std::string label = symbolMap.GetLabelString(start);
const std::string label = g_symbolMap->GetLabelString(start);
if (!label.empty()) {
if (diff != 0)
@ -1160,7 +1160,7 @@ void CtrlDisAsmView::updateStatusBarText()
SendMessage(GetParent(wnd),WM_DEB_SETSTATUSBARTEXT,0,(LPARAM)text);
const std::string label = symbolMap.GetLabelString(line.info.opcodeAddress);
const std::string label = g_symbolMap->GetLabelString(line.info.opcodeAddress);
if (!label.empty()) {
SendMessage(GetParent(wnd),WM_DEB_SETSTATUSBARTEXT,1,(LPARAM)label.c_str());
}
@ -1270,7 +1270,7 @@ std::string CtrlDisAsmView::disassembleRange(u32 start, u32 size)
{
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(debugger,start+i);
if (info.isBranch && symbolMap.GetLabelString(info.branchTarget).empty())
if (info.isBranch && g_symbolMap->GetLabelString(info.branchTarget).empty())
{
if (branchAddresses.find(info.branchTarget) == branchAddresses.end())
{
@ -1302,7 +1302,7 @@ std::string CtrlDisAsmView::disassembleRange(u32 start, u32 size)
}
if (line.info.isBranch && !line.info.isBranchToRegister
&& symbolMap.GetLabelString(line.info.branchTarget).empty()
&& g_symbolMap->GetLabelString(line.info.branchTarget).empty()
&& branchAddresses.find(line.info.branchTarget) != branchAddresses.end())
{
sprintf(buffer,"pos_%08X",line.info.branchTarget);

View File

@ -599,7 +599,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
case IDC_ALLFUNCTIONS:
{
symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
break;
}
default:
@ -864,7 +864,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
void CDisasm::NotifyMapLoaded()
{
symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
ptr->clearFunctions();
ptr->redraw();

View File

@ -509,7 +509,7 @@ void CtrlBreakpointList::GetColumnText(wchar_t* dest, int row, int col)
else
wsprintf(dest,L"0x%08X",mc.end-mc.start);
} else {
const std::string sym = symbolMap.GetLabelString(displayedBreakPoints_[index].addr);
const std::string sym = g_symbolMap->GetLabelString(displayedBreakPoints_[index].addr);
if (!sym.empty())
{
std::wstring s = ConvertUTF8ToWString(sym);
@ -682,7 +682,7 @@ void CtrlStackTraceView::GetColumnText(wchar_t* dest, int row, int col)
break;
case SF_ENTRYNAME:
{
const std::string sym = symbolMap.GetLabelString(frames[row].entry);
const std::string sym = g_symbolMap->GetLabelString(frames[row].entry);
if (!sym.empty()) {
wcscpy(dest, ConvertUTF8ToWString(sym).c_str());
} else {
@ -804,6 +804,10 @@ void CtrlModuleList::OnDoubleClick(int itemIndex, int column)
void CtrlModuleList::loadModules()
{
modules = symbolMap.getAllModules();
if (g_symbolMap) {
modules = g_symbolMap->getAllModules();
} else {
modules.clear();
}
Update();
}

View File

@ -94,7 +94,7 @@ void CMemoryDlg::NotifyMapLoaded()
if (m_hDlg)
{
HWND list = GetDlgItem(m_hDlg,IDC_SYMBOLS);
symbolMap.FillSymbolListBox(list,ST_DATA);
g_symbolMap->FillSymbolListBox(list,ST_DATA);
HWND lb = GetDlgItem(m_hDlg,IDC_REGIONS);
int sel = ComboBox_GetCurSel(lb);
ComboBox_ResetContent(lb);

View File

@ -731,7 +731,7 @@ namespace MainWindow {
case ID_DEBUG_LOADMAPFILE:
if (W32Util::BrowseForFileName(true, hWnd, L"Load .ppmap", 0, L"Maps\0*.ppmap\0All files\0*.*\0\0", L"ppmap", fn)) {
symbolMap.LoadSymbolMap(fn.c_str());
g_symbolMap->LoadSymbolMap(fn.c_str());
if (disasmWindow[0])
disasmWindow[0]->NotifyMapLoaded();
@ -743,12 +743,12 @@ namespace MainWindow {
case ID_DEBUG_SAVEMAPFILE:
if (W32Util::BrowseForFileName(false, hWnd, L"Save .ppmap", 0, L"Maps\0*.ppmap\0All files\0*.*\0\0", L"ppmap", fn))
symbolMap.SaveSymbolMap(fn.c_str());
g_symbolMap->SaveSymbolMap(fn.c_str());
break;
case ID_DEBUG_LOADSYMFILE:
if (W32Util::BrowseForFileName(true, hWnd, L"Load .sym", 0, L"Symbols\0*.sym\0All files\0*.*\0\0", L"sym", fn)) {
symbolMap.LoadNocashSym(fn.c_str());
g_symbolMap->LoadNocashSym(fn.c_str());
if (disasmWindow[0])
disasmWindow[0]->NotifyMapLoaded();
@ -760,11 +760,11 @@ namespace MainWindow {
case ID_DEBUG_SAVESYMFILE:
if (W32Util::BrowseForFileName(false, hWnd, L"Save .sym", 0, L"Symbols\0*.sym\0All files\0*.*\0\0", L"sym", fn))
symbolMap.SaveNocashSym(fn.c_str());
g_symbolMap->SaveNocashSym(fn.c_str());
break;
case ID_DEBUG_RESETSYMBOLTABLE:
symbolMap.Clear();
g_symbolMap->Clear();
for (int i = 0; i < numCPUs; i++)
if (disasmWindow[i])

View File

@ -205,7 +205,7 @@ void WindowsHost::PollControllers(InputState &input_state) {
}
void WindowsHost::BootDone() {
symbolMap.SortSymbols();
g_symbolMap->SortSymbols();
SendMessage(mainWindow_, WM_USER + 1, 0, 0);
SetDebugMode(!g_Config.bAutoRun);
@ -240,16 +240,16 @@ static std::string SymbolMapFilename(const char *currentFilename, char* ext) {
}
bool WindowsHost::AttemptLoadSymbolMap() {
bool result1 = symbolMap.LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str());
bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str());
// Load the old-style map file.
if (!result1)
result1 = symbolMap.LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".map").c_str());
bool result2 = symbolMap.LoadNocashSym(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".sym").c_str());
result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".map").c_str());
bool result2 = g_symbolMap->LoadNocashSym(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".sym").c_str());
return result1 || result2;
}
void WindowsHost::SaveSymbolMap() {
symbolMap.SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str());
g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str());
}
bool WindowsHost::IsDebuggingEnabled() {

View File

@ -42,7 +42,7 @@ public:
void BootDone() override {}
bool IsDebuggingEnabled() override { return false; }
bool AttemptLoadSymbolMap() override { symbolMap.Clear(); return false; }
bool AttemptLoadSymbolMap() override { g_symbolMap->Clear(); return false; }
bool ShouldSkipUI() override { return true; }