mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Merge pull request #8235 from lioncash/move
Common/DebugInterface: Minor cleanup changes
This commit is contained in:
@ -9,12 +9,12 @@
|
||||
|
||||
namespace Common::Debug
|
||||
{
|
||||
Watch::Watch(u32 address_, const std::string& name_, Watch::State is_enabled_)
|
||||
: address(address_), name(name_), is_enabled(is_enabled_)
|
||||
Watch::Watch(u32 address_, std::string name_, State is_enabled_)
|
||||
: address(address_), name(std::move(name_)), is_enabled(is_enabled_)
|
||||
{
|
||||
}
|
||||
|
||||
std::size_t Watches::SetWatch(u32 address, const std::string& name)
|
||||
std::size_t Watches::SetWatch(u32 address, std::string name)
|
||||
{
|
||||
const std::size_t size = m_watches.size();
|
||||
for (std::size_t index = 0; index < size; index++)
|
||||
@ -25,7 +25,7 @@ std::size_t Watches::SetWatch(u32 address, const std::string& name)
|
||||
return index;
|
||||
}
|
||||
}
|
||||
m_watches.emplace_back(address, name, Watch::State::Enabled);
|
||||
m_watches.emplace_back(address, std::move(name), Watch::State::Enabled);
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -46,10 +46,10 @@ void Watches::UnsetWatch(u32 address)
|
||||
m_watches.end());
|
||||
}
|
||||
|
||||
void Watches::UpdateWatch(std::size_t index, u32 address, const std::string& name)
|
||||
void Watches::UpdateWatch(std::size_t index, u32 address, std::string name)
|
||||
{
|
||||
m_watches[index].address = address;
|
||||
m_watches[index].name = name;
|
||||
m_watches[index].name = std::move(name);
|
||||
}
|
||||
|
||||
void Watches::UpdateWatchAddress(std::size_t index, u32 address)
|
||||
@ -57,9 +57,9 @@ void Watches::UpdateWatchAddress(std::size_t index, u32 address)
|
||||
m_watches[index].address = address;
|
||||
}
|
||||
|
||||
void Watches::UpdateWatchName(std::size_t index, const std::string& name)
|
||||
void Watches::UpdateWatchName(std::size_t index, std::string name)
|
||||
{
|
||||
m_watches[index].name = name;
|
||||
m_watches[index].name = std::move(name);
|
||||
}
|
||||
|
||||
void Watches::EnableWatch(std::size_t index)
|
||||
|
@ -24,19 +24,19 @@ struct Watch
|
||||
std::string name;
|
||||
State is_enabled;
|
||||
|
||||
Watch(u32 address, const std::string& name, State is_enabled);
|
||||
Watch(u32 address, std::string name, State is_enabled);
|
||||
};
|
||||
|
||||
class Watches
|
||||
{
|
||||
public:
|
||||
std::size_t SetWatch(u32 address, const std::string& name);
|
||||
std::size_t SetWatch(u32 address, std::string name);
|
||||
const Watch& GetWatch(std::size_t index) const;
|
||||
const std::vector<Watch>& GetWatches() const;
|
||||
void UnsetWatch(u32 address);
|
||||
void UpdateWatch(std::size_t index, u32 address, const std::string& name);
|
||||
void UpdateWatch(std::size_t index, u32 address, std::string name);
|
||||
void UpdateWatchAddress(std::size_t index, u32 address);
|
||||
void UpdateWatchName(std::size_t index, const std::string& name);
|
||||
void UpdateWatchName(std::size_t index, std::string name);
|
||||
void EnableWatch(std::size_t index);
|
||||
void DisableWatch(std::size_t index);
|
||||
bool HasEnabledWatch(u32 address) const;
|
||||
|
@ -5,30 +5,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Debug/MemoryPatches.h"
|
||||
#include "Common/Debug/Watches.h"
|
||||
|
||||
namespace Common::Debug
|
||||
{
|
||||
struct MemoryPatch;
|
||||
struct Watch;
|
||||
} // namespace Common::Debug
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class DebugInterface
|
||||
{
|
||||
protected:
|
||||
virtual ~DebugInterface() {}
|
||||
virtual ~DebugInterface() = default;
|
||||
|
||||
public:
|
||||
// Watches
|
||||
virtual std::size_t SetWatch(u32 address, const std::string& name = "") = 0;
|
||||
virtual const Common::Debug::Watch& GetWatch(std::size_t index) const = 0;
|
||||
virtual const std::vector<Common::Debug::Watch>& GetWatches() const = 0;
|
||||
virtual std::size_t SetWatch(u32 address, std::string name = "") = 0;
|
||||
virtual const Debug::Watch& GetWatch(std::size_t index) const = 0;
|
||||
virtual const std::vector<Debug::Watch>& GetWatches() const = 0;
|
||||
virtual void UnsetWatch(u32 address) = 0;
|
||||
virtual void UpdateWatch(std::size_t index, u32 address, const std::string& name) = 0;
|
||||
virtual void UpdateWatch(std::size_t index, u32 address, std::string name) = 0;
|
||||
virtual void UpdateWatchAddress(std::size_t index, u32 address) = 0;
|
||||
virtual void UpdateWatchName(std::size_t index, const std::string& name) = 0;
|
||||
virtual void UpdateWatchName(std::size_t index, std::string name) = 0;
|
||||
virtual void EnableWatch(std::size_t index) = 0;
|
||||
virtual void DisableWatch(std::size_t index) = 0;
|
||||
virtual bool HasEnabledWatch(u32 address) const = 0;
|
||||
@ -40,7 +43,7 @@ public:
|
||||
// Memory Patches
|
||||
virtual void SetPatch(u32 address, u32 value) = 0;
|
||||
virtual void SetPatch(u32 address, std::vector<u8> value) = 0;
|
||||
virtual const std::vector<Common::Debug::MemoryPatch>& GetPatches() const = 0;
|
||||
virtual const std::vector<Debug::MemoryPatch>& GetPatches() const = 0;
|
||||
virtual void UnsetPatch(u32 address) = 0;
|
||||
virtual void EnablePatch(std::size_t index) = 0;
|
||||
virtual void DisablePatch(std::size_t index) = 0;
|
||||
@ -48,33 +51,30 @@ 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*/) const { return "NODEBUGGER"; }
|
||||
virtual std::string GetRawMemoryString(int /*memory*/, u32 /*address*/) const
|
||||
{
|
||||
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 IsAlive() const { return true; }
|
||||
virtual bool IsBreakpoint(u32 /*address*/) const { 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*/) const { return false; }
|
||||
virtual void ToggleMemCheck(u32 /*address*/, bool /*read*/, bool /*write*/, bool /*log*/) {}
|
||||
virtual u32 ReadMemory(u32 /*address*/) const { return 0; }
|
||||
virtual void WriteExtraMemory(int /*memory*/, u32 /*value*/, u32 /*address*/) {}
|
||||
virtual u32 ReadExtraMemory(int /*memory*/, u32 /*address*/) const { return 0; }
|
||||
virtual u32 ReadInstruction(u32 /*address*/) const { return 0; }
|
||||
virtual u32 GetPC() const { 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 u32 GetColor(u32 /*address*/) const { return 0xFFFFFFFF; }
|
||||
virtual std::string GetDescription(u32 /*address*/) const = 0;
|
||||
virtual void Clear() = 0;
|
||||
};
|
||||
} // namespace Common
|
||||
|
Reference in New Issue
Block a user