mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 20:30:08 +00:00
break_points: cleaned up, added find_if
s
This commit is contained in:
parent
5a7c3ad194
commit
e3efc613fd
@ -9,18 +9,20 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
|
bool BreakPoints::IsAddressBreakPoint(u32 iAddress)
|
||||||
{
|
{
|
||||||
for (auto breakpoint : m_BreakPoints)
|
auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; };
|
||||||
if (breakpoint.iAddress == _iAddress)
|
auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond);
|
||||||
|
if (it != m_BreakPoints.end())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
|
bool BreakPoints::IsTempBreakPoint(u32 iAddress)
|
||||||
{
|
{
|
||||||
for (auto breakpoint : m_BreakPoints)
|
auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress && bp.bTemporary; };
|
||||||
if (breakpoint.iAddress == _iAddress && breakpoint.bTemporary)
|
auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond);
|
||||||
|
if (it != m_BreakPoints.end())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -83,16 +85,10 @@ void BreakPoints::Add(u32 em_address, bool temp)
|
|||||||
|
|
||||||
void BreakPoints::Remove(u32 em_address)
|
void BreakPoints::Remove(u32 em_address)
|
||||||
{
|
{
|
||||||
for (auto i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
|
auto cond = [&em_address](const TBreakPoint& bp) { return bp.iAddress == em_address; };
|
||||||
{
|
auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond);
|
||||||
if (i->iAddress == em_address)
|
if (it != m_BreakPoints.end())
|
||||||
{
|
m_BreakPoints.erase(it);
|
||||||
m_BreakPoints.erase(i);
|
|
||||||
//if (jit)
|
|
||||||
// jit->GetBlockCache()->InvalidateICache(em_address, 4);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakPoints::Clear()
|
void BreakPoints::Clear()
|
||||||
@ -150,22 +146,18 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemChecks::Add(const TMemCheck& _rMemoryCheck)
|
void MemChecks::Add(const TMemCheck& rMemoryCheck)
|
||||||
{
|
{
|
||||||
if (GetMemCheck(_rMemoryCheck.StartAddress) == 0)
|
if (GetMemCheck(rMemoryCheck.StartAddress) == 0)
|
||||||
m_MemChecks.push_back(_rMemoryCheck);
|
m_MemChecks.push_back(rMemoryCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemChecks::Remove(u32 _Address)
|
void MemChecks::Remove(u32 Address)
|
||||||
{
|
{
|
||||||
for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
|
auto cond = [&Address](const TMemCheck& mc) { return mc.StartAddress == Address; };
|
||||||
{
|
auto it = std::find_if(m_MemChecks.begin(), m_MemChecks.end(), cond);
|
||||||
if (i->StartAddress == _Address)
|
if (it != m_MemChecks.end())
|
||||||
{
|
m_MemChecks.erase(it);
|
||||||
m_MemChecks.erase(i);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TMemCheck *MemChecks::GetMemCheck(u32 address)
|
TMemCheck *MemChecks::GetMemCheck(u32 address)
|
||||||
|
@ -21,11 +21,12 @@ struct TBreakPoint
|
|||||||
|
|
||||||
struct TMemCheck
|
struct TMemCheck
|
||||||
{
|
{
|
||||||
TMemCheck() {
|
TMemCheck():
|
||||||
numHits = 0;
|
StartAddress(0), EndAddress(0),
|
||||||
StartAddress = EndAddress = 0;
|
bRange(false), OnRead(false), OnWrite(false),
|
||||||
bRange = OnRead = OnWrite = Log = Break = false;
|
Log(false), Break(false), numHits(0)
|
||||||
}
|
{ }
|
||||||
|
|
||||||
u32 StartAddress;
|
u32 StartAddress;
|
||||||
u32 EndAddress;
|
u32 EndAddress;
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ struct TMemCheck
|
|||||||
|
|
||||||
u32 numHits;
|
u32 numHits;
|
||||||
|
|
||||||
void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr,
|
void Action(DebugInterface *dbg_interface, u32 iValue, u32 addr,
|
||||||
bool write, int size, u32 pc);
|
bool write, int size, u32 pc);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,18 +57,18 @@ public:
|
|||||||
void AddFromStrings(const TBreakPointsStr& bps);
|
void AddFromStrings(const TBreakPointsStr& bps);
|
||||||
|
|
||||||
// is address breakpoint
|
// is address breakpoint
|
||||||
bool IsAddressBreakPoint(u32 _iAddress);
|
bool IsAddressBreakPoint(u32 iAddress);
|
||||||
bool IsTempBreakPoint(u32 _iAddress);
|
bool IsTempBreakPoint(u32 iAddress);
|
||||||
|
|
||||||
// Add BreakPoint
|
// Add BreakPoint
|
||||||
void Add(u32 em_address, bool temp=false);
|
void Add(u32 em_address, bool temp=false);
|
||||||
void Add(const TBreakPoint& bp);
|
void Add(const TBreakPoint& bp);
|
||||||
|
|
||||||
// Remove Breakpoint
|
// Remove Breakpoint
|
||||||
void Remove(u32 _iAddress);
|
void Remove(u32 iAddress);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
void DeleteByAddress(u32 _Address);
|
void DeleteByAddress(u32 Address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TBreakPoints m_BreakPoints;
|
TBreakPoints m_BreakPoints;
|
||||||
@ -89,7 +90,7 @@ public:
|
|||||||
TMemChecksStr GetStrings() const;
|
TMemChecksStr GetStrings() const;
|
||||||
void AddFromStrings(const TMemChecksStr& mcs);
|
void AddFromStrings(const TMemChecksStr& mcs);
|
||||||
|
|
||||||
void Add(const TMemCheck& _rMemoryCheck);
|
void Add(const TMemCheck& rMemoryCheck);
|
||||||
|
|
||||||
// memory breakpoint
|
// memory breakpoint
|
||||||
TMemCheck *GetMemCheck(u32 address);
|
TMemCheck *GetMemCheck(u32 address);
|
||||||
@ -99,4 +100,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user