Mesen-SX/Core/Breakpoint.cpp

68 lines
1.4 KiB
C++
Raw Normal View History

2019-03-01 20:27:49 -05:00
#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
bool Breakpoint::Matches(uint32_t memoryAddr, AddressInfo &info)
{
2019-07-30 22:34:52 -04:00
if(_memoryType <= DebugUtilities::GetLastCpuMemoryType()) {
2019-03-01 20:27:49 -05:00
if(_startAddr == -1) {
return true;
} else if(_endAddr == -1) {
return (int32_t)memoryAddr == _startAddr;
} else {
return (int32_t)memoryAddr >= _startAddr && (int32_t)memoryAddr <= _endAddr;
}
} else if(_memoryType == info.Type) {
if(_startAddr == -1) {
return true;
} else if(_endAddr == -1) {
return info.Address == _startAddr;
} else {
return info.Address >= _startAddr && info.Address <= _endAddr;
}
}
return false;
}
bool Breakpoint::HasBreakpointType(BreakpointType type)
{
switch(type) {
default:
case BreakpointType::Execute: return ((uint8_t)_type & (uint8_t)BreakpointTypeFlags::Execute) != 0;
case BreakpointType::Read: return ((uint8_t)_type & (uint8_t)BreakpointTypeFlags::Read) != 0;
case BreakpointType::Write: return ((uint8_t)_type & (uint8_t)BreakpointTypeFlags::Write) != 0;
}
}
string Breakpoint::GetCondition()
{
return _condition;
}
bool Breakpoint::HasCondition()
{
return _condition[0] != 0;
}
uint32_t Breakpoint::GetId()
{
return _id;
}
CpuType Breakpoint::GetCpuType()
2019-03-01 20:27:49 -05:00
{
return _cpuType;
2019-03-01 20:27:49 -05:00
}
bool Breakpoint::IsEnabled()
{
return _enabled;
}
bool Breakpoint::IsMarked()
{
return _markEvent;
}