[Debugger] Remove temporary out of read/write Breakpoints

This commit is contained in:
zilmar 2018-01-24 21:51:04 +11:00
parent 95358b1ac1
commit deada521bb
4 changed files with 19 additions and 35 deletions

View File

@ -21,21 +21,21 @@ CBreakpoints::CBreakpoints()
{ {
} }
bool CBreakpoints::RBPAdd(uint32_t address, bool bTemporary) bool CBreakpoints::RBPAdd(uint32_t address)
{ {
if (!ReadBPExists(address)) if (!ReadBPExists(address))
{ {
m_ReadMem.insert(breakpoints_t::value_type(address, bTemporary)); m_ReadMem.insert(breakpoints_t::value_type(address, false));
return true; return true;
} }
return false; return false;
} }
bool CBreakpoints::WBPAdd(uint32_t address, bool bTemporary) bool CBreakpoints::WBPAdd(uint32_t address)
{ {
if (!WriteBPExists(address)) if (!WriteBPExists8(address))
{ {
m_WriteMem.insert(breakpoints_t::value_type(address, bTemporary)); m_WriteMem.insert(breakpoints_t::value_type(address, false));
return true; return true;
} }
return false; return false;
@ -87,17 +87,17 @@ void CBreakpoints::RemoveExecution(uint32_t address)
} }
} }
void CBreakpoints::RBPToggle(uint32_t address, bool bTemporary) void CBreakpoints::RBPToggle(uint32_t address)
{ {
if (RBPAdd(address, bTemporary) == false) if (RBPAdd(address) == false)
{ {
RBPRemove(address); RBPRemove(address);
} }
} }
void CBreakpoints::WBPToggle(uint32_t address, bool bTemporary) void CBreakpoints::WBPToggle(uint32_t address)
{ {
if (WBPAdd(address, bTemporary) == false) if (WBPAdd(address) == false)
{ {
WBPRemove(address); WBPRemove(address);
} }
@ -133,37 +133,21 @@ void CBreakpoints::BPClear()
EBPClear(); EBPClear();
} }
CBreakpoints::BPSTATE CBreakpoints::ReadBPExists(uint32_t address, bool bRemoveTemp) CBreakpoints::BPSTATE CBreakpoints::ReadBPExists(uint32_t address)
{ {
breakpoints_t::const_iterator itr = m_ReadMem.find(address); breakpoints_t::const_iterator itr = m_ReadMem.find(address);
if (itr != m_ReadMem.end()) if (itr != m_ReadMem.end())
{ {
if (itr->second)
{
if (bRemoveTemp)
{
m_ReadMem.erase(itr);
}
return BP_SET_TEMP;
}
return BP_SET; return BP_SET;
} }
return BP_NOT_SET; return BP_NOT_SET;
} }
CBreakpoints::BPSTATE CBreakpoints::WriteBPExists(uint32_t address, bool bRemoveTemp) CBreakpoints::BPSTATE CBreakpoints::WriteBPExists8(uint32_t address)
{ {
breakpoints_t::const_iterator itr = m_WriteMem.find(address); breakpoints_t::const_iterator itr = m_WriteMem.find(address);
if (itr != m_WriteMem.end()) if (itr != m_WriteMem.end())
{ {
if (itr->second)
{
if (bRemoveTemp)
{
m_ReadMem.erase(itr);
}
return BP_SET_TEMP;
}
return BP_SET; return BP_SET;
} }
return BP_NOT_SET; return BP_NOT_SET;

View File

@ -32,18 +32,18 @@ public:
const breakpoints_t & WriteMem(void) const { return m_WriteMem; } const breakpoints_t & WriteMem(void) const { return m_WriteMem; }
const breakpoints_t & Execution(void) const { return m_Execution; } const breakpoints_t & Execution(void) const { return m_Execution; }
BPSTATE ReadBPExists(uint32_t address, bool bRemoveTemp = false); BPSTATE ReadBPExists(uint32_t address);
BPSTATE WriteBPExists(uint32_t address, bool bRemoveTemp = false); BPSTATE WriteBPExists8(uint32_t address);
BPSTATE ExecutionBPExists(uint32_t address, bool bRemoveTemp = false); BPSTATE ExecutionBPExists(uint32_t address, bool bRemoveTemp = false);
bool RBPAdd(uint32_t address, bool bTemporary = false); bool RBPAdd(uint32_t address);
void RBPRemove(uint32_t address); void RBPRemove(uint32_t address);
void RBPToggle(uint32_t address, bool bTemporary = false); void RBPToggle(uint32_t address);
void RBPClear(); void RBPClear();
bool WBPAdd(uint32_t address, bool bTemporary = false); bool WBPAdd(uint32_t address);
void WBPRemove(uint32_t address); void WBPRemove(uint32_t address);
void WBPToggle(uint32_t address, bool bTemporary = false); void WBPToggle(uint32_t address);
void WBPClear(); void WBPClear();
bool AddExecution(uint32_t address, bool bTemporary = false); bool AddExecution(uint32_t address, bool bTemporary = false);

View File

@ -718,7 +718,7 @@ void CDebugMemoryView::SelectColors(uint32_t vaddr, bool changed, COLORREF& bgCo
CSymbols::LeaveCriticalSection(); CSymbols::LeaveCriticalSection();
bool bHaveReadBP = m_Breakpoints->ReadBPExists(vaddr) == CBreakpoints::BP_SET; bool bHaveReadBP = m_Breakpoints->ReadBPExists(vaddr) == CBreakpoints::BP_SET;
bool bHaveWriteBP = m_Breakpoints->WriteBPExists(vaddr) == CBreakpoints::BP_SET; bool bHaveWriteBP = m_Breakpoints->WriteBPExists8(vaddr) == CBreakpoints::BP_SET;
fgHiColor = RGB(0x00, 0x00, 0x00); fgHiColor = RGB(0x00, 0x00, 0x00);

View File

@ -414,7 +414,7 @@ void CDebuggerUI::CPUStepStarted()
{ {
m_ScriptSystem->HookCPUWrite()->InvokeByParamInRange(memoryAddress); m_ScriptSystem->HookCPUWrite()->InvokeByParamInRange(memoryAddress);
if (m_Breakpoints->WriteBPExists(memoryAddress)) if (m_Breakpoints->WriteBPExists8(memoryAddress))
{ {
goto breakpoint_hit; goto breakpoint_hit;
} }