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
|
|
|
|
2020-12-19 23:30:09 +03:00
|
|
|
bool Breakpoint::Matches(uint32_t memoryAddr, AddressInfo& info)
|
2019-03-01 20:27:49 -05:00
|
|
|
{
|
2020-12-19 23:30:09 +03:00
|
|
|
if (memoryType <= DebugUtilities::GetLastCpuMemoryType() && !DebugUtilities::IsPpuMemory(info.Type))
|
|
|
|
{
|
|
|
|
if (startAddr == -1)
|
|
|
|
{
|
2019-03-01 20:27:49 -05:00
|
|
|
return true;
|
2020-12-19 23:30:09 +03:00
|
|
|
}
|
|
|
|
else if (endAddr == -1)
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return (int32_t)memoryAddr == startAddr;
|
2020-12-19 23:30:09 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return (int32_t)memoryAddr >= startAddr && (int32_t)memoryAddr <= endAddr;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
2020-12-19 23:30:09 +03:00
|
|
|
}
|
|
|
|
else if (memoryType == info.Type)
|
|
|
|
{
|
|
|
|
if (startAddr == -1)
|
|
|
|
{
|
2019-03-01 20:27:49 -05:00
|
|
|
return true;
|
2020-12-19 23:30:09 +03:00
|
|
|
}
|
|
|
|
else if (endAddr == -1)
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return info.Address == startAddr;
|
2020-12-19 23:30:09 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return info.Address >= startAddr && info.Address <= endAddr;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-10-29 02:19:23 +03:00
|
|
|
bool Breakpoint::HasBreakpointType(BreakpointType bpType)
|
2019-03-01 20:27:49 -05:00
|
|
|
{
|
2020-12-19 23:30:09 +03:00
|
|
|
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;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
string Breakpoint::GetCondition()
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return condition;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Breakpoint::HasCondition()
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return condition[0] != 0;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
|
|
|
|
2019-07-25 22:22:09 -04:00
|
|
|
CpuType Breakpoint::GetCpuType()
|
2019-03-01 20:27:49 -05:00
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return cpuType;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Breakpoint::IsEnabled()
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return enabled;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Breakpoint::IsMarked()
|
|
|
|
{
|
2020-10-29 02:19:23 +03:00
|
|
|
return markEvent;
|
2019-03-01 20:27:49 -05:00
|
|
|
}
|