[Lldb-commits] [lldb] r157778 - in /lldb/trunk/tools/debugserver/source/MacOSX: i386/DNBArchImplI386.cpp x86_64/DNBArchImplX86_64.cpp
Johnny Chen
johnny.chen at apple.com
Thu May 31 16:02:30 PDT 2012
Author: johnny
Date: Thu May 31 18:02:30 2012
New Revision: 157778
URL: http://llvm.org/viewvc/llvm-project?rev=157778&view=rev
Log:
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.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=157778&r1=157777&r2=157778&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Thu May 31 18:02:30 2012
@@ -842,6 +842,7 @@
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 @@
if (kret == KERN_SUCCESS)
return i;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
else
{
@@ -877,6 +880,7 @@
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 @@
if (kret == KERN_SUCCESS)
return true;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
}
return false;
@@ -911,7 +917,7 @@
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)
{
Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=157778&r1=157777&r2=157778&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Thu May 31 18:02:30 2012
@@ -819,6 +819,7 @@
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 @@
if (kret == KERN_SUCCESS)
return i;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
else
{
@@ -854,6 +857,7 @@
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 @@
if (kret == KERN_SUCCESS)
return true;
+ else // Recovery block.
+ m_state.context.dbg = dsCheckPoint;
}
}
return false;
More information about the lldb-commits
mailing list