forked from OSchip/llvm-project
Reset the debug status register, only if necessary, before we resume,
which saves unnecessary traffic to the kernel. llvm-svn: 139410
This commit is contained in:
parent
32ed0d204d
commit
67b20bbbee
|
@ -546,15 +546,24 @@ DNBArchImplI386::ThreadWillResume()
|
|||
EnableHardwareSingleStep(true);
|
||||
}
|
||||
|
||||
// Reset the debug status register before we resume.
|
||||
// Reset the debug status register, if necessary, before we resume.
|
||||
kern_return_t kret = GetDBGState(false);
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::ThreadWillResume() GetDBGState() => 0x%8.8x.", kret);
|
||||
if (kret == KERN_SUCCESS)
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::ThreadWillResume() GetDBGState() => 0x%8.8x.", kret);
|
||||
if (kret != KERN_SUCCESS)
|
||||
return;
|
||||
|
||||
DBG debug_state = m_state.context.dbg;
|
||||
bool need_reset = false;
|
||||
uint32_t i, num = NumSupportedHardwareWatchpoints();
|
||||
for (i = 0; i < num; ++i)
|
||||
if (IsWatchpointHit(debug_state, i))
|
||||
need_reset = true;
|
||||
|
||||
if (need_reset)
|
||||
{
|
||||
DBG debug_state = m_state.context.dbg;
|
||||
ClearWatchpointHits(debug_state);
|
||||
kret = SetDBGState();
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::ThreadWillResume() SetDBGState() => 0x%8.8x.", kret);
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::ThreadWillResume() SetDBGState() => 0x%8.8x.", kret);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -475,12 +475,21 @@ DNBArchImplX86_64::ThreadWillResume()
|
|||
EnableHardwareSingleStep(true);
|
||||
}
|
||||
|
||||
// Reset the debug status register before we resume.
|
||||
// Reset the debug status register, if necessary, before we resume.
|
||||
kern_return_t kret = GetDBGState(false);
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::ThreadWillResume() GetDBGState() => 0x%8.8x.", kret);
|
||||
if (kret == KERN_SUCCESS)
|
||||
if (kret != KERN_SUCCESS)
|
||||
return;
|
||||
|
||||
DBG debug_state = m_state.context.dbg;
|
||||
bool need_reset = false;
|
||||
uint32_t i, num = NumSupportedHardwareWatchpoints();
|
||||
for (i = 0; i < num; ++i)
|
||||
if (IsWatchpointHit(debug_state, i))
|
||||
need_reset = true;
|
||||
|
||||
if (need_reset)
|
||||
{
|
||||
DBG debug_state = m_state.context.dbg;
|
||||
ClearWatchpointHits(debug_state);
|
||||
kret = SetDBGState();
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::ThreadWillResume() SetDBGState() => 0x%8.8x.", kret);
|
||||
|
@ -807,7 +816,7 @@ uint32_t
|
|||
DNBArchImplX86_64::GetHardwareWatchpointHit(nub_addr_t &addr)
|
||||
{
|
||||
// Read the debug state
|
||||
kern_return_t kret = GetDBGState(false);
|
||||
kern_return_t kret = GetDBGState(true);
|
||||
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::GetHardwareWatchpointHit() GetDBGState() => 0x%8.8x.", kret);
|
||||
if (kret == KERN_SUCCESS)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue