summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-05-31 23:02:30 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-05-31 23:02:30 +0000
commite48fb7d7323d70d000e262bbe5b0174839ab0bdc (patch)
treee041f19ddf3139ed66566d873e8ab84c3f5a313b
parent288e86ff6b6f2ba35ab9efb9584b572b84b61b35 (diff)
downloadbcm5719-llvm-e48fb7d7323d70d000e262bbe5b0174839ab0bdc.tar.gz
bcm5719-llvm-e48fb7d7323d70d000e262bbe5b0174839ab0bdc.zip
For hardware watchpoint enable/disable, in case the kernel call to set the revised debug state fails, we need to recover the local cache to the previous known state.
llvm-svn: 157778
-rw-r--r--lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp8
-rw-r--r--lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp6
2 files changed, 13 insertions, 1 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
index 37571b987aa..3962b9b6c5d 100644
--- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
@@ -842,6 +842,7 @@ DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, boo
uint32_t i = 0;
DBG &debug_state = m_state.context.dbg;
+ DBG dsCheckPoint = m_state.context.dbg;
for (i = 0; i < num_hw_watchpoints; ++i)
{
if (IsWatchpointVacant(debug_state, i))
@@ -859,6 +860,8 @@ DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, boo
if (kret == KERN_SUCCESS)
return i;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
else
{
@@ -877,6 +880,7 @@ DNBArchImplI386::DisableHardwareWatchpoint (uint32_t hw_index)
if (kret == KERN_SUCCESS)
{
DBG &debug_state = m_state.context.dbg;
+ DBG dsCheckPoint = m_state.context.dbg;
if (hw_index < num_hw_points && !IsWatchpointVacant(debug_state, hw_index))
{
// Modify our local copy of the debug state, first.
@@ -888,6 +892,8 @@ DNBArchImplI386::DisableHardwareWatchpoint (uint32_t hw_index)
if (kret == KERN_SUCCESS)
return true;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
}
return false;
@@ -911,7 +917,7 @@ uint32_t
DNBArchImplI386::GetHardwareWatchpointHit(nub_addr_t &addr)
{
// Read the debug state
- kern_return_t kret = GetDBGState(false);
+ kern_return_t kret = GetDBGState(true);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::GetHardwareWatchpointHit() GetDBGState() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
{
diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
index 754b6ef480d..94aa9a18664 100644
--- a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
@@ -819,6 +819,7 @@ DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, b
uint32_t i = 0;
DBG &debug_state = m_state.context.dbg;
+ DBG dsCheckPoint = m_state.context.dbg;
for (i = 0; i < num_hw_watchpoints; ++i)
{
if (IsWatchpointVacant(debug_state, i))
@@ -836,6 +837,8 @@ DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, b
if (kret == KERN_SUCCESS)
return i;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
else
{
@@ -854,6 +857,7 @@ DNBArchImplX86_64::DisableHardwareWatchpoint (uint32_t hw_index)
if (kret == KERN_SUCCESS)
{
DBG &debug_state = m_state.context.dbg;
+ DBG dsCheckPoint = m_state.context.dbg;
if (hw_index < num_hw_points && !IsWatchpointVacant(debug_state, hw_index))
{
// Modify our local copy of the debug state, first.
@@ -865,6 +869,8 @@ DNBArchImplX86_64::DisableHardwareWatchpoint (uint32_t hw_index)
if (kret == KERN_SUCCESS)
return true;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
}
return false;
OpenPOWER on IntegriCloud