Mesen-SX/Core/Breakpoint.cpp

63 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)
{
if(memoryType <= DebugUtilities::GetLastCpuMemoryType() && !DebugUtilities::IsPpuMemory(info.Type)) {
if(startAddr == -1) {
2019-03-01 20:27:49 -05:00
return true;
} else if(endAddr == -1) {
return (int32_t)memoryAddr == startAddr;
2019-03-01 20:27:49 -05:00
} else {
return (int32_t)memoryAddr >= startAddr && (int32_t)memoryAddr <= endAddr;
2019-03-01 20:27:49 -05:00
}
} else if(memoryType == info.Type) {
if(startAddr == -1) {
2019-03-01 20:27:49 -05:00
return true;
} else if(endAddr == -1) {
return info.Address == startAddr;
2019-03-01 20:27:49 -05:00
} else {
return info.Address >= startAddr && info.Address <= endAddr;
2019-03-01 20:27:49 -05:00
}
}
return false;
}
bool Breakpoint::HasBreakpointType(BreakpointType bpType)
2019-03-01 20:27:49 -05:00
{
switch(bpType) {
2019-03-01 20:27:49 -05:00
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;
2019-03-01 20:27:49 -05:00
}
}
string Breakpoint::GetCondition()
{
return condition;
2019-03-01 20:27:49 -05:00
}
bool Breakpoint::HasCondition()
{
return condition[0] != 0;
2019-03-01 20:27:49 -05:00
}
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;
2019-03-01 20:27:49 -05:00
}
bool Breakpoint::IsMarked()
{
return markEvent;
2019-03-01 20:27:49 -05:00
}