From 3f6ac2fa68979fb58fb1292cb76aba951be1b8f0 Mon Sep 17 00:00:00 2001 From: Ziemas Date: Thu, 7 Oct 2021 20:18:44 +0200 Subject: [PATCH] Debugger: Separate EE and IOP symbol maps Previously they shared a single map which dosen't make sense. --- pcsx2/CDVD/CDVDaccess.cpp | 6 +-- pcsx2/DebugTools/DebugInterface.cpp | 12 ++++- pcsx2/DebugTools/DebugInterface.h | 4 ++ pcsx2/DebugTools/DisassemblyManager.cpp | 26 +++++----- pcsx2/DebugTools/MIPSAnalyst.cpp | 6 +-- pcsx2/DebugTools/MIPSAnalyst.h | 4 +- pcsx2/DebugTools/MipsStackWalk.cpp | 8 ++-- pcsx2/DebugTools/SymbolMap.cpp | 3 +- pcsx2/DebugTools/SymbolMap.h | 4 +- pcsx2/Dump.cpp | 8 ++-- pcsx2/Elfheader.cpp | 2 +- pcsx2/System/SysCoreThread.cpp | 5 +- pcsx2/gui/AppMain.cpp | 3 +- pcsx2/gui/Debugger/CtrlDisassemblyView.cpp | 56 +++++++++++----------- pcsx2/gui/Debugger/CtrlDisassemblyView.h | 1 + pcsx2/gui/Debugger/DebuggerLists.cpp | 4 +- pcsx2/gui/Debugger/DisassemblyDialog.cpp | 2 +- 17 files changed, 87 insertions(+), 67 deletions(-) diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index 0370397ba3..de5d9323d2 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -302,7 +302,7 @@ void CDVDsys_SetFile(CDVD_SourceType srctype, std::string newfile) m_SourceFilename[enum_cast(srctype)] = std::move(newfile); // look for symbol file - if (symbolMap.IsEmpty()) + if (R5900SymbolMap.IsEmpty()) { std::string symName; std::string::size_type n = m_SourceFilename[enum_cast(srctype)].rfind('.'); @@ -311,8 +311,8 @@ void CDVDsys_SetFile(CDVD_SourceType srctype, std::string newfile) else symName = m_SourceFilename[enum_cast(srctype)].substr(0, n) + ".sym"; - symbolMap.LoadNocashSym(symName.c_str()); - symbolMap.UpdateActiveSymbols(); + R5900SymbolMap.LoadNocashSym(symName.c_str()); + R5900SymbolMap.UpdateActiveSymbols(); } } diff --git a/pcsx2/DebugTools/DebugInterface.cpp b/pcsx2/DebugTools/DebugInterface.cpp index b1e715552b..d29c2b06fc 100644 --- a/pcsx2/DebugTools/DebugInterface.cpp +++ b/pcsx2/DebugTools/DebugInterface.cpp @@ -91,7 +91,7 @@ public: virtual bool parseSymbol(char* str, u64& symbolValue) { u32 value; - bool result = symbolMap.GetLabelValue(str, value); + bool result = cpu->GetSymbolMap().GetLabelValue(str, value); symbolValue = value; return result; } @@ -654,6 +654,11 @@ u32 R5900DebugInterface::getCycles() return cpuRegs.cycle; } +SymbolMap& R5900DebugInterface::GetSymbolMap() const +{ + return R5900SymbolMap; +} + // // R3000DebugInterface // @@ -893,3 +898,8 @@ u32 R3000DebugInterface::getCycles() { return psxRegs.cycle; } + +SymbolMap& R3000DebugInterface::GetSymbolMap() const +{ + return R3000SymbolMap; +} diff --git a/pcsx2/DebugTools/DebugInterface.h b/pcsx2/DebugTools/DebugInterface.h index a2ff716b2d..fa83cf8c35 100644 --- a/pcsx2/DebugTools/DebugInterface.h +++ b/pcsx2/DebugTools/DebugInterface.h @@ -16,6 +16,7 @@ #pragma once #include "MemoryTypes.h" #include "ExpressionParser.h" +#include "SymbolMap.h" enum { @@ -76,6 +77,7 @@ public: virtual bool isValidAddress(u32 address) = 0; virtual u32 getCycles() = 0; virtual BreakPointCpu getCpuType() = 0; + [[nodiscard]] virtual SymbolMap& GetSymbolMap() const = 0; bool initExpression(const char* exp, PostfixExpression& dest); bool parseExpression(PostfixExpression& exp, u64& dest); @@ -111,6 +113,7 @@ public: u32 getPC() override; void setPc(u32 newPc) override; void setRegister(int cat, int num, u128 newValue) override; + [[nodiscard]] SymbolMap& GetSymbolMap() const override; std::string disasm(u32 address, bool simplify) override; bool isValidAddress(u32 address) override; @@ -144,6 +147,7 @@ public: u32 getPC() override; void setPc(u32 newPc) override; void setRegister(int cat, int num, u128 newValue) override; + [[nodiscard]] SymbolMap& GetSymbolMap() const override; std::string disasm(u32 address, bool simplify) override; bool isValidAddress(u32 address) override; diff --git a/pcsx2/DebugTools/DisassemblyManager.cpp b/pcsx2/DebugTools/DisassemblyManager.cpp index ea310b7de5..be4a184f6b 100644 --- a/pcsx2/DebugTools/DisassemblyManager.cpp +++ b/pcsx2/DebugTools/DisassemblyManager.cpp @@ -44,7 +44,7 @@ static u32 computeHash(u32 address, u32 size) } -void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertSymbols) +void parseDisasm(SymbolMap& map, const char* disasm, char* opcode, char* arguments, bool insertSymbols) { if (*disasm == '(') { @@ -77,7 +77,7 @@ void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertS u32 branchTarget; sscanf(disasm+3,"0x%08x",&branchTarget); - const std::string addressSymbol = symbolMap.GetLabelString(branchTarget); + const std::string addressSymbol = map.GetLabelString(branchTarget); if (!addressSymbol.empty() && insertSymbols) { arguments += sprintf(arguments,"%s",addressSymbol.c_str()); @@ -161,18 +161,18 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024) } SymbolInfo info; - if (!symbolMap.GetSymbolInfo(&info,address,ST_ALL)) + if (!cpu->GetSymbolMap().GetSymbolInfo(&info,address,ST_ALL)) { if (address % 4) { - u32 next = std::min((address+3) & ~3,symbolMap.GetNextSymbolAddress(address,ST_ALL)); + u32 next = std::min((address+3) & ~3,cpu->GetSymbolMap().GetNextSymbolAddress(address,ST_ALL)); DisassemblyData* data = new DisassemblyData(cpu,address,next-address,DATATYPE_BYTE); entries[address] = data; address = next; continue; } - u32 next = symbolMap.GetNextSymbolAddress(address,ST_ALL); + u32 next = cpu->GetSymbolMap().GetNextSymbolAddress(address,ST_ALL); if ((next % 4) && next != 0xFFFFFFFF) { @@ -206,7 +206,7 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024) break; case ST_DATA: { - DisassemblyData* data = new DisassemblyData(cpu,info.address,info.size,symbolMap.GetDataType(info.address)); + DisassemblyData* data = new DisassemblyData(cpu,info.address,info.size,cpu->GetSymbolMap().GetDataType(info.address)); entries[info.address] = data; address = info.address+info.size; } @@ -536,7 +536,7 @@ void DisassemblyFunction::load() u32 funcPos = address; u32 funcEnd = address+size; - u32 nextData = symbolMap.GetNextSymbolAddress(funcPos-1,ST_DATA); + u32 nextData = cpu->GetSymbolMap().GetNextSymbolAddress(funcPos-1,ST_DATA); u32 opcodeSequenceStart = funcPos; while (funcPos < funcEnd) { @@ -545,12 +545,12 @@ void DisassemblyFunction::load() if (opcodeSequenceStart != funcPos) addOpcodeSequence(opcodeSequenceStart,funcPos); - DisassemblyData* data = new DisassemblyData(cpu,funcPos,symbolMap.GetDataSize(funcPos),symbolMap.GetDataType(funcPos)); + DisassemblyData* data = new DisassemblyData(cpu,funcPos,cpu->GetSymbolMap().GetDataSize(funcPos),cpu->GetSymbolMap().GetDataType(funcPos)); entries[funcPos] = data; lineAddresses.push_back(funcPos); funcPos += data->getTotalSize(); - nextData = symbolMap.GetNextSymbolAddress(funcPos-1,ST_DATA); + nextData = cpu->GetSymbolMap().GetNextSymbolAddress(funcPos-1,ST_DATA); opcodeSequenceStart = funcPos; continue; } @@ -694,7 +694,7 @@ bool DisassemblyOpcode::disassemble(u32 address, DisassemblyLineInfo& dest, bool char opcode[64],arguments[256]; std::string dis = cpu->disasm(address,insertSymbols); - parseDisasm(dis.c_str(),opcode,arguments,insertSymbols); + parseDisasm(cpu->GetSymbolMap(),dis.c_str(),opcode,arguments,insertSymbols); dest.type = DISTYPE_OPCODE; dest.name = opcode; dest.params = arguments; @@ -771,7 +771,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool case MACRO_LI: dest.name = name; - addressSymbol = symbolMap.GetLabelString(immediate); + addressSymbol = cpu->GetSymbolMap().GetLabelString(immediate); if (!addressSymbol.empty() && insertSymbols) { sprintf(buffer,"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str()); @@ -787,7 +787,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool case MACRO_MEMORYIMM: dest.name = name; - addressSymbol = symbolMap.GetLabelString(immediate); + addressSymbol = cpu->GetSymbolMap().GetLabelString(immediate); if (!addressSymbol.empty() && insertSymbols) { sprintf(buffer,"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str()); @@ -982,7 +982,7 @@ void DisassemblyData::createLines() case DATATYPE_WORD: { value = memRead32(pos); - const std::string label = symbolMap.GetLabelString(value); + const std::string label = cpu->GetSymbolMap().GetLabelString(value); if (!label.empty()) sprintf(buffer,"%s",label.c_str()); else diff --git a/pcsx2/DebugTools/MIPSAnalyst.cpp b/pcsx2/DebugTools/MIPSAnalyst.cpp index 6f9bb9c86e..e5273227cc 100644 --- a/pcsx2/DebugTools/MIPSAnalyst.cpp +++ b/pcsx2/DebugTools/MIPSAnalyst.cpp @@ -196,7 +196,7 @@ namespace MIPSAnalyst return furthestJumpbackAddr; } - void ScanForFunctions(u32 startAddr, u32 endAddr, bool insertSymbols) { + void ScanForFunctions(SymbolMap& map, u32 startAddr, u32 endAddr, bool insertSymbols) { AnalyzedFunction currentFunction = {startAddr}; u32 furthestBranch = 0; @@ -210,7 +210,7 @@ namespace MIPSAnalyst for (addr = startAddr; addr <= endAddr; addr += 4) { // Use pre-existing symbol map info if available. May be more reliable. SymbolInfo syminfo; - if (symbolMap.GetSymbolInfo(&syminfo, addr, ST_FUNCTION)) { + if (map.GetSymbolInfo(&syminfo, addr, ST_FUNCTION)) { addr = syminfo.address + syminfo.size - 4; // We still need to insert the func for hashing purposes. @@ -317,7 +317,7 @@ namespace MIPSAnalyst iter->size = iter->end - iter->start + 4; if (insertSymbols) { char temp[256]; - symbolMap.AddFunction(DefaultFunctionName(temp, iter->start), iter->start, iter->end - iter->start + 4); + map.AddFunction(DefaultFunctionName(temp, iter->start), iter->start, iter->end - iter->start + 4); } } } diff --git a/pcsx2/DebugTools/MIPSAnalyst.h b/pcsx2/DebugTools/MIPSAnalyst.h index 65fab05509..9f8b5df418 100644 --- a/pcsx2/DebugTools/MIPSAnalyst.h +++ b/pcsx2/DebugTools/MIPSAnalyst.h @@ -15,6 +15,8 @@ #pragma once +#include "SymbolMap.h" + class DebugInterface; @@ -39,7 +41,7 @@ namespace MIPSAnalyst char name[64]; }; - void ScanForFunctions(u32 startAddr, u32 endAddr, bool insertSymbols); + void ScanForFunctions(SymbolMap& map, u32 startAddr, u32 endAddr, bool insertSymbols); enum LoadStoreLRType { LOADSTORE_NORMAL, LOADSTORE_LEFT, LOADSTORE_RIGHT }; diff --git a/pcsx2/DebugTools/MipsStackWalk.cpp b/pcsx2/DebugTools/MipsStackWalk.cpp index bcf2c181af..23fce69810 100644 --- a/pcsx2/DebugTools/MipsStackWalk.cpp +++ b/pcsx2/DebugTools/MipsStackWalk.cpp @@ -41,9 +41,9 @@ namespace MipsStackWalk { // After this we assume we're stuck. const size_t MAX_DEPTH = 1024; - static u32 GuessEntry(u32 pc) { + static u32 GuessEntry(DebugInterface* cpu, u32 pc) { SymbolInfo info; - if (symbolMap.GetSymbolInfo(&info, pc)) { + if (cpu->GetSymbolMap().GetSymbolInfo(&info, pc)) { return info.address; } return INVALIDTARGET; @@ -174,10 +174,10 @@ namespace MipsStackWalk { u32 prevEntry = INVALIDTARGET; while (pc != threadEntry) { - u32 possibleEntry = GuessEntry(current.pc); + u32 possibleEntry = GuessEntry(cpu, current.pc); if (DetermineFrameInfo(cpu, current, possibleEntry, threadEntry, ra)) { frames.push_back(current); - if (current.entry == threadEntry || GuessEntry(current.entry) == threadEntry) { + if (current.entry == threadEntry || GuessEntry(cpu, current.entry) == threadEntry) { break; } if (current.entry == prevEntry || frames.size() >= MAX_DEPTH) { diff --git a/pcsx2/DebugTools/SymbolMap.cpp b/pcsx2/DebugTools/SymbolMap.cpp index e37bdc78cb..600b5fd5e6 100644 --- a/pcsx2/DebugTools/SymbolMap.cpp +++ b/pcsx2/DebugTools/SymbolMap.cpp @@ -18,7 +18,8 @@ #include "SymbolMap.h" #include -SymbolMap symbolMap; +SymbolMap R5900SymbolMap; +SymbolMap R3000SymbolMap; #ifdef _WIN32 #define strcasecmp stricmp diff --git a/pcsx2/DebugTools/SymbolMap.h b/pcsx2/DebugTools/SymbolMap.h index 5bf3aa5c13..1d2913dddc 100644 --- a/pcsx2/DebugTools/SymbolMap.h +++ b/pcsx2/DebugTools/SymbolMap.h @@ -148,5 +148,5 @@ private: mutable std::recursive_mutex m_lock; }; -extern SymbolMap symbolMap; - +extern SymbolMap R5900SymbolMap; +extern SymbolMap R3000SymbolMap; diff --git a/pcsx2/Dump.cpp b/pcsx2/Dump.cpp index c10f8ec727..eba0bd6eb4 100644 --- a/pcsx2/Dump.cpp +++ b/pcsx2/Dump.cpp @@ -222,9 +222,9 @@ void iDumpBlock(u32 ee_pc, u32 ee_size, uptr x86_pc, u32 x86_size) eff.Printf("\n"); - if (!symbolMap.GetLabelString(ee_pc).empty()) + if (!R5900SymbolMap.GetLabelString(ee_pc).empty()) { - eff.Printf( "%s\n", symbolMap.GetLabelString(ee_pc).c_str() ); + eff.Printf( "%s\n", R5900SymbolMap.GetLabelString(ee_pc).c_str() ); } for ( u32 i = ee_pc; i < ee_end; i += 4 ) @@ -277,9 +277,9 @@ void iDumpBlock( int startpc, u8 * ptr ) Path::Combine( EmuFolders::Logs, wxsFormat(L"R5900dump%.8X.txt", startpc) ), L"w" ); - if (!symbolMap.GetLabelString(startpc).empty()) + if (!R5900SymbolMap.GetLabelString(startpc).empty()) { - eff.Printf( "%s\n", symbolMap.GetLabelString(startpc).c_str() ); + eff.Printf( "%s\n", R5900SymbolMap.GetLabelString(startpc).c_str() ); } for ( uint i = startpc; i < s_nEndBlock; i += 4 ) diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 61439063b2..9e5009d64d 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -289,7 +289,7 @@ void ElfObject::loadSectionHeaders() for(uint i = 1; i < (secthead[i_st].sh_size / sizeof(Elf32_Sym)); i++) { if ((eS[i].st_value != 0) && (ELF32_ST_TYPE(eS[i].st_info) == 2)) { - symbolMap.AddLabel(&SymNames[eS[i].st_name],eS[i].st_value); + R5900SymbolMap.AddLabel(&SymNames[eS[i].st_name],eS[i].st_value); } } } diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index ebe06c964e..a9b5dbcda6 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -256,8 +256,9 @@ void SysCoreThread::GameStartingInThread() { GetMTGS().SendGameCRC(ElfCRC); - MIPSAnalyst::ScanForFunctions(ElfTextRange.first, ElfTextRange.first + ElfTextRange.second, true); - symbolMap.UpdateActiveSymbols(); + MIPSAnalyst::ScanForFunctions(R5900SymbolMap, ElfTextRange.first, ElfTextRange.first + ElfTextRange.second, true); + R5900SymbolMap.UpdateActiveSymbols(); + R3000SymbolMap.UpdateActiveSymbols(); sApp.PostAppMethod(&Pcsx2App::resetDebugger); ApplyLoadedPatches(PPT_ONCE_ON_LOAD); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 393f6e0214..9fc15451af 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -1009,7 +1009,8 @@ protected: DbgCon.WriteLn( Color_Gray, "(SysExecute) received." ); CoreThread.ResetQuick(); - symbolMap.Clear(); + R5900SymbolMap.Clear(); + R3000SymbolMap.Clear(); CBreakPoints::SetSkipFirst(BREAKPOINT_EE, 0); CBreakPoints::SetSkipFirst(BREAKPOINT_IOP, 0); // This function below gets called again from AppCoreThread.cpp and will pass the current ISO regardless if we diff --git a/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp b/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp index f8cf726cb2..8ca499af2c 100644 --- a/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp +++ b/pcsx2/gui/Debugger/CtrlDisassemblyView.cpp @@ -244,7 +244,7 @@ bool CtrlDisassemblyView::getDisasmAddressText(u32 address, char* dest, bool abb { if (displaySymbols) { - const std::string addressSymbol = symbolMap.GetLabelString(address); + const std::string addressSymbol = cpu->GetSymbolMap().GetLabelString(address); if (!addressSymbol.empty()) { for (int k = 0; addressSymbol[k] != 0; k++) @@ -392,10 +392,10 @@ void CtrlDisassemblyView::drawBranchLine(wxDC& dc, std::map& addressPo } } -int getBackgroundColor(unsigned int address) +int CtrlDisassemblyView::getBackgroundColor(unsigned int address) { u32 colors[6] = {0xFFe0FFFF, 0xFFFFe0e0, 0xFFe8e8FF, 0xFFFFe0FF, 0xFFe0FFe0, 0xFFFFFFe0}; - int n = symbolMap.GetFunctionNum(address); + int n = cpu->GetSymbolMap().GetFunctionNum(address); if (n == -1) return 0xFFFFFFFF; return colors[n % 6]; @@ -728,16 +728,16 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt) break; case ID_DISASM_RENAMEFUNCTION: { - u32 funcBegin = symbolMap.GetFunctionStart(curAddress); + u32 funcBegin = cpu->GetSymbolMap().GetFunctionStart(curAddress); if (funcBegin != 0xFFFFFFFF) { wxString newName = wxGetTextFromUser(L"Enter the new function name", L"New function name", - wxString(symbolMap.GetLabelString(funcBegin).c_str(), wxConvUTF8), this); + wxString(cpu->GetSymbolMap().GetLabelString(funcBegin).c_str(), wxConvUTF8), this); if (!newName.empty()) { const wxCharBuffer converted = newName.ToUTF8(); - symbolMap.SetLabelName(converted, funcBegin); + cpu->GetSymbolMap().SetLabelName(converted, funcBegin); postEvent(debEVT_MAPLOADED, 0); redraw(); } @@ -750,19 +750,19 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt) } case ID_DISASM_REMOVEFUNCTION: { - u32 funcBegin = symbolMap.GetFunctionStart(curAddress); + u32 funcBegin = cpu->GetSymbolMap().GetFunctionStart(curAddress); if (funcBegin != 0xFFFFFFFF) { - u32 prevBegin = symbolMap.GetFunctionStart(funcBegin - 1); + u32 prevBegin = cpu->GetSymbolMap().GetFunctionStart(funcBegin - 1); if (prevBegin != 0xFFFFFFFF) { - u32 expandedSize = symbolMap.GetFunctionSize(prevBegin) + symbolMap.GetFunctionSize(funcBegin); - symbolMap.SetFunctionSize(prevBegin, expandedSize); + u32 expandedSize = cpu->GetSymbolMap().GetFunctionSize(prevBegin) + cpu->GetSymbolMap().GetFunctionSize(funcBegin); + cpu->GetSymbolMap().SetFunctionSize(prevBegin, expandedSize); } - symbolMap.RemoveFunction(funcBegin, true); - symbolMap.SortSymbols(); - symbolMap.UpdateActiveSymbols(); + cpu->GetSymbolMap().RemoveFunction(funcBegin, true); + cpu->GetSymbolMap().SortSymbols(); + cpu->GetSymbolMap().UpdateActiveSymbols(); manager.clear(); postEvent(debEVT_MAPLOADED, 0); @@ -777,7 +777,7 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt) } case ID_DISASM_ADDFUNCTION: { - u32 prevBegin = symbolMap.GetFunctionStart(curAddress); + u32 prevBegin = cpu->GetSymbolMap().GetFunctionStart(curAddress); if (prevBegin != 0xFFFFFFFF) { if (prevBegin == curAddress) @@ -787,15 +787,15 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt) else { char symname[128]; - u32 prevSize = symbolMap.GetFunctionSize(prevBegin); + u32 prevSize = cpu->GetSymbolMap().GetFunctionSize(prevBegin); u32 newSize = curAddress - prevBegin; - symbolMap.SetFunctionSize(prevBegin, newSize); + cpu->GetSymbolMap().SetFunctionSize(prevBegin, newSize); newSize = prevSize - newSize; sprintf(symname, "u_un_%08X", curAddress); - symbolMap.AddFunction(symname, curAddress, newSize); - symbolMap.SortSymbols(); - symbolMap.UpdateActiveSymbols(); + cpu->GetSymbolMap().AddFunction(symname, curAddress, newSize); + cpu->GetSymbolMap().SortSymbols(); + cpu->GetSymbolMap().UpdateActiveSymbols(); manager.clear(); postEvent(debEVT_MAPLOADED, 0); @@ -806,9 +806,9 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt) char symname[128]; int newSize = selectRangeEnd - selectRangeStart; sprintf(symname, "u_un_%08X", selectRangeStart); - symbolMap.AddFunction(symname, selectRangeStart, newSize); - symbolMap.SortSymbols(); - symbolMap.UpdateActiveSymbols(); + cpu->GetSymbolMap().AddFunction(symname, selectRangeStart, newSize); + cpu->GetSymbolMap().SortSymbols(); + cpu->GetSymbolMap().UpdateActiveSymbols(); postEvent(debEVT_MAPLOADED, 0); } @@ -1042,7 +1042,7 @@ void CtrlDisassemblyView::updateStatusBarText() data = cpu->read32(line.info.dataAddress); } - const std::string addressSymbol = symbolMap.GetLabelString(data); + const std::string addressSymbol = cpu->GetSymbolMap().GetLabelString(data); if (!addressSymbol.empty()) { sprintf(text, "[%08X] = %s (%08X)", line.info.dataAddress, addressSymbol.c_str(), data); @@ -1082,7 +1082,7 @@ void CtrlDisassemblyView::updateStatusBarText() if (line.info.isBranch) { - const std::string addressSymbol = symbolMap.GetLabelString(line.info.branchTarget); + const std::string addressSymbol = cpu->GetSymbolMap().GetLabelString(line.info.branchTarget); if (addressSymbol.empty()) { sprintf(text, "%08X", line.info.branchTarget); @@ -1095,12 +1095,12 @@ void CtrlDisassemblyView::updateStatusBarText() } else if (line.type == DISTYPE_DATA) { - u32 start = symbolMap.GetDataStart(curAddress); + u32 start = cpu->GetSymbolMap().GetDataStart(curAddress); if (start == 0xFFFFFFFF) start = curAddress; u32 diff = curAddress - start; - const std::string label = symbolMap.GetLabelString(start); + const std::string label = cpu->GetSymbolMap().GetLabelString(start); if (!label.empty()) { @@ -1224,7 +1224,7 @@ std::string CtrlDisassemblyView::disassembleRange(u32 start, u32 size) { MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(cpu, start + i); - if (info.isBranch && symbolMap.GetLabelString(info.branchTarget).empty()) + if (info.isBranch && cpu->GetSymbolMap().GetLabelString(info.branchTarget).empty()) { if (branchAddresses.find(info.branchTarget) == branchAddresses.end()) { @@ -1258,7 +1258,7 @@ std::string CtrlDisassemblyView::disassembleRange(u32 start, u32 size) result += buffer; } - if (line.info.isBranch && !line.info.isBranchToRegister && symbolMap.GetLabelString(line.info.branchTarget).empty() && branchAddresses.find(line.info.branchTarget) != branchAddresses.end()) + if (line.info.isBranch && !line.info.isBranchToRegister && cpu->GetSymbolMap().GetLabelString(line.info.branchTarget).empty() && branchAddresses.find(line.info.branchTarget) != branchAddresses.end()) { sprintf(buffer, "pos_%08X", line.info.branchTarget); line.params = line.params.substr(0, line.params.find("0x")) + buffer; diff --git a/pcsx2/gui/Debugger/CtrlDisassemblyView.h b/pcsx2/gui/Debugger/CtrlDisassemblyView.h index fc567592ad..e322be2b39 100644 --- a/pcsx2/gui/Debugger/CtrlDisassemblyView.h +++ b/pcsx2/gui/Debugger/CtrlDisassemblyView.h @@ -69,6 +69,7 @@ private: void drawArguments(wxDC& dc, const DisassemblyLineInfo &line, int x, int y, wxColor& textColor, const std::set ¤tArguments); void assembleOpcode(u32 address, std::string defaultText); + int getBackgroundColor(unsigned int address); void postEvent(wxEventType type, wxString text); void postEvent(wxEventType type, int value); diff --git a/pcsx2/gui/Debugger/DebuggerLists.cpp b/pcsx2/gui/Debugger/DebuggerLists.cpp index 899cba4018..08c7837bb2 100644 --- a/pcsx2/gui/Debugger/DebuggerLists.cpp +++ b/pcsx2/gui/Debugger/DebuggerLists.cpp @@ -284,7 +284,7 @@ wxString BreakpointList::getColumnText(int item, int col) const } else { - const std::string sym = symbolMap.GetLabelString(displayedBreakPoints_[index].addr); + const std::string sym = cpu->GetSymbolMap().GetLabelString(displayedBreakPoints_[index].addr); if (!sym.empty()) { dest.Write("%s", sym.c_str()); @@ -775,7 +775,7 @@ wxString StackFramesList::getColumnText(int item, int col) const break; case SF_ENTRYNAME: { - const std::string sym = symbolMap.GetLabelString(frame.entry); + const std::string sym = cpu->GetSymbolMap().GetLabelString(frame.entry); if (!sym.empty()) { dest.Write("%s", sym.c_str()); diff --git a/pcsx2/gui/Debugger/DisassemblyDialog.cpp b/pcsx2/gui/Debugger/DisassemblyDialog.cpp index 87ddb72837..d7e411dea3 100644 --- a/pcsx2/gui/Debugger/DisassemblyDialog.cpp +++ b/pcsx2/gui/Debugger/DisassemblyDialog.cpp @@ -147,7 +147,7 @@ void CpuTabPage::reloadSymbolMap() { if (!symbolCount) { - auto funcs = symbolMap.GetAllSymbols(ST_FUNCTION); + auto funcs = cpu->GetSymbolMap().GetAllSymbols(ST_FUNCTION); symbolCount = funcs.size(); for (size_t i = 0; i < funcs.size(); i++) {