Mesen-SX/Core/Breakpoint.cpp
NovaSquirrel c0e249e993 Revert "Merge branch 'reformat_code'"
This reverts commit daf3b57e89, reversing
changes made to 7a6e0b7d77.
2021-03-10 11:13:28 -05:00

62 lines
1.4 KiB
C++

#include "stdafx.h"
#include "Breakpoint.h"
#include "DebugTypes.h"
#include "DebugUtilities.h"
bool Breakpoint::Matches(uint32_t memoryAddr, AddressInfo &info)
{
if(memoryType <= DebugUtilities::GetLastCpuMemoryType() && !DebugUtilities::IsPpuMemory(info.Type)) {
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 bpType)
{
switch(bpType) {
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;
}
CpuType Breakpoint::GetCpuType()
{
return cpuType;
}
bool Breakpoint::IsEnabled()
{
return enabled;
}
bool Breakpoint::IsMarked()
{
return markEvent;
}