summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Kopec <Matt.Kopec@intel.com>2013-06-18 21:58:02 +0000
committerMatt Kopec <Matt.Kopec@intel.com>2013-06-18 21:58:02 +0000
commit246a89562cca44deb2a81ea2bc5b7d4e1d0ab9b6 (patch)
tree26878c8aab71ace26080d6bbc6d53c38b7148e57
parentc64623179b7911e3ce932d91b6a89508a1379b75 (diff)
downloadbcm5719-llvm-246a89562cca44deb2a81ea2bc5b7d4e1d0ab9b6.tar.gz
bcm5719-llvm-246a89562cca44deb2a81ea2bc5b7d4e1d0ab9b6.zip
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. llvm-svn: 184246
-rw-r--r--lldb/source/Plugins/Process/POSIX/POSIXThread.cpp6
-rw-r--r--lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp27
2 files changed, 21 insertions, 12 deletions
diff --git a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
index 7da19d7a505..d3e98bbc6b0 100644
--- a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
+++ b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
@@ -408,9 +408,9 @@ POSIXThread::WatchNotify(const ProcessMessage &message)
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()));
}
}
diff --git a/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp b/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
index 03bccd2cbf6..cd0056462fe 100644
--- a/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
+++ b/lldb/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
@@ -1244,6 +1244,15 @@ RegisterContext_x86_64::IsWatchpointVacant(uint32_t hw_index)
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::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,
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(uint32_t hw_index)
{
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;
OpenPOWER on IntegriCloud