summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/StopInfo.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-09-21 22:47:15 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-09-21 22:47:15 +0000
commitfd158f411acdbee1b74bde9449bc2041fa323d58 (patch)
tree37f011edbec73f02d602e4e8bb996ea4cfae42ee /lldb/source/Target/StopInfo.cpp
parent8a529dc10aac301fde365a6ca3562a80f6e4c1d0 (diff)
downloadbcm5719-llvm-fd158f411acdbee1b74bde9449bc2041fa323d58.tar.gz
bcm5719-llvm-fd158f411acdbee1b74bde9449bc2041fa323d58.zip
StopInfoWatchpoint should override the StopInfo::ShouldStop() virtual method and delegate to
the WatchpointLocation object to check whether it should stop and allow it to update the hit count, among other bookkeepings. llvm-svn: 140279
Diffstat (limited to 'lldb/source/Target/StopInfo.cpp')
-rw-r--r--lldb/source/Target/StopInfo.cpp44
1 files changed, 40 insertions, 4 deletions
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index c0daf8a1fcf..8978f73a0fe 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -324,8 +324,10 @@ class StopInfoWatchpoint : public StopInfo
public:
StopInfoWatchpoint (Thread &thread, break_id_t watch_id) :
- StopInfo (thread, watch_id),
- m_description()
+ StopInfo(thread, watch_id),
+ m_description(),
+ m_should_stop(false),
+ m_should_stop_is_valid(false)
{
}
@@ -339,6 +341,40 @@ public:
return eStopReasonWatchpoint;
}
+ virtual bool
+ ShouldStop (Event *event_ptr)
+ {
+ // ShouldStop() method is idempotent and should not affect hit count.
+ if (m_should_stop_is_valid)
+ return m_should_stop;
+
+ WatchpointLocationSP wp_loc_sp =
+ m_thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByID(GetValue());
+ if (wp_loc_sp)
+ {
+ // Check if we should stop at a watchpoint.
+ StoppointCallbackContext context (event_ptr,
+ &m_thread.GetProcess(),
+ &m_thread,
+ m_thread.GetStackFrameAtIndex(0).get(),
+ true);
+
+ m_should_stop = wp_loc_sp->ShouldStop (&context);
+ }
+ else
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+
+ if (log)
+ log->Printf ("Process::%s could not find watchpoint location id: %lld...",
+ __FUNCTION__, GetValue());
+
+ m_should_stop = true;
+ }
+ m_should_stop_is_valid = true;
+ return m_should_stop;
+ }
+
virtual const char *
GetDescription ()
{
@@ -351,10 +387,10 @@ public:
return m_description.c_str();
}
-
-
private:
std::string m_description;
+ bool m_should_stop;
+ bool m_should_stop_is_valid;
};
OpenPOWER on IntegriCloud