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
This commit is contained in:
parent
c64623179b
commit
246a89562c
|
@ -408,9 +408,9 @@ POSIXThread::WatchNotify(const ProcessMessage &message)
|
||||||
const WatchpointList &wp_list = target.GetWatchpointList();
|
const WatchpointList &wp_list = target.GetWatchpointList();
|
||||||
lldb::WatchpointSP wp_sp = wp_list.FindByAddress(wp_monitor_addr);
|
lldb::WatchpointSP wp_sp = wp_list.FindByAddress(wp_monitor_addr);
|
||||||
|
|
||||||
if (wp_sp)
|
assert(wp_sp.get() && "No watchpoint found");
|
||||||
SetStopInfo (StopInfo::CreateStopReasonWithWatchpointID(*this,
|
SetStopInfo (StopInfo::CreateStopReasonWithWatchpointID(*this,
|
||||||
wp_sp->GetID()));
|
wp_sp->GetID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1244,6 +1244,15 @@ RegisterContext_x86_64::IsWatchpointVacant(uint32_t hw_index)
|
||||||
|
|
||||||
assert(hw_index < NumSupportedHardwareWatchpoints());
|
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))
|
if (ReadRegister(dr7, value))
|
||||||
{
|
{
|
||||||
uint64_t val = value.GetAsUInt64();
|
uint64_t val = value.GetAsUInt64();
|
||||||
|
@ -1313,15 +1322,6 @@ RegisterContext_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,
|
||||||
if (read == false && write == false)
|
if (read == false && write == false)
|
||||||
return 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))
|
if (!IsWatchpointVacant(hw_index))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1392,6 +1392,15 @@ RegisterContext_x86_64::IsWatchpointHit(uint32_t hw_index)
|
||||||
{
|
{
|
||||||
bool is_hit = false;
|
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())
|
if (hw_index < NumSupportedHardwareWatchpoints())
|
||||||
{
|
{
|
||||||
RegisterValue value;
|
RegisterValue value;
|
||||||
|
|
Loading…
Reference in New Issue