[Lldb-commits] [lldb] r184246 - Add assertion for when no watchpoint found in POSIX watchnotify handler.
Matt Kopec
Matt.Kopec at intel.com
Tue Jun 18 14:58:02 PDT 2013
Author: mkopec
Date: Tue Jun 18 16:58:02 2013
New Revision: 184246
URL: http://llvm.org/viewvc/llvm-project?rev=184246&view=rev
Log:
Add assertion for when no watchpoint found in POSIX watchnotify handler.
Also, ensure x86_64 watchpoint registers are initialized before they are accessed on the POSIX side.
Modified:
lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=184246&r1=184245&r2=184246&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Tue Jun 18 16:58:02 2013
@@ -408,9 +408,9 @@ POSIXThread::WatchNotify(const ProcessMe
const WatchpointList &wp_list = target.GetWatchpointList();
lldb::WatchpointSP wp_sp = wp_list.FindByAddress(wp_monitor_addr);
- if (wp_sp)
- SetStopInfo (StopInfo::CreateStopReasonWithWatchpointID(*this,
- wp_sp->GetID()));
+ assert(wp_sp.get() && "No watchpoint found");
+ SetStopInfo (StopInfo::CreateStopReasonWithWatchpointID(*this,
+ wp_sp->GetID()));
}
}
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp?rev=184246&r1=184245&r2=184246&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp Tue Jun 18 16:58:02 2013
@@ -1244,6 +1244,15 @@ RegisterContext_x86_64::IsWatchpointVaca
assert(hw_index < NumSupportedHardwareWatchpoints());
+ if (m_watchpoints_initialized == false)
+ {
+ // Reset the debug status and debug control registers
+ RegisterValue zero_bits = RegisterValue(uint64_t(0));
+ if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
+ assert(false && "Could not initialize watchpoint registers");
+ m_watchpoints_initialized = true;
+ }
+
if (ReadRegister(dr7, value))
{
uint64_t val = value.GetAsUInt64();
@@ -1313,15 +1322,6 @@ RegisterContext_x86_64::SetHardwareWatch
if (read == false && write == false)
return false;
- if (m_watchpoints_initialized == false)
- {
- // Reset the debug status and debug control registers
- RegisterValue zero_bits = RegisterValue(uint64_t(0));
- if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
- return false;
- m_watchpoints_initialized = true;
- }
-
if (!IsWatchpointVacant(hw_index))
return false;
@@ -1392,6 +1392,15 @@ RegisterContext_x86_64::IsWatchpointHit(
{
bool is_hit = false;
+ if (m_watchpoints_initialized == false)
+ {
+ // Reset the debug status and debug control registers
+ RegisterValue zero_bits = RegisterValue(uint64_t(0));
+ if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
+ assert(false && "Could not initialize watchpoint registers");
+ m_watchpoints_initialized = true;
+ }
+
if (hw_index < NumSupportedHardwareWatchpoints())
{
RegisterValue value;
More information about the lldb-commits
mailing list