summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBWatchpoint.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2016-11-01 20:37:02 +0000
committerJim Ingham <jingham@apple.com>2016-11-01 20:37:02 +0000
commit306b62b4aed8631b585fe0ee4f0532ca7ac53c37 (patch)
treea0c9bd0e70e25b9c50348c7eccfce87394aad218 /lldb/source/API/SBWatchpoint.cpp
parentf77a9889c08124dbf27d883100008f3b1c09962b (diff)
downloadbcm5719-llvm-306b62b4aed8631b585fe0ee4f0532ca7ac53c37.tar.gz
bcm5719-llvm-306b62b4aed8631b585fe0ee4f0532ca7ac53c37.zip
Switch SBWatchpoint::SetEnabled over to using Process::{Enable,Disable}Watchpoint.
We don't have a good story for what happens to watchpoints when you don't have a process, or if your process exits. Clearing that up will instruct how to fix this for real. Also added a test to make sure disable->enable works as well. This resolves llvm.org/pr30789. llvm-svn: 285742
Diffstat (limited to 'lldb/source/API/SBWatchpoint.cpp')
-rw-r--r--lldb/source/API/SBWatchpoint.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp
index f5d72076487..2cd48a53163 100644
--- a/lldb/source/API/SBWatchpoint.cpp
+++ b/lldb/source/API/SBWatchpoint.cpp
@@ -19,6 +19,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
@@ -126,9 +127,17 @@ size_t SBWatchpoint::GetWatchSize() {
void SBWatchpoint::SetEnabled(bool enabled) {
lldb::WatchpointSP watchpoint_sp(GetSP());
if (watchpoint_sp) {
- std::lock_guard<std::recursive_mutex> guard(
- watchpoint_sp->GetTarget().GetAPIMutex());
- watchpoint_sp->SetEnabled(enabled);
+ Target &target = watchpoint_sp->GetTarget();
+ std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex());
+ ProcessSP process_sp = target.GetProcessSP();
+ if (process_sp) {
+ if (enabled)
+ process_sp->EnableWatchpoint(watchpoint_sp.get(), false);
+ else
+ process_sp->DisableWatchpoint(watchpoint_sp.get(), false);
+ } else {
+ watchpoint_sp->SetEnabled(enabled);
+ }
}
}
OpenPOWER on IntegriCloud