2015-05-23 22:32:32 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2017-03-02 18:07:24 -07:00
|
|
|
#include <cstddef>
|
2014-02-19 20:11:52 -07:00
|
|
|
#include <cstring>
|
2008-12-07 21:46:09 -07:00
|
|
|
#include <string>
|
2018-01-29 09:58:02 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
2018-05-21 08:46:03 -06:00
|
|
|
#include "Common/Debug/MemoryPatches.h"
|
2018-01-29 09:58:02 -07:00
|
|
|
#include "Common/Debug/Watches.h"
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2018-07-09 19:47:50 -06:00
|
|
|
namespace Common
|
|
|
|
{
|
2008-12-07 21:46:09 -07:00
|
|
|
class DebugInterface
|
|
|
|
{
|
|
|
|
protected:
|
2016-06-24 02:43:46 -06:00
|
|
|
virtual ~DebugInterface() {}
|
2018-04-12 06:18:04 -06:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
public:
|
2018-01-29 09:58:02 -07:00
|
|
|
// 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 void UnsetWatch(u32 address) = 0;
|
|
|
|
virtual void UpdateWatch(std::size_t index, u32 address, const 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 EnableWatch(std::size_t index) = 0;
|
|
|
|
virtual void DisableWatch(std::size_t index) = 0;
|
|
|
|
virtual bool HasEnabledWatch(u32 address) const = 0;
|
|
|
|
virtual void RemoveWatch(std::size_t index) = 0;
|
|
|
|
virtual void LoadWatchesFromStrings(const std::vector<std::string>& watches) = 0;
|
|
|
|
virtual std::vector<std::string> SaveWatchesToStrings() const = 0;
|
|
|
|
virtual void ClearWatches() = 0;
|
|
|
|
|
2018-05-21 08:46:03 -06:00
|
|
|
// 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 void UnsetPatch(u32 address) = 0;
|
|
|
|
virtual void EnablePatch(std::size_t index) = 0;
|
|
|
|
virtual void DisablePatch(std::size_t index) = 0;
|
|
|
|
virtual bool HasEnabledPatch(u32 address) const = 0;
|
|
|
|
virtual void RemovePatch(std::size_t index) = 0;
|
|
|
|
virtual void ClearPatches() = 0;
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
virtual std::string Disassemble(unsigned int /*address*/) { return "NODEBUGGER"; }
|
2016-10-07 07:56:02 -06:00
|
|
|
virtual std::string GetRawMemoryString(int /*memory*/, unsigned int /*address*/)
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
2016-10-07 07:56:02 -06:00
|
|
|
return "NODEBUGGER";
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
|
|
|
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 void ClearAllBreakpoints() {}
|
|
|
|
virtual void ToggleBreakpoint(unsigned int /*address*/) {}
|
|
|
|
virtual void ClearAllMemChecks() {}
|
2017-03-02 18:07:24 -07:00
|
|
|
virtual bool IsMemCheck(unsigned int /*address*/, size_t /*size*/) { return false; }
|
2016-08-18 14:08:08 -06:00
|
|
|
virtual void ToggleMemCheck(unsigned int /*address*/, bool /*read*/, bool /*write*/, bool /*log*/)
|
|
|
|
{
|
|
|
|
}
|
2016-06-24 02:43:46 -06:00
|
|
|
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 void Step() {}
|
|
|
|
virtual void RunToBreakpoint() {}
|
|
|
|
virtual int GetColor(unsigned int /*address*/) { return 0xFFFFFFFF; }
|
|
|
|
virtual std::string GetDescription(unsigned int /*address*/) = 0;
|
2018-01-29 09:58:02 -07:00
|
|
|
virtual void Clear() = 0;
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
2018-07-09 19:47:50 -06:00
|
|
|
} // namespace Common
|