Debugger: Separate EE and IOP symbol maps

Previously they shared a single map which dosen't make sense.
This commit is contained in:
Ziemas 2021-10-07 20:18:44 +02:00 committed by refractionpcsx2
parent 7fd40f094a
commit 3f6ac2fa68
17 changed files with 87 additions and 67 deletions

View File

@ -302,7 +302,7 @@ void CDVDsys_SetFile(CDVD_SourceType srctype, std::string newfile)
m_SourceFilename[enum_cast(srctype)] = std::move(newfile); m_SourceFilename[enum_cast(srctype)] = std::move(newfile);
// look for symbol file // look for symbol file
if (symbolMap.IsEmpty()) if (R5900SymbolMap.IsEmpty())
{ {
std::string symName; std::string symName;
std::string::size_type n = m_SourceFilename[enum_cast(srctype)].rfind('.'); 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 else
symName = m_SourceFilename[enum_cast(srctype)].substr(0, n) + ".sym"; symName = m_SourceFilename[enum_cast(srctype)].substr(0, n) + ".sym";
symbolMap.LoadNocashSym(symName.c_str()); R5900SymbolMap.LoadNocashSym(symName.c_str());
symbolMap.UpdateActiveSymbols(); R5900SymbolMap.UpdateActiveSymbols();
} }
} }

View File

@ -91,7 +91,7 @@ public:
virtual bool parseSymbol(char* str, u64& symbolValue) virtual bool parseSymbol(char* str, u64& symbolValue)
{ {
u32 value; u32 value;
bool result = symbolMap.GetLabelValue(str, value); bool result = cpu->GetSymbolMap().GetLabelValue(str, value);
symbolValue = value; symbolValue = value;
return result; return result;
} }
@ -654,6 +654,11 @@ u32 R5900DebugInterface::getCycles()
return cpuRegs.cycle; return cpuRegs.cycle;
} }
SymbolMap& R5900DebugInterface::GetSymbolMap() const
{
return R5900SymbolMap;
}
// //
// R3000DebugInterface // R3000DebugInterface
// //
@ -893,3 +898,8 @@ u32 R3000DebugInterface::getCycles()
{ {
return psxRegs.cycle; return psxRegs.cycle;
} }
SymbolMap& R3000DebugInterface::GetSymbolMap() const
{
return R3000SymbolMap;
}

View File

@ -16,6 +16,7 @@
#pragma once #pragma once
#include "MemoryTypes.h" #include "MemoryTypes.h"
#include "ExpressionParser.h" #include "ExpressionParser.h"
#include "SymbolMap.h"
enum enum
{ {
@ -76,6 +77,7 @@ public:
virtual bool isValidAddress(u32 address) = 0; virtual bool isValidAddress(u32 address) = 0;
virtual u32 getCycles() = 0; virtual u32 getCycles() = 0;
virtual BreakPointCpu getCpuType() = 0; virtual BreakPointCpu getCpuType() = 0;
[[nodiscard]] virtual SymbolMap& GetSymbolMap() const = 0;
bool initExpression(const char* exp, PostfixExpression& dest); bool initExpression(const char* exp, PostfixExpression& dest);
bool parseExpression(PostfixExpression& exp, u64& dest); bool parseExpression(PostfixExpression& exp, u64& dest);
@ -111,6 +113,7 @@ public:
u32 getPC() override; u32 getPC() override;
void setPc(u32 newPc) override; void setPc(u32 newPc) override;
void setRegister(int cat, int num, u128 newValue) override; void setRegister(int cat, int num, u128 newValue) override;
[[nodiscard]] SymbolMap& GetSymbolMap() const override;
std::string disasm(u32 address, bool simplify) override; std::string disasm(u32 address, bool simplify) override;
bool isValidAddress(u32 address) override; bool isValidAddress(u32 address) override;
@ -144,6 +147,7 @@ public:
u32 getPC() override; u32 getPC() override;
void setPc(u32 newPc) override; void setPc(u32 newPc) override;
void setRegister(int cat, int num, u128 newValue) override; void setRegister(int cat, int num, u128 newValue) override;
[[nodiscard]] SymbolMap& GetSymbolMap() const override;
std::string disasm(u32 address, bool simplify) override; std::string disasm(u32 address, bool simplify) override;
bool isValidAddress(u32 address) override; bool isValidAddress(u32 address) override;

View File

@ -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 == '(') if (*disasm == '(')
{ {
@ -77,7 +77,7 @@ void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertS
u32 branchTarget; u32 branchTarget;
sscanf(disasm+3,"0x%08x",&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) if (!addressSymbol.empty() && insertSymbols)
{ {
arguments += sprintf(arguments,"%s",addressSymbol.c_str()); arguments += sprintf(arguments,"%s",addressSymbol.c_str());
@ -161,18 +161,18 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024)
} }
SymbolInfo info; SymbolInfo info;
if (!symbolMap.GetSymbolInfo(&info,address,ST_ALL)) if (!cpu->GetSymbolMap().GetSymbolInfo(&info,address,ST_ALL))
{ {
if (address % 4) if (address % 4)
{ {
u32 next = std::min<u32>((address+3) & ~3,symbolMap.GetNextSymbolAddress(address,ST_ALL)); u32 next = std::min<u32>((address+3) & ~3,cpu->GetSymbolMap().GetNextSymbolAddress(address,ST_ALL));
DisassemblyData* data = new DisassemblyData(cpu,address,next-address,DATATYPE_BYTE); DisassemblyData* data = new DisassemblyData(cpu,address,next-address,DATATYPE_BYTE);
entries[address] = data; entries[address] = data;
address = next; address = next;
continue; continue;
} }
u32 next = symbolMap.GetNextSymbolAddress(address,ST_ALL); u32 next = cpu->GetSymbolMap().GetNextSymbolAddress(address,ST_ALL);
if ((next % 4) && next != 0xFFFFFFFF) if ((next % 4) && next != 0xFFFFFFFF)
{ {
@ -206,7 +206,7 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024)
break; break;
case ST_DATA: 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; entries[info.address] = data;
address = info.address+info.size; address = info.address+info.size;
} }
@ -536,7 +536,7 @@ void DisassemblyFunction::load()
u32 funcPos = address; u32 funcPos = address;
u32 funcEnd = address+size; u32 funcEnd = address+size;
u32 nextData = symbolMap.GetNextSymbolAddress(funcPos-1,ST_DATA); u32 nextData = cpu->GetSymbolMap().GetNextSymbolAddress(funcPos-1,ST_DATA);
u32 opcodeSequenceStart = funcPos; u32 opcodeSequenceStart = funcPos;
while (funcPos < funcEnd) while (funcPos < funcEnd)
{ {
@ -545,12 +545,12 @@ void DisassemblyFunction::load()
if (opcodeSequenceStart != funcPos) if (opcodeSequenceStart != funcPos)
addOpcodeSequence(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; entries[funcPos] = data;
lineAddresses.push_back(funcPos); lineAddresses.push_back(funcPos);
funcPos += data->getTotalSize(); funcPos += data->getTotalSize();
nextData = symbolMap.GetNextSymbolAddress(funcPos-1,ST_DATA); nextData = cpu->GetSymbolMap().GetNextSymbolAddress(funcPos-1,ST_DATA);
opcodeSequenceStart = funcPos; opcodeSequenceStart = funcPos;
continue; continue;
} }
@ -694,7 +694,7 @@ bool DisassemblyOpcode::disassemble(u32 address, DisassemblyLineInfo& dest, bool
char opcode[64],arguments[256]; char opcode[64],arguments[256];
std::string dis = cpu->disasm(address,insertSymbols); 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.type = DISTYPE_OPCODE;
dest.name = opcode; dest.name = opcode;
dest.params = arguments; dest.params = arguments;
@ -771,7 +771,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest, bool
case MACRO_LI: case MACRO_LI:
dest.name = name; dest.name = name;
addressSymbol = symbolMap.GetLabelString(immediate); addressSymbol = cpu->GetSymbolMap().GetLabelString(immediate);
if (!addressSymbol.empty() && insertSymbols) if (!addressSymbol.empty() && insertSymbols)
{ {
sprintf(buffer,"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str()); 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: case MACRO_MEMORYIMM:
dest.name = name; dest.name = name;
addressSymbol = symbolMap.GetLabelString(immediate); addressSymbol = cpu->GetSymbolMap().GetLabelString(immediate);
if (!addressSymbol.empty() && insertSymbols) if (!addressSymbol.empty() && insertSymbols)
{ {
sprintf(buffer,"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str()); sprintf(buffer,"%s,%s",cpu->getRegisterName(0,rt),addressSymbol.c_str());
@ -982,7 +982,7 @@ void DisassemblyData::createLines()
case DATATYPE_WORD: case DATATYPE_WORD:
{ {
value = memRead32(pos); value = memRead32(pos);
const std::string label = symbolMap.GetLabelString(value); const std::string label = cpu->GetSymbolMap().GetLabelString(value);
if (!label.empty()) if (!label.empty())
sprintf(buffer,"%s",label.c_str()); sprintf(buffer,"%s",label.c_str());
else else

View File

@ -196,7 +196,7 @@ namespace MIPSAnalyst
return furthestJumpbackAddr; return furthestJumpbackAddr;
} }
void ScanForFunctions(u32 startAddr, u32 endAddr, bool insertSymbols) { void ScanForFunctions(SymbolMap& map, u32 startAddr, u32 endAddr, bool insertSymbols) {
AnalyzedFunction currentFunction = {startAddr}; AnalyzedFunction currentFunction = {startAddr};
u32 furthestBranch = 0; u32 furthestBranch = 0;
@ -210,7 +210,7 @@ namespace MIPSAnalyst
for (addr = startAddr; addr <= endAddr; addr += 4) { for (addr = startAddr; addr <= endAddr; addr += 4) {
// Use pre-existing symbol map info if available. May be more reliable. // Use pre-existing symbol map info if available. May be more reliable.
SymbolInfo syminfo; SymbolInfo syminfo;
if (symbolMap.GetSymbolInfo(&syminfo, addr, ST_FUNCTION)) { if (map.GetSymbolInfo(&syminfo, addr, ST_FUNCTION)) {
addr = syminfo.address + syminfo.size - 4; addr = syminfo.address + syminfo.size - 4;
// We still need to insert the func for hashing purposes. // We still need to insert the func for hashing purposes.
@ -317,7 +317,7 @@ namespace MIPSAnalyst
iter->size = iter->end - iter->start + 4; iter->size = iter->end - iter->start + 4;
if (insertSymbols) { if (insertSymbols) {
char temp[256]; 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);
} }
} }
} }

View File

@ -15,6 +15,8 @@
#pragma once #pragma once
#include "SymbolMap.h"
class DebugInterface; class DebugInterface;
@ -39,7 +41,7 @@ namespace MIPSAnalyst
char name[64]; 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 }; enum LoadStoreLRType { LOADSTORE_NORMAL, LOADSTORE_LEFT, LOADSTORE_RIGHT };

View File

@ -41,9 +41,9 @@ namespace MipsStackWalk {
// After this we assume we're stuck. // After this we assume we're stuck.
const size_t MAX_DEPTH = 1024; const size_t MAX_DEPTH = 1024;
static u32 GuessEntry(u32 pc) { static u32 GuessEntry(DebugInterface* cpu, u32 pc) {
SymbolInfo info; SymbolInfo info;
if (symbolMap.GetSymbolInfo(&info, pc)) { if (cpu->GetSymbolMap().GetSymbolInfo(&info, pc)) {
return info.address; return info.address;
} }
return INVALIDTARGET; return INVALIDTARGET;
@ -174,10 +174,10 @@ namespace MipsStackWalk {
u32 prevEntry = INVALIDTARGET; u32 prevEntry = INVALIDTARGET;
while (pc != threadEntry) { while (pc != threadEntry) {
u32 possibleEntry = GuessEntry(current.pc); u32 possibleEntry = GuessEntry(cpu, current.pc);
if (DetermineFrameInfo(cpu, current, possibleEntry, threadEntry, ra)) { if (DetermineFrameInfo(cpu, current, possibleEntry, threadEntry, ra)) {
frames.push_back(current); frames.push_back(current);
if (current.entry == threadEntry || GuessEntry(current.entry) == threadEntry) { if (current.entry == threadEntry || GuessEntry(cpu, current.entry) == threadEntry) {
break; break;
} }
if (current.entry == prevEntry || frames.size() >= MAX_DEPTH) { if (current.entry == prevEntry || frames.size() >= MAX_DEPTH) {

View File

@ -18,7 +18,8 @@
#include "SymbolMap.h" #include "SymbolMap.h"
#include <algorithm> #include <algorithm>
SymbolMap symbolMap; SymbolMap R5900SymbolMap;
SymbolMap R3000SymbolMap;
#ifdef _WIN32 #ifdef _WIN32
#define strcasecmp stricmp #define strcasecmp stricmp

View File

@ -148,5 +148,5 @@ private:
mutable std::recursive_mutex m_lock; mutable std::recursive_mutex m_lock;
}; };
extern SymbolMap symbolMap; extern SymbolMap R5900SymbolMap;
extern SymbolMap R3000SymbolMap;

View File

@ -222,9 +222,9 @@ void iDumpBlock(u32 ee_pc, u32 ee_size, uptr x86_pc, u32 x86_size)
eff.Printf("\n"); 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 ) 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" 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 ) for ( uint i = startpc; i < s_nEndBlock; i += 4 )

View File

@ -289,7 +289,7 @@ void ElfObject::loadSectionHeaders()
for(uint i = 1; i < (secthead[i_st].sh_size / sizeof(Elf32_Sym)); i++) { 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)) 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);
} }
} }
} }

View File

@ -256,8 +256,9 @@ void SysCoreThread::GameStartingInThread()
{ {
GetMTGS().SendGameCRC(ElfCRC); GetMTGS().SendGameCRC(ElfCRC);
MIPSAnalyst::ScanForFunctions(ElfTextRange.first, ElfTextRange.first + ElfTextRange.second, true); MIPSAnalyst::ScanForFunctions(R5900SymbolMap, ElfTextRange.first, ElfTextRange.first + ElfTextRange.second, true);
symbolMap.UpdateActiveSymbols(); R5900SymbolMap.UpdateActiveSymbols();
R3000SymbolMap.UpdateActiveSymbols();
sApp.PostAppMethod(&Pcsx2App::resetDebugger); sApp.PostAppMethod(&Pcsx2App::resetDebugger);
ApplyLoadedPatches(PPT_ONCE_ON_LOAD); ApplyLoadedPatches(PPT_ONCE_ON_LOAD);

View File

@ -1009,7 +1009,8 @@ protected:
DbgCon.WriteLn( Color_Gray, "(SysExecute) received." ); DbgCon.WriteLn( Color_Gray, "(SysExecute) received." );
CoreThread.ResetQuick(); CoreThread.ResetQuick();
symbolMap.Clear(); R5900SymbolMap.Clear();
R3000SymbolMap.Clear();
CBreakPoints::SetSkipFirst(BREAKPOINT_EE, 0); CBreakPoints::SetSkipFirst(BREAKPOINT_EE, 0);
CBreakPoints::SetSkipFirst(BREAKPOINT_IOP, 0); CBreakPoints::SetSkipFirst(BREAKPOINT_IOP, 0);
// This function below gets called again from AppCoreThread.cpp and will pass the current ISO regardless if we // This function below gets called again from AppCoreThread.cpp and will pass the current ISO regardless if we

View File

@ -244,7 +244,7 @@ bool CtrlDisassemblyView::getDisasmAddressText(u32 address, char* dest, bool abb
{ {
if (displaySymbols) if (displaySymbols)
{ {
const std::string addressSymbol = symbolMap.GetLabelString(address); const std::string addressSymbol = cpu->GetSymbolMap().GetLabelString(address);
if (!addressSymbol.empty()) if (!addressSymbol.empty())
{ {
for (int k = 0; addressSymbol[k] != 0; k++) for (int k = 0; addressSymbol[k] != 0; k++)
@ -392,10 +392,10 @@ void CtrlDisassemblyView::drawBranchLine(wxDC& dc, std::map<u32, int>& addressPo
} }
} }
int getBackgroundColor(unsigned int address) int CtrlDisassemblyView::getBackgroundColor(unsigned int address)
{ {
u32 colors[6] = {0xFFe0FFFF, 0xFFFFe0e0, 0xFFe8e8FF, 0xFFFFe0FF, 0xFFe0FFe0, 0xFFFFFFe0}; u32 colors[6] = {0xFFe0FFFF, 0xFFFFe0e0, 0xFFe8e8FF, 0xFFFFe0FF, 0xFFe0FFe0, 0xFFFFFFe0};
int n = symbolMap.GetFunctionNum(address); int n = cpu->GetSymbolMap().GetFunctionNum(address);
if (n == -1) if (n == -1)
return 0xFFFFFFFF; return 0xFFFFFFFF;
return colors[n % 6]; return colors[n % 6];
@ -728,16 +728,16 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
break; break;
case ID_DISASM_RENAMEFUNCTION: case ID_DISASM_RENAMEFUNCTION:
{ {
u32 funcBegin = symbolMap.GetFunctionStart(curAddress); u32 funcBegin = cpu->GetSymbolMap().GetFunctionStart(curAddress);
if (funcBegin != 0xFFFFFFFF) if (funcBegin != 0xFFFFFFFF)
{ {
wxString newName = wxGetTextFromUser(L"Enter the new function name", L"New function name", 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()) if (!newName.empty())
{ {
const wxCharBuffer converted = newName.ToUTF8(); const wxCharBuffer converted = newName.ToUTF8();
symbolMap.SetLabelName(converted, funcBegin); cpu->GetSymbolMap().SetLabelName(converted, funcBegin);
postEvent(debEVT_MAPLOADED, 0); postEvent(debEVT_MAPLOADED, 0);
redraw(); redraw();
} }
@ -750,19 +750,19 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
} }
case ID_DISASM_REMOVEFUNCTION: case ID_DISASM_REMOVEFUNCTION:
{ {
u32 funcBegin = symbolMap.GetFunctionStart(curAddress); u32 funcBegin = cpu->GetSymbolMap().GetFunctionStart(curAddress);
if (funcBegin != 0xFFFFFFFF) if (funcBegin != 0xFFFFFFFF)
{ {
u32 prevBegin = symbolMap.GetFunctionStart(funcBegin - 1); u32 prevBegin = cpu->GetSymbolMap().GetFunctionStart(funcBegin - 1);
if (prevBegin != 0xFFFFFFFF) if (prevBegin != 0xFFFFFFFF)
{ {
u32 expandedSize = symbolMap.GetFunctionSize(prevBegin) + symbolMap.GetFunctionSize(funcBegin); u32 expandedSize = cpu->GetSymbolMap().GetFunctionSize(prevBegin) + cpu->GetSymbolMap().GetFunctionSize(funcBegin);
symbolMap.SetFunctionSize(prevBegin, expandedSize); cpu->GetSymbolMap().SetFunctionSize(prevBegin, expandedSize);
} }
symbolMap.RemoveFunction(funcBegin, true); cpu->GetSymbolMap().RemoveFunction(funcBegin, true);
symbolMap.SortSymbols(); cpu->GetSymbolMap().SortSymbols();
symbolMap.UpdateActiveSymbols(); cpu->GetSymbolMap().UpdateActiveSymbols();
manager.clear(); manager.clear();
postEvent(debEVT_MAPLOADED, 0); postEvent(debEVT_MAPLOADED, 0);
@ -777,7 +777,7 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
} }
case ID_DISASM_ADDFUNCTION: case ID_DISASM_ADDFUNCTION:
{ {
u32 prevBegin = symbolMap.GetFunctionStart(curAddress); u32 prevBegin = cpu->GetSymbolMap().GetFunctionStart(curAddress);
if (prevBegin != 0xFFFFFFFF) if (prevBegin != 0xFFFFFFFF)
{ {
if (prevBegin == curAddress) if (prevBegin == curAddress)
@ -787,15 +787,15 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
else else
{ {
char symname[128]; char symname[128];
u32 prevSize = symbolMap.GetFunctionSize(prevBegin); u32 prevSize = cpu->GetSymbolMap().GetFunctionSize(prevBegin);
u32 newSize = curAddress - prevBegin; u32 newSize = curAddress - prevBegin;
symbolMap.SetFunctionSize(prevBegin, newSize); cpu->GetSymbolMap().SetFunctionSize(prevBegin, newSize);
newSize = prevSize - newSize; newSize = prevSize - newSize;
sprintf(symname, "u_un_%08X", curAddress); sprintf(symname, "u_un_%08X", curAddress);
symbolMap.AddFunction(symname, curAddress, newSize); cpu->GetSymbolMap().AddFunction(symname, curAddress, newSize);
symbolMap.SortSymbols(); cpu->GetSymbolMap().SortSymbols();
symbolMap.UpdateActiveSymbols(); cpu->GetSymbolMap().UpdateActiveSymbols();
manager.clear(); manager.clear();
postEvent(debEVT_MAPLOADED, 0); postEvent(debEVT_MAPLOADED, 0);
@ -806,9 +806,9 @@ void CtrlDisassemblyView::onPopupClick(wxCommandEvent& evt)
char symname[128]; char symname[128];
int newSize = selectRangeEnd - selectRangeStart; int newSize = selectRangeEnd - selectRangeStart;
sprintf(symname, "u_un_%08X", selectRangeStart); sprintf(symname, "u_un_%08X", selectRangeStart);
symbolMap.AddFunction(symname, selectRangeStart, newSize); cpu->GetSymbolMap().AddFunction(symname, selectRangeStart, newSize);
symbolMap.SortSymbols(); cpu->GetSymbolMap().SortSymbols();
symbolMap.UpdateActiveSymbols(); cpu->GetSymbolMap().UpdateActiveSymbols();
postEvent(debEVT_MAPLOADED, 0); postEvent(debEVT_MAPLOADED, 0);
} }
@ -1042,7 +1042,7 @@ void CtrlDisassemblyView::updateStatusBarText()
data = cpu->read32(line.info.dataAddress); data = cpu->read32(line.info.dataAddress);
} }
const std::string addressSymbol = symbolMap.GetLabelString(data); const std::string addressSymbol = cpu->GetSymbolMap().GetLabelString(data);
if (!addressSymbol.empty()) if (!addressSymbol.empty())
{ {
sprintf(text, "[%08X] = %s (%08X)", line.info.dataAddress, addressSymbol.c_str(), data); sprintf(text, "[%08X] = %s (%08X)", line.info.dataAddress, addressSymbol.c_str(), data);
@ -1082,7 +1082,7 @@ void CtrlDisassemblyView::updateStatusBarText()
if (line.info.isBranch) 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()) if (addressSymbol.empty())
{ {
sprintf(text, "%08X", line.info.branchTarget); sprintf(text, "%08X", line.info.branchTarget);
@ -1095,12 +1095,12 @@ void CtrlDisassemblyView::updateStatusBarText()
} }
else if (line.type == DISTYPE_DATA) else if (line.type == DISTYPE_DATA)
{ {
u32 start = symbolMap.GetDataStart(curAddress); u32 start = cpu->GetSymbolMap().GetDataStart(curAddress);
if (start == 0xFFFFFFFF) if (start == 0xFFFFFFFF)
start = curAddress; start = curAddress;
u32 diff = curAddress - start; u32 diff = curAddress - start;
const std::string label = symbolMap.GetLabelString(start); const std::string label = cpu->GetSymbolMap().GetLabelString(start);
if (!label.empty()) if (!label.empty())
{ {
@ -1224,7 +1224,7 @@ std::string CtrlDisassemblyView::disassembleRange(u32 start, u32 size)
{ {
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(cpu, start + i); 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()) if (branchAddresses.find(info.branchTarget) == branchAddresses.end())
{ {
@ -1258,7 +1258,7 @@ std::string CtrlDisassemblyView::disassembleRange(u32 start, u32 size)
result += buffer; 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); sprintf(buffer, "pos_%08X", line.info.branchTarget);
line.params = line.params.substr(0, line.params.find("0x")) + buffer; line.params = line.params.substr(0, line.params.find("0x")) + buffer;

View File

@ -69,6 +69,7 @@ private:
void drawArguments(wxDC& dc, const DisassemblyLineInfo &line, int x, int y, wxColor& textColor, void drawArguments(wxDC& dc, const DisassemblyLineInfo &line, int x, int y, wxColor& textColor,
const std::set<std::string> &currentArguments); const std::set<std::string> &currentArguments);
void assembleOpcode(u32 address, std::string defaultText); void assembleOpcode(u32 address, std::string defaultText);
int getBackgroundColor(unsigned int address);
void postEvent(wxEventType type, wxString text); void postEvent(wxEventType type, wxString text);
void postEvent(wxEventType type, int value); void postEvent(wxEventType type, int value);

View File

@ -284,7 +284,7 @@ wxString BreakpointList::getColumnText(int item, int col) const
} }
else else
{ {
const std::string sym = symbolMap.GetLabelString(displayedBreakPoints_[index].addr); const std::string sym = cpu->GetSymbolMap().GetLabelString(displayedBreakPoints_[index].addr);
if (!sym.empty()) if (!sym.empty())
{ {
dest.Write("%s", sym.c_str()); dest.Write("%s", sym.c_str());
@ -775,7 +775,7 @@ wxString StackFramesList::getColumnText(int item, int col) const
break; break;
case SF_ENTRYNAME: case SF_ENTRYNAME:
{ {
const std::string sym = symbolMap.GetLabelString(frame.entry); const std::string sym = cpu->GetSymbolMap().GetLabelString(frame.entry);
if (!sym.empty()) if (!sym.empty())
{ {
dest.Write("%s", sym.c_str()); dest.Write("%s", sym.c_str());

View File

@ -147,7 +147,7 @@ void CpuTabPage::reloadSymbolMap()
{ {
if (!symbolCount) if (!symbolCount)
{ {
auto funcs = symbolMap.GetAllSymbols(ST_FUNCTION); auto funcs = cpu->GetSymbolMap().GetAllSymbols(ST_FUNCTION);
symbolCount = funcs.size(); symbolCount = funcs.size();
for (size_t i = 0; i < funcs.size(); i++) for (size_t i = 0; i < funcs.size(); i++)
{ {