From ea8fc594a51785cf7b730df7e91fcf96bafca0ff Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 23 Dec 2016 14:18:14 -0500 Subject: Common: Move BreakPoints into Core BreakPoints utilizes the jit global variable, so this was making Core and Common cyclical dependencies on one another. --- Source/Core/Common/BreakPoints.cpp | 313 -------------------- Source/Core/Common/BreakPoints.h | 130 --------- Source/Core/Common/CMakeLists.txt | 1 - Source/Core/Common/Common.vcxproj | 2 - Source/Core/Common/Common.vcxproj.filters | 2 - Source/Core/Core/CMakeLists.txt | 1 + Source/Core/Core/Core.vcxproj | 2 + Source/Core/Core/Core.vcxproj.filters | 6 + Source/Core/Core/PowerPC/BreakPoints.cpp | 314 +++++++++++++++++++++ Source/Core/Core/PowerPC/BreakPoints.h | 130 +++++++++ Source/Core/Core/PowerPC/PowerPC.h | 2 +- Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp | 5 +- Source/Core/DolphinWX/Debugger/BreakpointView.cpp | 5 +- .../Core/DolphinWX/Debugger/BreakpointWindow.cpp | 5 +- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 5 +- Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp | 5 +- 16 files changed, 469 insertions(+), 459 deletions(-) delete mode 100644 Source/Core/Common/BreakPoints.cpp delete mode 100644 Source/Core/Common/BreakPoints.h create mode 100644 Source/Core/Core/PowerPC/BreakPoints.cpp create mode 100644 Source/Core/Core/PowerPC/BreakPoints.h diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp deleted file mode 100644 index 75a074788b..0000000000 --- a/Source/Core/Common/BreakPoints.cpp +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2008 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include -#include -#include - -#include "Common/BreakPoints.h" -#include "Common/CommonTypes.h" -#include "Common/DebugInterface.h" -#include "Core/PowerPC/JitCommon/JitBase.h" -#include "Core/PowerPC/JitCommon/JitCache.h" - -bool BreakPoints::IsAddressBreakPoint(u32 address) const -{ - for (const TBreakPoint& bp : m_BreakPoints) - if (bp.iAddress == address) - return true; - - return false; -} - -bool BreakPoints::IsTempBreakPoint(u32 address) const -{ - for (const TBreakPoint& bp : m_BreakPoints) - if (bp.iAddress == address && bp.bTemporary) - return true; - - return false; -} - -BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const -{ - TBreakPointsStr bps; - for (const TBreakPoint& bp : m_BreakPoints) - { - if (!bp.bTemporary) - { - std::stringstream ss; - ss << std::hex << bp.iAddress << " " << (bp.bOn ? "n" : ""); - bps.push_back(ss.str()); - } - } - - return bps; -} - -void BreakPoints::AddFromStrings(const TBreakPointsStr& bpstrs) -{ - for (const std::string& bpstr : bpstrs) - { - TBreakPoint bp; - std::stringstream ss; - ss << std::hex << bpstr; - ss >> bp.iAddress; - bp.bOn = bpstr.find("n") != bpstr.npos; - bp.bTemporary = false; - Add(bp); - } -} - -void BreakPoints::Add(const TBreakPoint& bp) -{ - if (!IsAddressBreakPoint(bp.iAddress)) - { - m_BreakPoints.push_back(bp); - if (g_jit) - g_jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4, true); - } -} - -void BreakPoints::Add(u32 em_address, bool temp) -{ - if (!IsAddressBreakPoint(em_address)) // only add new addresses - { - TBreakPoint pt; // breakpoint settings - pt.bOn = true; - pt.bTemporary = temp; - pt.iAddress = em_address; - - m_BreakPoints.push_back(pt); - - if (g_jit) - g_jit->GetBlockCache()->InvalidateICache(em_address, 4, true); - } -} - -void BreakPoints::Remove(u32 em_address) -{ - for (auto i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) - { - if (i->iAddress == em_address) - { - m_BreakPoints.erase(i); - if (g_jit) - g_jit->GetBlockCache()->InvalidateICache(em_address, 4, true); - return; - } - } -} - -void BreakPoints::Clear() -{ - if (g_jit) - { - for (const TBreakPoint& bp : m_BreakPoints) - { - g_jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4, true); - } - } - - m_BreakPoints.clear(); -} - -void BreakPoints::ClearAllTemporary() -{ - auto bp = m_BreakPoints.begin(); - while (bp != m_BreakPoints.end()) - { - if (bp->bTemporary) - { - if (g_jit) - g_jit->GetBlockCache()->InvalidateICache(bp->iAddress, 4, true); - bp = m_BreakPoints.erase(bp); - } - else - { - ++bp; - } - } -} - -MemChecks::TMemChecksStr MemChecks::GetStrings() const -{ - TMemChecksStr mcs; - for (const TMemCheck& bp : m_MemChecks) - { - std::stringstream mc; - mc << std::hex << bp.StartAddress; - mc << " " << (bp.bRange ? bp.EndAddress : bp.StartAddress) << " " << (bp.bRange ? "n" : "") - << (bp.OnRead ? "r" : "") << (bp.OnWrite ? "w" : "") << (bp.Log ? "l" : "") - << (bp.Break ? "p" : ""); - mcs.push_back(mc.str()); - } - - return mcs; -} - -void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs) -{ - for (const std::string& mcstr : mcstrs) - { - TMemCheck mc; - std::stringstream ss; - ss << std::hex << mcstr; - ss >> mc.StartAddress; - mc.bRange = mcstr.find("n") != mcstr.npos; - mc.OnRead = mcstr.find("r") != mcstr.npos; - mc.OnWrite = mcstr.find("w") != mcstr.npos; - mc.Log = mcstr.find("l") != mcstr.npos; - mc.Break = mcstr.find("p") != mcstr.npos; - if (mc.bRange) - ss >> mc.EndAddress; - else - mc.EndAddress = mc.StartAddress; - Add(mc); - } -} - -void MemChecks::Add(const TMemCheck& _rMemoryCheck) -{ - bool had_any = HasAny(); - if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr) - m_MemChecks.push_back(_rMemoryCheck); - // If this is the first one, clear the JIT cache so it can switch to - // watchpoint-compatible code. - if (!had_any && g_jit) - g_jit->GetBlockCache()->SchedulateClearCacheThreadSafe(); -} - -void MemChecks::Remove(u32 _Address) -{ - for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i) - { - if (i->StartAddress == _Address) - { - m_MemChecks.erase(i); - if (!HasAny() && g_jit) - g_jit->GetBlockCache()->SchedulateClearCacheThreadSafe(); - return; - } - } -} - -TMemCheck* MemChecks::GetMemCheck(u32 address) -{ - for (TMemCheck& bp : m_MemChecks) - { - if (bp.bRange) - { - if (address >= bp.StartAddress && address <= bp.EndAddress) - return &(bp); - } - else if (bp.StartAddress == address) - { - return &(bp); - } - } - - // none found - return nullptr; -} - -bool TMemCheck::Action(DebugInterface* debug_interface, u32 iValue, u32 addr, bool write, int size, - u32 pc) -{ - if ((write && OnWrite) || (!write && OnRead)) - { - if (Log) - { - NOTICE_LOG(MEMMAP, "MBP %08x (%s) %s%i %0*x at %08x (%s)", pc, - debug_interface->GetDescription(pc).c_str(), write ? "Write" : "Read", size * 8, - size * 2, iValue, addr, debug_interface->GetDescription(addr).c_str()); - } - if (Break) - return true; - } - return false; -} - -bool Watches::IsAddressWatch(u32 _iAddress) const -{ - for (const TWatch& bp : m_Watches) - if (bp.iAddress == _iAddress) - return true; - - return false; -} - -Watches::TWatchesStr Watches::GetStrings() const -{ - TWatchesStr bps; - for (const TWatch& bp : m_Watches) - { - std::stringstream ss; - ss << std::hex << bp.iAddress << " " << bp.name; - bps.push_back(ss.str()); - } - - return bps; -} - -void Watches::AddFromStrings(const TWatchesStr& bpstrs) -{ - for (const std::string& bpstr : bpstrs) - { - TWatch bp; - std::stringstream ss; - ss << std::hex << bpstr; - ss >> bp.iAddress; - ss >> std::ws; - getline(ss, bp.name); - Add(bp); - } -} - -void Watches::Add(const TWatch& bp) -{ - if (!IsAddressWatch(bp.iAddress)) - { - m_Watches.push_back(bp); - } -} - -void Watches::Add(u32 em_address) -{ - if (!IsAddressWatch(em_address)) // only add new addresses - { - TWatch pt; // breakpoint settings - pt.bOn = true; - pt.iAddress = em_address; - - m_Watches.push_back(pt); - } -} - -void Watches::Update(int count, u32 em_address) -{ - m_Watches.at(count).iAddress = em_address; -} - -void Watches::UpdateName(int count, const std::string name) -{ - m_Watches.at(count).name = name; -} - -void Watches::Remove(u32 em_address) -{ - for (auto i = m_Watches.begin(); i != m_Watches.end(); ++i) - { - if (i->iAddress == em_address) - { - m_Watches.erase(i); - return; - } - } -} - -void Watches::Clear() -{ - m_Watches.clear(); -} diff --git a/Source/Core/Common/BreakPoints.h b/Source/Core/Common/BreakPoints.h deleted file mode 100644 index 186236b23c..0000000000 --- a/Source/Core/Common/BreakPoints.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2008 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include -#include - -#include "Common/CommonTypes.h" - -class DebugInterface; - -struct TBreakPoint -{ - u32 iAddress; - bool bOn; - bool bTemporary; -}; - -struct TMemCheck -{ - TMemCheck() - { - numHits = 0; - StartAddress = EndAddress = 0; - bRange = OnRead = OnWrite = Log = Break = false; - } - - u32 StartAddress; - u32 EndAddress; - - bool bRange; - - bool OnRead; - bool OnWrite; - - bool Log; - bool Break; - - u32 numHits; - - // returns whether to break - bool Action(DebugInterface* dbg_interface, u32 _iValue, u32 addr, bool write, int size, u32 pc); -}; - -struct TWatch -{ - std::string name = ""; - u32 iAddress; - bool bOn; -}; - -// Code breakpoints. -class BreakPoints -{ -public: - typedef std::vector TBreakPoints; - typedef std::vector TBreakPointsStr; - - const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } - TBreakPointsStr GetStrings() const; - void AddFromStrings(const TBreakPointsStr& bps); - - // is address breakpoint - bool IsAddressBreakPoint(u32 address) const; - bool IsTempBreakPoint(u32 address) const; - - // Add BreakPoint - void Add(u32 em_address, bool temp = false); - void Add(const TBreakPoint& bp); - - // Remove Breakpoint - void Remove(u32 _iAddress); - void Clear(); - void ClearAllTemporary(); - -private: - TBreakPoints m_BreakPoints; -}; - -// Memory breakpoints -class MemChecks -{ -public: - typedef std::vector TMemChecks; - typedef std::vector TMemChecksStr; - - TMemChecks m_MemChecks; - - const TMemChecks& GetMemChecks() { return m_MemChecks; } - TMemChecksStr GetStrings() const; - void AddFromStrings(const TMemChecksStr& mcs); - - void Add(const TMemCheck& _rMemoryCheck); - - // memory breakpoint - TMemCheck* GetMemCheck(u32 address); - void Remove(u32 _Address); - - void Clear() { m_MemChecks.clear(); } - bool HasAny() const { return !m_MemChecks.empty(); } -}; - -class Watches -{ -public: - typedef std::vector TWatches; - typedef std::vector TWatchesStr; - - const TWatches& GetWatches() { return m_Watches; } - TWatchesStr GetStrings() const; - void AddFromStrings(const TWatchesStr& bps); - - bool IsAddressWatch(u32 _iAddress) const; - - // Add BreakPoint - void Add(u32 em_address); - void Add(const TWatch& bp); - - void Update(int count, u32 em_address); - void UpdateName(int count, const std::string name); - - // Remove Breakpoint - void Remove(u32 _iAddress); - void Clear(); - -private: - TWatches m_Watches; -}; diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 7da6a0a037..0a99131bc4 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -1,5 +1,4 @@ set(SRCS Analytics.cpp - BreakPoints.cpp CDUtils.cpp ColorUtil.cpp ENetUtil.cpp diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index 1e88bd5e33..1dfcf692cb 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -44,7 +44,6 @@ - @@ -146,7 +145,6 @@ - diff --git a/Source/Core/Common/Common.vcxproj.filters b/Source/Core/Common/Common.vcxproj.filters index 3ad3825e23..25a8bf3fd4 100644 --- a/Source/Core/Common/Common.vcxproj.filters +++ b/Source/Core/Common/Common.vcxproj.filters @@ -25,7 +25,6 @@ - @@ -229,7 +228,6 @@ - diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 5629e21f86..a1c72eba39 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -156,6 +156,7 @@ set(SRCS ActionReplay.cpp IPC_HLE/WII_IPC_HLE_WiiMote.cpp IPC_HLE/WiiMote_HID_Attr.cpp IPC_HLE/WiiNetConfig.cpp + PowerPC/BreakPoints.cpp PowerPC/MMU.cpp PowerPC/PowerPC.cpp PowerPC/PPCAnalyst.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index 944085b82b..599aa36e07 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -204,6 +204,7 @@ + @@ -423,6 +424,7 @@ + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index fb6c05b4cc..074218bbe1 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -276,6 +276,9 @@ HLE + + PowerPC + PowerPC\Cached Interpreter @@ -1235,6 +1238,9 @@ HW %28Flipper/Hollywood%29\Wiimote + + PowerPC + PowerPC diff --git a/Source/Core/Core/PowerPC/BreakPoints.cpp b/Source/Core/Core/PowerPC/BreakPoints.cpp new file mode 100644 index 0000000000..2836d7b6f2 --- /dev/null +++ b/Source/Core/Core/PowerPC/BreakPoints.cpp @@ -0,0 +1,314 @@ +// Copyright 2008 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Core/PowerPC/BreakPoints.h" + +#include +#include +#include + +#include "Common/CommonTypes.h" +#include "Common/DebugInterface.h" +#include "Core/PowerPC/JitCommon/JitBase.h" +#include "Core/PowerPC/JitCommon/JitCache.h" + +bool BreakPoints::IsAddressBreakPoint(u32 address) const +{ + for (const TBreakPoint& bp : m_BreakPoints) + if (bp.iAddress == address) + return true; + + return false; +} + +bool BreakPoints::IsTempBreakPoint(u32 address) const +{ + for (const TBreakPoint& bp : m_BreakPoints) + if (bp.iAddress == address && bp.bTemporary) + return true; + + return false; +} + +BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const +{ + TBreakPointsStr bps; + for (const TBreakPoint& bp : m_BreakPoints) + { + if (!bp.bTemporary) + { + std::stringstream ss; + ss << std::hex << bp.iAddress << " " << (bp.bOn ? "n" : ""); + bps.push_back(ss.str()); + } + } + + return bps; +} + +void BreakPoints::AddFromStrings(const TBreakPointsStr& bpstrs) +{ + for (const std::string& bpstr : bpstrs) + { + TBreakPoint bp; + std::stringstream ss; + ss << std::hex << bpstr; + ss >> bp.iAddress; + bp.bOn = bpstr.find("n") != bpstr.npos; + bp.bTemporary = false; + Add(bp); + } +} + +void BreakPoints::Add(const TBreakPoint& bp) +{ + if (!IsAddressBreakPoint(bp.iAddress)) + { + m_BreakPoints.push_back(bp); + if (g_jit) + g_jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4, true); + } +} + +void BreakPoints::Add(u32 em_address, bool temp) +{ + if (!IsAddressBreakPoint(em_address)) // only add new addresses + { + TBreakPoint pt; // breakpoint settings + pt.bOn = true; + pt.bTemporary = temp; + pt.iAddress = em_address; + + m_BreakPoints.push_back(pt); + + if (g_jit) + g_jit->GetBlockCache()->InvalidateICache(em_address, 4, true); + } +} + +void BreakPoints::Remove(u32 em_address) +{ + for (auto i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i) + { + if (i->iAddress == em_address) + { + m_BreakPoints.erase(i); + if (g_jit) + g_jit->GetBlockCache()->InvalidateICache(em_address, 4, true); + return; + } + } +} + +void BreakPoints::Clear() +{ + if (g_jit) + { + for (const TBreakPoint& bp : m_BreakPoints) + { + g_jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4, true); + } + } + + m_BreakPoints.clear(); +} + +void BreakPoints::ClearAllTemporary() +{ + auto bp = m_BreakPoints.begin(); + while (bp != m_BreakPoints.end()) + { + if (bp->bTemporary) + { + if (g_jit) + g_jit->GetBlockCache()->InvalidateICache(bp->iAddress, 4, true); + bp = m_BreakPoints.erase(bp); + } + else + { + ++bp; + } + } +} + +MemChecks::TMemChecksStr MemChecks::GetStrings() const +{ + TMemChecksStr mcs; + for (const TMemCheck& bp : m_MemChecks) + { + std::stringstream mc; + mc << std::hex << bp.StartAddress; + mc << " " << (bp.bRange ? bp.EndAddress : bp.StartAddress) << " " << (bp.bRange ? "n" : "") + << (bp.OnRead ? "r" : "") << (bp.OnWrite ? "w" : "") << (bp.Log ? "l" : "") + << (bp.Break ? "p" : ""); + mcs.push_back(mc.str()); + } + + return mcs; +} + +void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs) +{ + for (const std::string& mcstr : mcstrs) + { + TMemCheck mc; + std::stringstream ss; + ss << std::hex << mcstr; + ss >> mc.StartAddress; + mc.bRange = mcstr.find("n") != mcstr.npos; + mc.OnRead = mcstr.find("r") != mcstr.npos; + mc.OnWrite = mcstr.find("w") != mcstr.npos; + mc.Log = mcstr.find("l") != mcstr.npos; + mc.Break = mcstr.find("p") != mcstr.npos; + if (mc.bRange) + ss >> mc.EndAddress; + else + mc.EndAddress = mc.StartAddress; + Add(mc); + } +} + +void MemChecks::Add(const TMemCheck& _rMemoryCheck) +{ + bool had_any = HasAny(); + if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr) + m_MemChecks.push_back(_rMemoryCheck); + // If this is the first one, clear the JIT cache so it can switch to + // watchpoint-compatible code. + if (!had_any && g_jit) + g_jit->GetBlockCache()->SchedulateClearCacheThreadSafe(); +} + +void MemChecks::Remove(u32 _Address) +{ + for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i) + { + if (i->StartAddress == _Address) + { + m_MemChecks.erase(i); + if (!HasAny() && g_jit) + g_jit->GetBlockCache()->SchedulateClearCacheThreadSafe(); + return; + } + } +} + +TMemCheck* MemChecks::GetMemCheck(u32 address) +{ + for (TMemCheck& bp : m_MemChecks) + { + if (bp.bRange) + { + if (address >= bp.StartAddress && address <= bp.EndAddress) + return &(bp); + } + else if (bp.StartAddress == address) + { + return &(bp); + } + } + + // none found + return nullptr; +} + +bool TMemCheck::Action(DebugInterface* debug_interface, u32 iValue, u32 addr, bool write, int size, + u32 pc) +{ + if ((write && OnWrite) || (!write && OnRead)) + { + if (Log) + { + NOTICE_LOG(MEMMAP, "MBP %08x (%s) %s%i %0*x at %08x (%s)", pc, + debug_interface->GetDescription(pc).c_str(), write ? "Write" : "Read", size * 8, + size * 2, iValue, addr, debug_interface->GetDescription(addr).c_str()); + } + if (Break) + return true; + } + return false; +} + +bool Watches::IsAddressWatch(u32 _iAddress) const +{ + for (const TWatch& bp : m_Watches) + if (bp.iAddress == _iAddress) + return true; + + return false; +} + +Watches::TWatchesStr Watches::GetStrings() const +{ + TWatchesStr bps; + for (const TWatch& bp : m_Watches) + { + std::stringstream ss; + ss << std::hex << bp.iAddress << " " << bp.name; + bps.push_back(ss.str()); + } + + return bps; +} + +void Watches::AddFromStrings(const TWatchesStr& bpstrs) +{ + for (const std::string& bpstr : bpstrs) + { + TWatch bp; + std::stringstream ss; + ss << std::hex << bpstr; + ss >> bp.iAddress; + ss >> std::ws; + getline(ss, bp.name); + Add(bp); + } +} + +void Watches::Add(const TWatch& bp) +{ + if (!IsAddressWatch(bp.iAddress)) + { + m_Watches.push_back(bp); + } +} + +void Watches::Add(u32 em_address) +{ + if (!IsAddressWatch(em_address)) // only add new addresses + { + TWatch pt; // breakpoint settings + pt.bOn = true; + pt.iAddress = em_address; + + m_Watches.push_back(pt); + } +} + +void Watches::Update(int count, u32 em_address) +{ + m_Watches.at(count).iAddress = em_address; +} + +void Watches::UpdateName(int count, const std::string name) +{ + m_Watches.at(count).name = name; +} + +void Watches::Remove(u32 em_address) +{ + for (auto i = m_Watches.begin(); i != m_Watches.end(); ++i) + { + if (i->iAddress == em_address) + { + m_Watches.erase(i); + return; + } + } +} + +void Watches::Clear() +{ + m_Watches.clear(); +} diff --git a/Source/Core/Core/PowerPC/BreakPoints.h b/Source/Core/Core/PowerPC/BreakPoints.h new file mode 100644 index 0000000000..186236b23c --- /dev/null +++ b/Source/Core/Core/PowerPC/BreakPoints.h @@ -0,0 +1,130 @@ +// Copyright 2008 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +#include "Common/CommonTypes.h" + +class DebugInterface; + +struct TBreakPoint +{ + u32 iAddress; + bool bOn; + bool bTemporary; +}; + +struct TMemCheck +{ + TMemCheck() + { + numHits = 0; + StartAddress = EndAddress = 0; + bRange = OnRead = OnWrite = Log = Break = false; + } + + u32 StartAddress; + u32 EndAddress; + + bool bRange; + + bool OnRead; + bool OnWrite; + + bool Log; + bool Break; + + u32 numHits; + + // returns whether to break + bool Action(DebugInterface* dbg_interface, u32 _iValue, u32 addr, bool write, int size, u32 pc); +}; + +struct TWatch +{ + std::string name = ""; + u32 iAddress; + bool bOn; +}; + +// Code breakpoints. +class BreakPoints +{ +public: + typedef std::vector TBreakPoints; + typedef std::vector TBreakPointsStr; + + const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } + TBreakPointsStr GetStrings() const; + void AddFromStrings(const TBreakPointsStr& bps); + + // is address breakpoint + bool IsAddressBreakPoint(u32 address) const; + bool IsTempBreakPoint(u32 address) const; + + // Add BreakPoint + void Add(u32 em_address, bool temp = false); + void Add(const TBreakPoint& bp); + + // Remove Breakpoint + void Remove(u32 _iAddress); + void Clear(); + void ClearAllTemporary(); + +private: + TBreakPoints m_BreakPoints; +}; + +// Memory breakpoints +class MemChecks +{ +public: + typedef std::vector TMemChecks; + typedef std::vector TMemChecksStr; + + TMemChecks m_MemChecks; + + const TMemChecks& GetMemChecks() { return m_MemChecks; } + TMemChecksStr GetStrings() const; + void AddFromStrings(const TMemChecksStr& mcs); + + void Add(const TMemCheck& _rMemoryCheck); + + // memory breakpoint + TMemCheck* GetMemCheck(u32 address); + void Remove(u32 _Address); + + void Clear() { m_MemChecks.clear(); } + bool HasAny() const { return !m_MemChecks.empty(); } +}; + +class Watches +{ +public: + typedef std::vector TWatches; + typedef std::vector TWatchesStr; + + const TWatches& GetWatches() { return m_Watches; } + TWatchesStr GetStrings() const; + void AddFromStrings(const TWatchesStr& bps); + + bool IsAddressWatch(u32 _iAddress) const; + + // Add BreakPoint + void Add(u32 em_address); + void Add(const TWatch& bp); + + void Update(int count, u32 em_address); + void UpdateName(int count, const std::string name); + + // Remove Breakpoint + void Remove(u32 _iAddress); + void Clear(); + +private: + TWatches m_Watches; +}; diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 54c26c7096..c9216c5faf 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -8,10 +8,10 @@ #include #include -#include "Common/BreakPoints.h" #include "Common/CommonTypes.h" #include "Core/Debugger/PPCDebugInterface.h" +#include "Core/PowerPC/BreakPoints.h" #include "Core/PowerPC/Gekko.h" #include "Core/PowerPC/PPCCache.h" diff --git a/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp b/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp index db36092e62..363717a247 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp @@ -2,17 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Debugger/BreakpointDlg.h" + #include #include #include #include #include -#include "Common/BreakPoints.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" +#include "Core/PowerPC/BreakPoints.h" #include "Core/PowerPC/PowerPC.h" -#include "DolphinWX/Debugger/BreakpointDlg.h" #include "DolphinWX/Debugger/BreakpointWindow.h" #include "DolphinWX/WxUtils.h" diff --git a/Source/Core/DolphinWX/Debugger/BreakpointView.cpp b/Source/Core/DolphinWX/Debugger/BreakpointView.cpp index 7a2ae27270..f8c6266849 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointView.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointView.cpp @@ -2,17 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Debugger/BreakpointView.h" + #include #include #include -#include "Common/BreakPoints.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" +#include "Core/PowerPC/BreakPoints.h" #include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PowerPC.h" -#include "DolphinWX/Debugger/BreakpointView.h" #include "DolphinWX/Debugger/DebuggerUIUtil.h" #include "DolphinWX/WxUtils.h" diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp index 7e83b4502e..f7d8f2b210 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Debugger/BreakpointWindow.h" + #include // clang-format off @@ -12,16 +14,15 @@ #include // clang-format on -#include "Common/BreakPoints.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Core/ConfigManager.h" #include "Core/HW/Memmap.h" +#include "Core/PowerPC/BreakPoints.h" #include "Core/PowerPC/PowerPC.h" #include "DolphinWX/Debugger/BreakpointDlg.h" #include "DolphinWX/Debugger/BreakpointView.h" -#include "DolphinWX/Debugger/BreakpointWindow.h" #include "DolphinWX/Debugger/CodeWindow.h" #include "DolphinWX/Debugger/MemoryCheckDlg.h" #include "DolphinWX/AuiToolBar.h" diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index 348363ae8d..1b60ca1252 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Debugger/CodeWindow.h" + #include #include #include @@ -23,7 +25,6 @@ #include // clang-format on -#include "Common/BreakPoints.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" #include "Common/SymbolDB.h" @@ -34,6 +35,7 @@ #include "Core/HW/Memmap.h" #include "Core/HW/SystemTimers.h" #include "Core/Host.h" +#include "Core/PowerPC/BreakPoints.h" #include "Core/PowerPC/Gekko.h" #include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/PPCSymbolDB.h" @@ -41,7 +43,6 @@ #include "Core/PowerPC/PowerPC.h" #include "DolphinWX/Debugger/BreakpointWindow.h" #include "DolphinWX/Debugger/CodeView.h" -#include "DolphinWX/Debugger/CodeWindow.h" #include "DolphinWX/Debugger/DebuggerUIUtil.h" #include "DolphinWX/Debugger/JitWindow.h" #include "DolphinWX/Debugger/MemoryWindow.h" diff --git a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp index 9d1ca0ca5c..f9b1cf6510 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp @@ -2,18 +2,19 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Debugger/MemoryCheckDlg.h" + #include #include #include #include #include -#include "Common/BreakPoints.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" +#include "Core/PowerPC/BreakPoints.h" #include "Core/PowerPC/PowerPC.h" #include "DolphinWX/Debugger/BreakpointWindow.h" -#include "DolphinWX/Debugger/MemoryCheckDlg.h" #include "DolphinWX/WxUtils.h" MemoryCheckDlg::MemoryCheckDlg(wxWindow* parent) -- cgit v1.2.3