mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Common/DebugInterface: Mark a few member functions as const
Quite a few member functions act as a means to query information. Given these don't actually modify object state, they can be made const.
This commit is contained in:
parent
d4d485b692
commit
92c1782726
@ -51,31 +51,31 @@ public:
|
|||||||
virtual void RemovePatch(std::size_t index) = 0;
|
virtual void RemovePatch(std::size_t index) = 0;
|
||||||
virtual void ClearPatches() = 0;
|
virtual void ClearPatches() = 0;
|
||||||
|
|
||||||
virtual std::string Disassemble(u32 /*address*/) { return "NODEBUGGER"; }
|
virtual std::string Disassemble(u32 /*address*/) const { return "NODEBUGGER"; }
|
||||||
virtual std::string GetRawMemoryString(int /*memory*/, u32 /*address*/)
|
virtual std::string GetRawMemoryString(int /*memory*/, u32 /*address*/) const
|
||||||
{
|
{
|
||||||
return "NODEBUGGER";
|
return "NODEBUGGER";
|
||||||
}
|
}
|
||||||
virtual int GetInstructionSize(int /*instruction*/) { return 1; }
|
virtual int GetInstructionSize(int /*instruction*/) { return 1; }
|
||||||
virtual bool IsAlive() { return true; }
|
virtual bool IsAlive() const { return true; }
|
||||||
virtual bool IsBreakpoint(u32 /*address*/) { return false; }
|
virtual bool IsBreakpoint(u32 /*address*/) const { return false; }
|
||||||
virtual void SetBreakpoint(u32 /*address*/) {}
|
virtual void SetBreakpoint(u32 /*address*/) {}
|
||||||
virtual void ClearBreakpoint(u32 /*address*/) {}
|
virtual void ClearBreakpoint(u32 /*address*/) {}
|
||||||
virtual void ClearAllBreakpoints() {}
|
virtual void ClearAllBreakpoints() {}
|
||||||
virtual void ToggleBreakpoint(u32 /*address*/) {}
|
virtual void ToggleBreakpoint(u32 /*address*/) {}
|
||||||
virtual void ClearAllMemChecks() {}
|
virtual void ClearAllMemChecks() {}
|
||||||
virtual bool IsMemCheck(u32 /*address*/, size_t /*size*/) { return false; }
|
virtual bool IsMemCheck(u32 /*address*/, size_t /*size*/) const { return false; }
|
||||||
virtual void ToggleMemCheck(u32 /*address*/, bool /*read*/, bool /*write*/, bool /*log*/) {}
|
virtual void ToggleMemCheck(u32 /*address*/, bool /*read*/, bool /*write*/, bool /*log*/) {}
|
||||||
virtual u32 ReadMemory(u32 /*address*/) { return 0; }
|
virtual u32 ReadMemory(u32 /*address*/) const { return 0; }
|
||||||
virtual void WriteExtraMemory(int /*memory*/, u32 /*value*/, u32 /*address*/) {}
|
virtual void WriteExtraMemory(int /*memory*/, u32 /*value*/, u32 /*address*/) {}
|
||||||
virtual u32 ReadExtraMemory(int /*memory*/, u32 /*address*/) { return 0; }
|
virtual u32 ReadExtraMemory(int /*memory*/, u32 /*address*/) const { return 0; }
|
||||||
virtual u32 ReadInstruction(u32 /*address*/) { return 0; }
|
virtual u32 ReadInstruction(u32 /*address*/) const { return 0; }
|
||||||
virtual u32 GetPC() { return 0; }
|
virtual u32 GetPC() const { return 0; }
|
||||||
virtual void SetPC(u32 /*address*/) {}
|
virtual void SetPC(u32 /*address*/) {}
|
||||||
virtual void Step() {}
|
virtual void Step() {}
|
||||||
virtual void RunToBreakpoint() {}
|
virtual void RunToBreakpoint() {}
|
||||||
virtual u32 GetColor(u32 /*address*/) { return 0xFFFFFFFF; }
|
virtual u32 GetColor(u32 /*address*/) const { return 0xFFFFFFFF; }
|
||||||
virtual std::string GetDescription(u32 /*address*/) = 0;
|
virtual std::string GetDescription(u32 /*address*/) const = 0;
|
||||||
virtual void Clear() = 0;
|
virtual void Clear() = 0;
|
||||||
};
|
};
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
@ -164,7 +164,7 @@ void PPCDebugInterface::ClearPatches()
|
|||||||
m_patches.ClearPatches();
|
m_patches.ClearPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PPCDebugInterface::Disassemble(u32 address)
|
std::string PPCDebugInterface::Disassemble(u32 address) const
|
||||||
{
|
{
|
||||||
// PowerPC::HostRead_U32 seemed to crash on shutdown
|
// PowerPC::HostRead_U32 seemed to crash on shutdown
|
||||||
if (!IsAlive())
|
if (!IsAlive())
|
||||||
@ -194,7 +194,7 @@ std::string PPCDebugInterface::Disassemble(u32 address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PPCDebugInterface::GetRawMemoryString(int memory, u32 address)
|
std::string PPCDebugInterface::GetRawMemoryString(int memory, u32 address) const
|
||||||
{
|
{
|
||||||
if (IsAlive())
|
if (IsAlive())
|
||||||
{
|
{
|
||||||
@ -209,12 +209,12 @@ std::string PPCDebugInterface::GetRawMemoryString(int memory, u32 address)
|
|||||||
return "<unknwn>"; // bad spelling - 8 chars
|
return "<unknwn>"; // bad spelling - 8 chars
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 PPCDebugInterface::ReadMemory(u32 address)
|
u32 PPCDebugInterface::ReadMemory(u32 address) const
|
||||||
{
|
{
|
||||||
return PowerPC::HostRead_U32(address);
|
return PowerPC::HostRead_U32(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 PPCDebugInterface::ReadExtraMemory(int memory, u32 address)
|
u32 PPCDebugInterface::ReadExtraMemory(int memory, u32 address) const
|
||||||
{
|
{
|
||||||
switch (memory)
|
switch (memory)
|
||||||
{
|
{
|
||||||
@ -228,17 +228,17 @@ u32 PPCDebugInterface::ReadExtraMemory(int memory, u32 address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 PPCDebugInterface::ReadInstruction(u32 address)
|
u32 PPCDebugInterface::ReadInstruction(u32 address) const
|
||||||
{
|
{
|
||||||
return PowerPC::HostRead_Instruction(address);
|
return PowerPC::HostRead_Instruction(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PPCDebugInterface::IsAlive()
|
bool PPCDebugInterface::IsAlive() const
|
||||||
{
|
{
|
||||||
return Core::IsRunningAndStarted();
|
return Core::IsRunningAndStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PPCDebugInterface::IsBreakpoint(u32 address)
|
bool PPCDebugInterface::IsBreakpoint(u32 address) const
|
||||||
{
|
{
|
||||||
return PowerPC::breakpoints.IsAddressBreakPoint(address);
|
return PowerPC::breakpoints.IsAddressBreakPoint(address);
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ void PPCDebugInterface::ClearAllMemChecks()
|
|||||||
PowerPC::memchecks.Clear();
|
PowerPC::memchecks.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PPCDebugInterface::IsMemCheck(u32 address, size_t size)
|
bool PPCDebugInterface::IsMemCheck(u32 address, size_t size) const
|
||||||
{
|
{
|
||||||
return PowerPC::memchecks.GetMemCheck(address, size) != nullptr;
|
return PowerPC::memchecks.GetMemCheck(address, size) != nullptr;
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ void PPCDebugInterface::ToggleMemCheck(u32 address, bool read, bool write, bool
|
|||||||
// =======================================================
|
// =======================================================
|
||||||
// Separate the blocks with colors.
|
// Separate the blocks with colors.
|
||||||
// -------------
|
// -------------
|
||||||
u32 PPCDebugInterface::GetColor(u32 address)
|
u32 PPCDebugInterface::GetColor(u32 address) const
|
||||||
{
|
{
|
||||||
if (!IsAlive())
|
if (!IsAlive())
|
||||||
return 0xFFFFFF;
|
return 0xFFFFFF;
|
||||||
@ -326,12 +326,12 @@ u32 PPCDebugInterface::GetColor(u32 address)
|
|||||||
}
|
}
|
||||||
// =============
|
// =============
|
||||||
|
|
||||||
std::string PPCDebugInterface::GetDescription(u32 address)
|
std::string PPCDebugInterface::GetDescription(u32 address) const
|
||||||
{
|
{
|
||||||
return g_symbolDB.GetDescription(address);
|
return g_symbolDB.GetDescription(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 PPCDebugInterface::GetPC()
|
u32 PPCDebugInterface::GetPC() const
|
||||||
{
|
{
|
||||||
return PowerPC::ppcState.pc;
|
return PowerPC::ppcState.pc;
|
||||||
}
|
}
|
||||||
|
@ -52,33 +52,33 @@ public:
|
|||||||
void RemovePatch(std::size_t index) override;
|
void RemovePatch(std::size_t index) override;
|
||||||
void ClearPatches() override;
|
void ClearPatches() override;
|
||||||
|
|
||||||
std::string Disassemble(u32 address) override;
|
std::string Disassemble(u32 address) const override;
|
||||||
std::string GetRawMemoryString(int memory, u32 address) override;
|
std::string GetRawMemoryString(int memory, u32 address) const override;
|
||||||
int GetInstructionSize(int /*instruction*/) override { return 4; }
|
int GetInstructionSize(int /*instruction*/) override { return 4; }
|
||||||
bool IsAlive() override;
|
bool IsAlive() const override;
|
||||||
bool IsBreakpoint(u32 address) override;
|
bool IsBreakpoint(u32 address) const override;
|
||||||
void SetBreakpoint(u32 address) override;
|
void SetBreakpoint(u32 address) override;
|
||||||
void ClearBreakpoint(u32 address) override;
|
void ClearBreakpoint(u32 address) override;
|
||||||
void ClearAllBreakpoints() override;
|
void ClearAllBreakpoints() override;
|
||||||
void ToggleBreakpoint(u32 address) override;
|
void ToggleBreakpoint(u32 address) override;
|
||||||
void ClearAllMemChecks() override;
|
void ClearAllMemChecks() override;
|
||||||
bool IsMemCheck(u32 address, size_t size = 1) override;
|
bool IsMemCheck(u32 address, size_t size = 1) const override;
|
||||||
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
||||||
u32 ReadMemory(u32 address) override;
|
u32 ReadMemory(u32 address) const override;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
EXTRAMEM_ARAM = 1,
|
EXTRAMEM_ARAM = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 ReadExtraMemory(int memory, u32 address) override;
|
u32 ReadExtraMemory(int memory, u32 address) const override;
|
||||||
u32 ReadInstruction(u32 address) override;
|
u32 ReadInstruction(u32 address) const override;
|
||||||
u32 GetPC() override;
|
u32 GetPC() const override;
|
||||||
void SetPC(u32 address) override;
|
void SetPC(u32 address) override;
|
||||||
void Step() override {}
|
void Step() override {}
|
||||||
void RunToBreakpoint() override;
|
void RunToBreakpoint() override;
|
||||||
u32 GetColor(u32 address) override;
|
u32 GetColor(u32 address) const override;
|
||||||
std::string GetDescription(u32 address) override;
|
std::string GetDescription(u32 address) const override;
|
||||||
|
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
|
|
||||||
|
@ -140,13 +140,13 @@ void DSPDebugInterface::ClearPatches()
|
|||||||
m_patches.ClearPatches();
|
m_patches.ClearPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DSPDebugInterface::Disassemble(u32 address)
|
std::string DSPDebugInterface::Disassemble(u32 address) const
|
||||||
{
|
{
|
||||||
// we'll treat addresses as line numbers.
|
// we'll treat addresses as line numbers.
|
||||||
return Symbols::GetLineText(address);
|
return Symbols::GetLineText(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DSPDebugInterface::GetRawMemoryString(int memory, u32 address)
|
std::string DSPDebugInterface::GetRawMemoryString(int memory, u32 address) const
|
||||||
{
|
{
|
||||||
if (DSPCore_GetState() == State::Stopped)
|
if (DSPCore_GetState() == State::Stopped)
|
||||||
return "";
|
return "";
|
||||||
@ -179,22 +179,22 @@ std::string DSPDebugInterface::GetRawMemoryString(int memory, u32 address)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DSPDebugInterface::ReadMemory(u32 address)
|
u32 DSPDebugInterface::ReadMemory(u32 address) const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DSPDebugInterface::ReadInstruction(u32 address)
|
u32 DSPDebugInterface::ReadInstruction(u32 address) const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DSPDebugInterface::IsAlive()
|
bool DSPDebugInterface::IsAlive() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DSPDebugInterface::IsBreakpoint(u32 address)
|
bool DSPDebugInterface::IsBreakpoint(u32 address) const
|
||||||
{
|
{
|
||||||
int real_addr = Symbols::Line2Addr(address);
|
int real_addr = Symbols::Line2Addr(address);
|
||||||
if (real_addr >= 0)
|
if (real_addr >= 0)
|
||||||
@ -240,7 +240,7 @@ void DSPDebugInterface::ToggleBreakpoint(u32 address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DSPDebugInterface::IsMemCheck(u32 address, size_t size)
|
bool DSPDebugInterface::IsMemCheck(u32 address, size_t size) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ void DSPDebugInterface::ToggleMemCheck(u32 address, bool read, bool write, bool
|
|||||||
// =======================================================
|
// =======================================================
|
||||||
// Separate the blocks with colors.
|
// Separate the blocks with colors.
|
||||||
// -------------
|
// -------------
|
||||||
u32 DSPDebugInterface::GetColor(u32 address)
|
u32 DSPDebugInterface::GetColor(u32 address) const
|
||||||
{
|
{
|
||||||
// Scan backwards so we don't miss it. Hm, actually, let's not - it looks pretty good.
|
// Scan backwards so we don't miss it. Hm, actually, let's not - it looks pretty good.
|
||||||
int addr = -1;
|
int addr = -1;
|
||||||
@ -289,12 +289,12 @@ u32 DSPDebugInterface::GetColor(u32 address)
|
|||||||
}
|
}
|
||||||
// =============
|
// =============
|
||||||
|
|
||||||
std::string DSPDebugInterface::GetDescription(u32 address)
|
std::string DSPDebugInterface::GetDescription(u32 address) const
|
||||||
{
|
{
|
||||||
return ""; // g_symbolDB.GetDescription(address);
|
return ""; // g_symbolDB.GetDescription(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DSPDebugInterface::GetPC()
|
u32 DSPDebugInterface::GetPC() const
|
||||||
{
|
{
|
||||||
return Symbols::Addr2Line(DSP::g_dsp.pc);
|
return Symbols::Addr2Line(DSP::g_dsp.pc);
|
||||||
}
|
}
|
||||||
|
@ -53,26 +53,26 @@ public:
|
|||||||
bool HasEnabledPatch(u32 address) const override;
|
bool HasEnabledPatch(u32 address) const override;
|
||||||
void ClearPatches() override;
|
void ClearPatches() override;
|
||||||
|
|
||||||
std::string Disassemble(u32 address) override;
|
std::string Disassemble(u32 address) const override;
|
||||||
std::string GetRawMemoryString(int memory, u32 address) override;
|
std::string GetRawMemoryString(int memory, u32 address) const override;
|
||||||
int GetInstructionSize(int instruction) override { return 1; }
|
int GetInstructionSize(int instruction) override { return 1; }
|
||||||
bool IsAlive() override;
|
bool IsAlive() const override;
|
||||||
bool IsBreakpoint(u32 address) override;
|
bool IsBreakpoint(u32 address) const override;
|
||||||
void SetBreakpoint(u32 address) override;
|
void SetBreakpoint(u32 address) override;
|
||||||
void ClearBreakpoint(u32 address) override;
|
void ClearBreakpoint(u32 address) override;
|
||||||
void ClearAllBreakpoints() override;
|
void ClearAllBreakpoints() override;
|
||||||
void ToggleBreakpoint(u32 address) override;
|
void ToggleBreakpoint(u32 address) override;
|
||||||
void ClearAllMemChecks() override;
|
void ClearAllMemChecks() override;
|
||||||
bool IsMemCheck(u32 address, size_t size) override;
|
bool IsMemCheck(u32 address, size_t size) const override;
|
||||||
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
||||||
u32 ReadMemory(u32 address) override;
|
u32 ReadMemory(u32 address) const override;
|
||||||
u32 ReadInstruction(u32 address) override;
|
u32 ReadInstruction(u32 address) const override;
|
||||||
u32 GetPC() override;
|
u32 GetPC() const override;
|
||||||
void SetPC(u32 address) override;
|
void SetPC(u32 address) override;
|
||||||
void Step() override {}
|
void Step() override {}
|
||||||
void RunToBreakpoint() override;
|
void RunToBreakpoint() override;
|
||||||
u32 GetColor(u32 address) override;
|
u32 GetColor(u32 address) const override;
|
||||||
std::string GetDescription(u32 address) override;
|
std::string GetDescription(u32 address) const override;
|
||||||
|
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user