Mesen-SX/Core/BreakpointManager.h

47 lines
1.4 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"
2020-12-27 22:24:23 -05:00
#include "ExpressionEvaluator.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;
unordered_map<int, Breakpoint> _breakpoints[BreakpointTypeCount];
unordered_map<int, 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);
void GetBreakpoints(Breakpoint* breakpoints, int& execs, int& reads, int& writes);
__forceinline int CheckBreakpoint(MemoryOperationInfo operationInfo, AddressInfo &address);
};
__forceinline int BreakpointManager::CheckBreakpoint(MemoryOperationInfo operationInfo, AddressInfo &address)
{
if(!_hasBreakpoint) {
return -1;
}
return InternalCheckBreakpoint(operationInfo, address);
}