summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
diff options
context:
space:
mode:
authorEd Maste <emaste@freebsd.org>2014-02-19 18:34:06 +0000
committerEd Maste <emaste@freebsd.org>2014-02-19 18:34:06 +0000
commita4be2c5dcd6d488e7c7d2e638759c3cd2b50da2a (patch)
tree956d07d7590ab180725cc1c24281ff937bbf99a1 /lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
parent01fd1c60cd909ce4313217532ca40db2cf99886b (diff)
downloadbcm5719-llvm-a4be2c5dcd6d488e7c7d2e638759c3cd2b50da2a.tar.gz
bcm5719-llvm-a4be2c5dcd6d488e7c7d2e638759c3cd2b50da2a.zip
FreeBSD hardware watchpoint implementation
Implement x86_64 debug register read/write in support of hardware watchpoints. Hoist LinuxThread::TraceNotify code back into POSIXThread::TraceNotify() Patch by John Wolfe. We still need to rework this later to avoid the #ifdef FreeBSD. llvm-reviews.chandlerc.com/D2572 llvm.org/pr16706 llvm-svn: 201706
Diffstat (limited to 'lldb/source/Plugins/Process/POSIX/POSIXThread.cpp')
-rw-r--r--lldb/source/Plugins/Process/POSIX/POSIXThread.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
index 8d4c71ff269..cc759eaad96 100644
--- a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
+++ b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
@@ -65,7 +65,16 @@ POSIXThread::POSIXThread(Process &process, lldb::tid_t tid)
lldb::WatchpointSP wp = wp_list.GetByIndex(wp_idx);
if (wp.get() && wp->IsEnabled())
{
- assert(EnableHardwareWatchpoint(wp.get()));
+ // This watchpoint as been enabled; obviously this "new" thread
+ // has been created since that watchpoint was enabled. Since
+ // the POSIXBreakpointProtocol has yet to be initialized, its
+ // m_watchpoints_initialized member will be FALSE. Attempting to
+ // read the debug status register to determine if a watchpoint
+ // has been hit would result in the zeroing of that register.
+ // Since the active debug registers would have been cloned when
+ // this thread was created, simply force the m_watchpoints_initized
+ // member to TRUE and avoid resetting dr6 and dr7.
+ GetPOSIXBreakpointProtocol()->ForceWatchpointsInitialized();
}
}
}
@@ -509,6 +518,21 @@ POSIXThread::WatchNotify(const ProcessMessage &message)
void
POSIXThread::TraceNotify(const ProcessMessage &message)
{
+ POSIXBreakpointProtocol* reg_ctx = GetPOSIXBreakpointProtocol();
+ if (reg_ctx)
+ {
+ uint32_t num_hw_wps = reg_ctx->NumSupportedHardwareWatchpoints();
+ uint32_t wp_idx;
+ for (wp_idx = 0; wp_idx < num_hw_wps; wp_idx++)
+ {
+ if (reg_ctx->IsWatchpointHit(wp_idx))
+ {
+ WatchNotify(message);
+ return;
+ }
+ }
+ }
+
SetStopInfo (StopInfo::CreateStopReasonToTrace(*this));
}
OpenPOWER on IntegriCloud