2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 22:43:11 -04:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2017-03-02 20:07:24 -05:00
|
|
|
#include <cstddef>
|
2017-08-24 19:45:26 +01:00
|
|
|
#include <memory>
|
2008-07-12 17:40:22 +00:00
|
|
|
#include <string>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2019-07-08 18:07:11 -04:00
|
|
|
#include "Common/Debug/MemoryPatches.h"
|
|
|
|
#include "Common/Debug/Watches.h"
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Common/DebugInterface.h"
|
2017-08-24 19:45:26 +01:00
|
|
|
#include "Core/NetworkCaptureLogger.h"
|
2009-06-28 12:15:31 +00:00
|
|
|
|
2018-05-21 18:46:03 +04:00
|
|
|
class PPCPatches : public Common::Debug::MemoryPatches
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
void Patch(std::size_t index) override;
|
|
|
|
};
|
|
|
|
|
2008-07-12 17:40:22 +00:00
|
|
|
// wrapper between disasm control and Dolphin debugger
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2018-07-09 21:47:50 -04:00
|
|
|
class PPCDebugInterface final : public Common::DebugInterface
|
2008-07-12 17:40:22 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-07-08 17:44:56 -04:00
|
|
|
PPCDebugInterface();
|
|
|
|
~PPCDebugInterface() override;
|
|
|
|
|
2018-01-29 17:58:02 +01:00
|
|
|
// Watches
|
2019-07-08 17:28:07 -04:00
|
|
|
std::size_t SetWatch(u32 address, std::string name = "") override;
|
2018-01-29 17:58:02 +01:00
|
|
|
const Common::Debug::Watch& GetWatch(std::size_t index) const override;
|
|
|
|
const std::vector<Common::Debug::Watch>& GetWatches() const override;
|
|
|
|
void UnsetWatch(u32 address) override;
|
2019-07-08 17:28:07 -04:00
|
|
|
void UpdateWatch(std::size_t index, u32 address, std::string name) override;
|
2018-01-29 17:58:02 +01:00
|
|
|
void UpdateWatchAddress(std::size_t index, u32 address) override;
|
2019-07-08 17:28:07 -04:00
|
|
|
void UpdateWatchName(std::size_t index, std::string name) override;
|
2018-01-29 17:58:02 +01:00
|
|
|
void EnableWatch(std::size_t index) override;
|
|
|
|
void DisableWatch(std::size_t index) override;
|
|
|
|
bool HasEnabledWatch(u32 address) const override;
|
|
|
|
void RemoveWatch(std::size_t index) override;
|
|
|
|
void LoadWatchesFromStrings(const std::vector<std::string>& watches) override;
|
|
|
|
std::vector<std::string> SaveWatchesToStrings() const override;
|
|
|
|
void ClearWatches() override;
|
|
|
|
|
2018-05-21 18:46:03 +04:00
|
|
|
// Memory Patches
|
2018-05-27 14:39:01 +02:00
|
|
|
void SetPatch(u32 address, u32 value) override;
|
|
|
|
void SetPatch(u32 address, std::vector<u8> value) override;
|
|
|
|
const std::vector<Common::Debug::MemoryPatch>& GetPatches() const override;
|
|
|
|
void UnsetPatch(u32 address) override;
|
|
|
|
void EnablePatch(std::size_t index) override;
|
|
|
|
void DisablePatch(std::size_t index) override;
|
|
|
|
bool HasEnabledPatch(u32 address) const override;
|
|
|
|
void RemovePatch(std::size_t index) override;
|
|
|
|
void ClearPatches() override;
|
2018-05-21 18:46:03 +04:00
|
|
|
|
2020-03-21 11:48:49 +04:00
|
|
|
// Threads
|
|
|
|
Common::Debug::Threads GetThreads() const override;
|
|
|
|
|
2019-07-08 18:25:14 -04:00
|
|
|
std::string Disassemble(u32 address) const override;
|
|
|
|
std::string GetRawMemoryString(int memory, u32 address) const override;
|
|
|
|
bool IsAlive() const override;
|
|
|
|
bool IsBreakpoint(u32 address) const override;
|
2019-07-08 17:53:47 -04:00
|
|
|
void SetBreakpoint(u32 address) override;
|
|
|
|
void ClearBreakpoint(u32 address) override;
|
2015-07-30 06:47:02 -04:00
|
|
|
void ClearAllBreakpoints() override;
|
2019-07-08 17:53:47 -04:00
|
|
|
void ToggleBreakpoint(u32 address) override;
|
2015-07-30 06:47:02 -04:00
|
|
|
void ClearAllMemChecks() override;
|
2019-07-08 18:25:14 -04:00
|
|
|
bool IsMemCheck(u32 address, size_t size = 1) const override;
|
2019-07-08 17:53:47 -04:00
|
|
|
void ToggleMemCheck(u32 address, bool read = true, bool write = true, bool log = true) override;
|
2019-07-08 18:25:14 -04:00
|
|
|
u32 ReadMemory(u32 address) const override;
|
2009-06-17 19:50:59 +00:00
|
|
|
|
2014-08-30 17:23:13 -04:00
|
|
|
enum
|
|
|
|
{
|
2009-06-17 19:50:59 +00:00
|
|
|
EXTRAMEM_ARAM = 1,
|
|
|
|
};
|
2014-08-30 17:23:13 -04:00
|
|
|
|
2019-07-08 18:25:14 -04:00
|
|
|
u32 ReadExtraMemory(int memory, u32 address) const override;
|
|
|
|
u32 ReadInstruction(u32 address) const override;
|
|
|
|
u32 GetPC() const override;
|
2019-07-08 17:53:47 -04:00
|
|
|
void SetPC(u32 address) override;
|
2015-07-30 06:47:02 -04:00
|
|
|
void Step() override {}
|
|
|
|
void RunToBreakpoint() override;
|
2019-07-08 18:25:14 -04:00
|
|
|
u32 GetColor(u32 address) const override;
|
|
|
|
std::string GetDescription(u32 address) const override;
|
2018-01-29 17:58:02 +01:00
|
|
|
|
2017-08-24 19:45:26 +01:00
|
|
|
std::shared_ptr<Core::NetworkCaptureLogger> NetworkLogger();
|
|
|
|
|
2018-01-29 17:58:02 +01:00
|
|
|
void Clear() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Common::Debug::Watches m_watches;
|
2018-05-21 18:46:03 +04:00
|
|
|
PPCPatches m_patches;
|
2017-08-24 19:45:26 +01:00
|
|
|
std::shared_ptr<Core::NetworkCaptureLogger> m_network_logger;
|
2008-07-12 17:40:22 +00:00
|
|
|
};
|