mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Common/DebugInterface: Use u32 instead of unsigned int consistently
Previously u32 was being used for part of the interface and unsigned int was being used for other parts. This makes the interface fully consistent by using only one type. We opt for u32 here given they communicate the same thing (for platforms we care about where int is 32-bit), while also being less to read.
This commit is contained in:
parent
b1b9c6aa1e
commit
457bff92c1
@ -48,33 +48,31 @@ public:
|
||||
virtual void RemovePatch(std::size_t index) = 0;
|
||||
virtual void ClearPatches() = 0;
|
||||
|
||||
virtual std::string Disassemble(unsigned int /*address*/) { return "NODEBUGGER"; }
|
||||
virtual std::string GetRawMemoryString(int /*memory*/, unsigned int /*address*/)
|
||||
virtual std::string Disassemble(u32 /*address*/) { return "NODEBUGGER"; }
|
||||
virtual std::string GetRawMemoryString(int /*memory*/, u32 /*address*/)
|
||||
{
|
||||
return "NODEBUGGER";
|
||||
}
|
||||
virtual int GetInstructionSize(int /*instruction*/) { return 1; }
|
||||
virtual bool IsAlive() { return true; }
|
||||
virtual bool IsBreakpoint(unsigned int /*address*/) { return false; }
|
||||
virtual void SetBreakpoint(unsigned int /*address*/) {}
|
||||
virtual void ClearBreakpoint(unsigned int /*address*/) {}
|
||||
virtual bool IsBreakpoint(u32 /*address*/) { return false; }
|
||||
virtual void SetBreakpoint(u32 /*address*/) {}
|
||||
virtual void ClearBreakpoint(u32 /*address*/) {}
|
||||
virtual void ClearAllBreakpoints() {}
|
||||
virtual void ToggleBreakpoint(unsigned int /*address*/) {}
|
||||
virtual void ToggleBreakpoint(u32 /*address*/) {}
|
||||
virtual void ClearAllMemChecks() {}
|
||||
virtual bool IsMemCheck(unsigned int /*address*/, size_t /*size*/) { return false; }
|
||||
virtual void ToggleMemCheck(unsigned int /*address*/, bool /*read*/, bool /*write*/, bool /*log*/)
|
||||
{
|
||||
}
|
||||
virtual unsigned int ReadMemory(unsigned int /*address*/) { return 0; }
|
||||
virtual void WriteExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {}
|
||||
virtual unsigned int ReadExtraMemory(int /*memory*/, unsigned int /*address*/) { return 0; }
|
||||
virtual unsigned int ReadInstruction(unsigned int /*address*/) { return 0; }
|
||||
virtual unsigned int GetPC() { return 0; }
|
||||
virtual void SetPC(unsigned int /*address*/) {}
|
||||
virtual bool IsMemCheck(u32 /*address*/, size_t /*size*/) { return false; }
|
||||
virtual void ToggleMemCheck(u32 /*address*/, bool /*read*/, bool /*write*/, bool /*log*/) {}
|
||||
virtual u32 ReadMemory(u32 /*address*/) { return 0; }
|
||||
virtual void WriteExtraMemory(int /*memory*/, u32 /*value*/, u32 /*address*/) {}
|
||||
virtual u32 ReadExtraMemory(int /*memory*/, u32 /*address*/) { return 0; }
|
||||
virtual u32 ReadInstruction(u32 /*address*/) { return 0; }
|
||||
virtual u32 GetPC() { return 0; }
|
||||
virtual void SetPC(u32 /*address*/) {}
|
||||
virtual void Step() {}
|
||||
virtual void RunToBreakpoint() {}
|
||||
virtual int GetColor(unsigned int /*address*/) { return 0xFFFFFFFF; }
|
||||
virtual std::string GetDescription(unsigned int /*address*/) = 0;
|
||||
virtual int GetColor(u32 /*address*/) { return 0xFFFFFFFF; }
|
||||
virtual std::string GetDescription(u32 /*address*/) = 0;
|
||||
virtual void Clear() = 0;
|
||||
};
|
||||
} // namespace Common
|
||||
|
@ -162,7 +162,7 @@ void PPCDebugInterface::ClearPatches()
|
||||
m_patches.ClearPatches();
|
||||
}
|
||||
|
||||
std::string PPCDebugInterface::Disassemble(unsigned int address)
|
||||
std::string PPCDebugInterface::Disassemble(u32 address)
|
||||
{
|
||||
// PowerPC::HostRead_U32 seemed to crash on shutdown
|
||||
if (!IsAlive())
|
||||
@ -192,7 +192,7 @@ std::string PPCDebugInterface::Disassemble(unsigned int address)
|
||||
}
|
||||
}
|
||||
|
||||
std::string PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address)
|
||||
std::string PPCDebugInterface::GetRawMemoryString(int memory, u32 address)
|
||||
{
|
||||
if (IsAlive())
|
||||
{
|
||||
@ -207,12 +207,12 @@ std::string PPCDebugInterface::GetRawMemoryString(int memory, unsigned int addre
|
||||
return "<unknwn>"; // bad spelling - 8 chars
|
||||
}
|
||||
|
||||
unsigned int PPCDebugInterface::ReadMemory(unsigned int address)
|
||||
u32 PPCDebugInterface::ReadMemory(u32 address)
|
||||
{
|
||||
return PowerPC::HostRead_U32(address);
|
||||
}
|
||||
|
||||
unsigned int PPCDebugInterface::ReadExtraMemory(int memory, unsigned int address)
|
||||
u32 PPCDebugInterface::ReadExtraMemory(int memory, u32 address)
|
||||
{
|
||||
switch (memory)
|
||||
{
|
||||
@ -226,7 +226,7 @@ unsigned int PPCDebugInterface::ReadExtraMemory(int memory, unsigned int address
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int PPCDebugInterface::ReadInstruction(unsigned int address)
|
||||
u32 PPCDebugInterface::ReadInstruction(u32 address)
|
||||
{
|
||||
return PowerPC::HostRead_Instruction(address);
|
||||
}
|
||||
@ -236,17 +236,17 @@ bool PPCDebugInterface::IsAlive()
|
||||
return Core::IsRunningAndStarted();
|
||||
}
|
||||
|
||||
bool PPCDebugInterface::IsBreakpoint(unsigned int address)
|
||||
bool PPCDebugInterface::IsBreakpoint(u32 address)
|
||||
{
|
||||
return PowerPC::breakpoints.IsAddressBreakPoint(address);
|
||||
}
|
||||
|
||||
void PPCDebugInterface::SetBreakpoint(unsigned int address)
|
||||
void PPCDebugInterface::SetBreakpoint(u32 address)
|
||||
{
|
||||
PowerPC::breakpoints.Add(address);
|
||||
}
|
||||
|
||||
void PPCDebugInterface::ClearBreakpoint(unsigned int address)
|
||||
void PPCDebugInterface::ClearBreakpoint(u32 address)
|
||||
{
|
||||
PowerPC::breakpoints.Remove(address);
|
||||
}
|
||||
@ -256,7 +256,7 @@ void PPCDebugInterface::ClearAllBreakpoints()
|
||||
PowerPC::breakpoints.Clear();
|
||||
}
|
||||
|
||||
void PPCDebugInterface::ToggleBreakpoint(unsigned int address)
|
||||
void PPCDebugInterface::ToggleBreakpoint(u32 address)
|
||||
{
|
||||
if (PowerPC::breakpoints.IsAddressBreakPoint(address))
|
||||
PowerPC::breakpoints.Remove(address);
|
||||
@ -269,12 +269,12 @@ void PPCDebugInterface::ClearAllMemChecks()
|
||||
PowerPC::memchecks.Clear();
|
||||
}
|
||||
|
||||
bool PPCDebugInterface::IsMemCheck(unsigned int address, size_t size)
|
||||
bool PPCDebugInterface::IsMemCheck(u32 address, size_t size)
|
||||
{
|
||||
return PowerPC::memchecks.GetMemCheck(address, size) != nullptr;
|
||||
}
|
||||
|
||||
void PPCDebugInterface::ToggleMemCheck(unsigned int address, bool read, bool write, bool log)
|
||||
void PPCDebugInterface::ToggleMemCheck(u32 address, bool read, bool write, bool log)
|
||||
{
|
||||
if (!IsMemCheck(address))
|
||||
{
|
||||
@ -299,7 +299,7 @@ void PPCDebugInterface::ToggleMemCheck(unsigned int address, bool read, bool wri
|
||||
// =======================================================
|
||||
// Separate the blocks with colors.
|
||||
// -------------
|
||||
int PPCDebugInterface::GetColor(unsigned int address)
|
||||
int PPCDebugInterface::GetColor(u32 address)
|
||||
{
|
||||
if (!IsAlive())
|
||||
return 0xFFFFFF;
|
||||
@ -322,17 +322,17 @@ int PPCDebugInterface::GetColor(unsigned int address)
|
||||
}
|
||||
// =============
|
||||
|
||||
std::string PPCDebugInterface::GetDescription(unsigned int address)
|
||||
std::string PPCDebugInterface::GetDescription(u32 address)
|
||||
{
|
||||
return g_symbolDB.GetDescription(address);
|
||||
}
|
||||
|
||||
unsigned int PPCDebugInterface::GetPC()
|
||||
u32 PPCDebugInterface::GetPC()
|
||||
{
|
||||
return PowerPC::ppcState.pc;
|
||||
}
|
||||
|
||||
void PPCDebugInterface::SetPC(unsigned int address)
|
||||
void PPCDebugInterface::SetPC(u32 address)
|
||||
{
|
||||
PowerPC::ppcState.pc = address;
|
||||
}
|
||||
|
@ -50,34 +50,33 @@ public:
|
||||
void RemovePatch(std::size_t index) override;
|
||||
void ClearPatches() override;
|
||||
|
||||
std::string Disassemble(unsigned int address) override;
|
||||
std::string GetRawMemoryString(int memory, unsigned int address) override;
|
||||
std::string Disassemble(u32 address) override;
|
||||
std::string GetRawMemoryString(int memory, u32 address) override;
|
||||
int GetInstructionSize(int /*instruction*/) override { return 4; }
|
||||
bool IsAlive() override;
|
||||
bool IsBreakpoint(unsigned int address) override;
|
||||
void SetBreakpoint(unsigned int address) override;
|
||||
void ClearBreakpoint(unsigned int address) override;
|
||||
bool IsBreakpoint(u32 address) override;
|
||||
void SetBreakpoint(u32 address) override;
|
||||
void ClearBreakpoint(u32 address) override;
|
||||
void ClearAllBreakpoints() override;
|
||||
void ToggleBreakpoint(unsigned int address) override;
|
||||
void ToggleBreakpoint(u32 address) override;
|
||||
void ClearAllMemChecks() override;
|
||||
bool IsMemCheck(unsigned int address, size_t size = 1) override;
|
||||
void ToggleMemCheck(unsigned int address, bool read = true, bool write = true,
|
||||
bool log = true) override;
|
||||
unsigned int ReadMemory(unsigned int address) override;
|
||||
bool IsMemCheck(u32 address, size_t size = 1) override;
|
||||
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
||||
u32 ReadMemory(u32 address) override;
|
||||
|
||||
enum
|
||||
{
|
||||
EXTRAMEM_ARAM = 1,
|
||||
};
|
||||
|
||||
unsigned int ReadExtraMemory(int memory, unsigned int address) override;
|
||||
unsigned int ReadInstruction(unsigned int address) override;
|
||||
unsigned int GetPC() override;
|
||||
void SetPC(unsigned int address) override;
|
||||
u32 ReadExtraMemory(int memory, u32 address) override;
|
||||
u32 ReadInstruction(u32 address) override;
|
||||
u32 GetPC() override;
|
||||
void SetPC(u32 address) override;
|
||||
void Step() override {}
|
||||
void RunToBreakpoint() override;
|
||||
int GetColor(unsigned int address) override;
|
||||
std::string GetDescription(unsigned int address) override;
|
||||
int GetColor(u32 address) override;
|
||||
std::string GetDescription(u32 address) override;
|
||||
|
||||
void Clear() override;
|
||||
|
||||
|
@ -138,13 +138,13 @@ void DSPDebugInterface::ClearPatches()
|
||||
m_patches.ClearPatches();
|
||||
}
|
||||
|
||||
std::string DSPDebugInterface::Disassemble(unsigned int address)
|
||||
std::string DSPDebugInterface::Disassemble(u32 address)
|
||||
{
|
||||
// we'll treat addresses as line numbers.
|
||||
return Symbols::GetLineText(address);
|
||||
}
|
||||
|
||||
std::string DSPDebugInterface::GetRawMemoryString(int memory, unsigned int address)
|
||||
std::string DSPDebugInterface::GetRawMemoryString(int memory, u32 address)
|
||||
{
|
||||
if (DSPCore_GetState() == State::Stopped)
|
||||
return "";
|
||||
@ -177,12 +177,12 @@ std::string DSPDebugInterface::GetRawMemoryString(int memory, unsigned int addre
|
||||
return "";
|
||||
}
|
||||
|
||||
unsigned int DSPDebugInterface::ReadMemory(unsigned int address)
|
||||
u32 DSPDebugInterface::ReadMemory(u32 address)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int DSPDebugInterface::ReadInstruction(unsigned int address)
|
||||
u32 DSPDebugInterface::ReadInstruction(u32 address)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -192,7 +192,7 @@ bool DSPDebugInterface::IsAlive()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DSPDebugInterface::IsBreakpoint(unsigned int address)
|
||||
bool DSPDebugInterface::IsBreakpoint(u32 address)
|
||||
{
|
||||
int real_addr = Symbols::Line2Addr(address);
|
||||
if (real_addr >= 0)
|
||||
@ -201,7 +201,7 @@ bool DSPDebugInterface::IsBreakpoint(unsigned int address)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DSPDebugInterface::SetBreakpoint(unsigned int address)
|
||||
void DSPDebugInterface::SetBreakpoint(u32 address)
|
||||
{
|
||||
int real_addr = Symbols::Line2Addr(address);
|
||||
|
||||
@ -211,7 +211,7 @@ void DSPDebugInterface::SetBreakpoint(unsigned int address)
|
||||
}
|
||||
}
|
||||
|
||||
void DSPDebugInterface::ClearBreakpoint(unsigned int address)
|
||||
void DSPDebugInterface::ClearBreakpoint(u32 address)
|
||||
{
|
||||
int real_addr = Symbols::Line2Addr(address);
|
||||
|
||||
@ -226,7 +226,7 @@ void DSPDebugInterface::ClearAllBreakpoints()
|
||||
g_dsp_breakpoints.Clear();
|
||||
}
|
||||
|
||||
void DSPDebugInterface::ToggleBreakpoint(unsigned int address)
|
||||
void DSPDebugInterface::ToggleBreakpoint(u32 address)
|
||||
{
|
||||
int real_addr = Symbols::Line2Addr(address);
|
||||
if (real_addr >= 0)
|
||||
@ -238,7 +238,7 @@ void DSPDebugInterface::ToggleBreakpoint(unsigned int address)
|
||||
}
|
||||
}
|
||||
|
||||
bool DSPDebugInterface::IsMemCheck(unsigned int address, size_t size)
|
||||
bool DSPDebugInterface::IsMemCheck(u32 address, size_t size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -248,7 +248,7 @@ void DSPDebugInterface::ClearAllMemChecks()
|
||||
PanicAlert("MemCheck functionality not supported in DSP module.");
|
||||
}
|
||||
|
||||
void DSPDebugInterface::ToggleMemCheck(unsigned int address, bool read, bool write, bool log)
|
||||
void DSPDebugInterface::ToggleMemCheck(u32 address, bool read, bool write, bool log)
|
||||
{
|
||||
PanicAlert("MemCheck functionality not supported in DSP module.");
|
||||
}
|
||||
@ -256,7 +256,7 @@ void DSPDebugInterface::ToggleMemCheck(unsigned int address, bool read, bool wri
|
||||
// =======================================================
|
||||
// Separate the blocks with colors.
|
||||
// -------------
|
||||
int DSPDebugInterface::GetColor(unsigned int address)
|
||||
int DSPDebugInterface::GetColor(u32 address)
|
||||
{
|
||||
static const int colors[6] = {
|
||||
0xd0FFFF, // light cyan
|
||||
@ -287,17 +287,17 @@ int DSPDebugInterface::GetColor(unsigned int address)
|
||||
}
|
||||
// =============
|
||||
|
||||
std::string DSPDebugInterface::GetDescription(unsigned int address)
|
||||
std::string DSPDebugInterface::GetDescription(u32 address)
|
||||
{
|
||||
return ""; // g_symbolDB.GetDescription(address);
|
||||
}
|
||||
|
||||
unsigned int DSPDebugInterface::GetPC()
|
||||
u32 DSPDebugInterface::GetPC()
|
||||
{
|
||||
return Symbols::Addr2Line(DSP::g_dsp.pc);
|
||||
}
|
||||
|
||||
void DSPDebugInterface::SetPC(unsigned int address)
|
||||
void DSPDebugInterface::SetPC(u32 address)
|
||||
{
|
||||
int new_pc = Symbols::Line2Addr(address);
|
||||
if (new_pc > 0)
|
||||
|
@ -51,27 +51,26 @@ public:
|
||||
bool HasEnabledPatch(u32 address) const override;
|
||||
void ClearPatches() override;
|
||||
|
||||
std::string Disassemble(unsigned int address) override;
|
||||
std::string GetRawMemoryString(int memory, unsigned int address) override;
|
||||
std::string Disassemble(u32 address) override;
|
||||
std::string GetRawMemoryString(int memory, u32 address) override;
|
||||
int GetInstructionSize(int instruction) override { return 1; }
|
||||
bool IsAlive() override;
|
||||
bool IsBreakpoint(unsigned int address) override;
|
||||
void SetBreakpoint(unsigned int address) override;
|
||||
void ClearBreakpoint(unsigned int address) override;
|
||||
bool IsBreakpoint(u32 address) override;
|
||||
void SetBreakpoint(u32 address) override;
|
||||
void ClearBreakpoint(u32 address) override;
|
||||
void ClearAllBreakpoints() override;
|
||||
void ToggleBreakpoint(unsigned int address) override;
|
||||
void ToggleBreakpoint(u32 address) override;
|
||||
void ClearAllMemChecks() override;
|
||||
bool IsMemCheck(unsigned int address, size_t size) override;
|
||||
void ToggleMemCheck(unsigned int address, bool read = true, bool write = true,
|
||||
bool log = true) override;
|
||||
unsigned int ReadMemory(unsigned int address) override;
|
||||
unsigned int ReadInstruction(unsigned int address) override;
|
||||
unsigned int GetPC() override;
|
||||
void SetPC(unsigned int address) override;
|
||||
bool IsMemCheck(u32 address, size_t size) override;
|
||||
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
||||
u32 ReadMemory(u32 address) override;
|
||||
u32 ReadInstruction(u32 address) override;
|
||||
u32 GetPC() override;
|
||||
void SetPC(u32 address) override;
|
||||
void Step() override {}
|
||||
void RunToBreakpoint() override;
|
||||
int GetColor(unsigned int address) override;
|
||||
std::string GetDescription(unsigned int address) override;
|
||||
int GetColor(u32 address) override;
|
||||
std::string GetDescription(u32 address) override;
|
||||
|
||||
void Clear() override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user