mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-26 00:45:49 +00:00
Add skeleton for conditional breakpoints.
This commit is contained in:
parent
d513fab60d
commit
9209a30d9b
@ -157,6 +157,35 @@ void CBreakPoints::ClearTemporaryBreakPoints()
|
||||
Update();
|
||||
}
|
||||
|
||||
void CBreakPoints::ChangeBreakPointAddCond(u32 addr, const BreakPointCond &cond)
|
||||
{
|
||||
size_t bp = FindBreakpoint(addr);
|
||||
if (bp != INVALID_BREAKPOINT)
|
||||
{
|
||||
breakPoints_[bp].hasCond = true;
|
||||
breakPoints_[bp].cond = cond;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CBreakPoints::ChangeBreakPointRemoveCond(u32 addr)
|
||||
{
|
||||
size_t bp = FindBreakpoint(addr);
|
||||
if (bp != INVALID_BREAKPOINT)
|
||||
{
|
||||
breakPoints_[bp].hasCond = false;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
BreakPointCond *CBreakPoints::GetBreakPointCondition(u32 addr)
|
||||
{
|
||||
size_t bp = FindBreakpoint(addr);
|
||||
if (bp != INVALID_BREAKPOINT && breakPoints_[bp].hasCond)
|
||||
return &breakPoints_[bp].cond;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CBreakPoints::AddMemCheck(u32 start, u32 end, MemCheckCondition cond, MemCheckResult result)
|
||||
{
|
||||
size_t mc = FindMemCheck(start, end);
|
||||
@ -236,12 +265,12 @@ int CBreakPoints::GetNumBreakpoints()
|
||||
return (int)breakPoints_.size();
|
||||
}
|
||||
|
||||
const BreakPoint CBreakPoints::GetBreakpoint(int i)
|
||||
const BreakPoint CBreakPoints::GetBreakpoint(size_t i)
|
||||
{
|
||||
return breakPoints_[i];
|
||||
}
|
||||
|
||||
int CBreakPoints::GetBreakpointAddress(int i)
|
||||
int CBreakPoints::GetBreakpointAddress(size_t i)
|
||||
{
|
||||
return breakPoints_[i].iAddress;
|
||||
}
|
||||
|
@ -20,12 +20,28 @@
|
||||
#include "../../Globals.h"
|
||||
#include <vector>
|
||||
|
||||
// TODO: Replace with expression or something.
|
||||
struct BreakPointCond
|
||||
{
|
||||
u32 todo;
|
||||
|
||||
u32 Evaluate() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
struct BreakPoint
|
||||
{
|
||||
BreakPoint() : hasCond(false) {}
|
||||
|
||||
u32 iAddress;
|
||||
bool bOn;
|
||||
bool bTemporary;
|
||||
|
||||
bool hasCond;
|
||||
BreakPointCond cond;
|
||||
|
||||
bool operator == (const BreakPoint &other) const {
|
||||
return iAddress == other.iAddress;
|
||||
}
|
||||
@ -86,6 +102,11 @@ public:
|
||||
static void ClearAllBreakPoints();
|
||||
static void ClearTemporaryBreakPoints();
|
||||
|
||||
// Makes a copy. Temporary breakpoints can't have conditions.
|
||||
static void ChangeBreakPointAddCond(u32 addr, const BreakPointCond &cond);
|
||||
static void ChangeBreakPointRemoveCond(u32 addr);
|
||||
static BreakPointCond *GetBreakPointCondition(u32 addr);
|
||||
|
||||
static void AddMemCheck(u32 start, u32 end, MemCheckCondition cond, MemCheckResult result);
|
||||
static void RemoveMemCheck(u32 start, u32 end);
|
||||
static void ChangeMemCheck(u32 start, u32 end, MemCheckCondition cond, MemCheckResult result);
|
||||
@ -93,8 +114,8 @@ public:
|
||||
|
||||
static MemCheck *GetMemCheck(u32 address, int size);
|
||||
static int GetNumBreakpoints();
|
||||
static const BreakPoint GetBreakpoint(int i);
|
||||
static int GetBreakpointAddress(int i);
|
||||
static const BreakPoint GetBreakpoint(size_t i);
|
||||
static int GetBreakpointAddress(size_t i);
|
||||
|
||||
// TODO: MemChecks somehow too?
|
||||
static void SetSkipFirst(u32 pc) { breakSkipFirstAt_ = pc; }
|
||||
|
@ -65,6 +65,10 @@ u32 JitBreakpoint()
|
||||
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc)
|
||||
return 0;
|
||||
|
||||
auto cond = CBreakPoints::GetBreakPointCondition(currentMIPS->pc);
|
||||
if (cond && !cond->Evaluate())
|
||||
return 0;
|
||||
|
||||
Core_EnableStepping(true);
|
||||
host->SetDebugMode(true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user