Mesen-SX/Core/BreakpointManager.h

45 lines
1.2 KiB
C
Raw Normal View History

2019-03-01 20:27:49 -05:00
#pragma once
#include "stdafx.h"
#include "Breakpoint.h"
#include "DebugTypes.h"
2019-07-30 22:34:52 -04:00
#include "DebugUtilities.h"
2019-03-01 20:27:49 -05:00
class ExpressionEvaluator;
class Debugger;
class IEventManager;
2019-03-01 20:27:49 -05:00
struct ExpressionData;
enum class MemoryOperationType;
class BreakpointManager
{
private:
static constexpr int BreakpointTypeCount = 3; //Read, Write, Exec
Debugger *_debugger;
CpuType _cpuType;
IEventManager *_eventManager;
2019-03-01 20:27:49 -05:00
vector<Breakpoint> _breakpoints[BreakpointTypeCount];
vector<ExpressionData> _rpnList[BreakpointTypeCount];
bool _hasBreakpoint;
bool _hasBreakpointType[BreakpointTypeCount] = {};
2019-03-01 20:27:49 -05:00
unique_ptr<ExpressionEvaluator> _bpExpEval;
2019-03-01 20:27:49 -05:00
BreakpointType GetBreakpointType(MemoryOperationType type);
int InternalCheckBreakpoint(MemoryOperationInfo operationInfo, AddressInfo &address);
2019-03-01 20:27:49 -05:00
public:
BreakpointManager(Debugger *debugger, CpuType cpuType, IEventManager* eventManager = nullptr);
2019-03-01 20:27:49 -05:00
void SetBreakpoints(Breakpoint breakpoints[], uint32_t count);
__forceinline int CheckBreakpoint(MemoryOperationInfo operationInfo, AddressInfo &address);
};
__forceinline int BreakpointManager::CheckBreakpoint(MemoryOperationInfo operationInfo, AddressInfo &address)
{
if(!_hasBreakpoint) {
return -1;
}
return InternalCheckBreakpoint(operationInfo, address);
}