If creation of watchpoint failed on the device, make sure the list maintained by the target reflects that by cleaning it up.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153477 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 6f5b007..6648d4c 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -508,8 +508,12 @@
rc.Success() ? "succeeded" : "failed",
wp_sp->GetID());
- if (rc.Fail())
+ if (rc.Fail()) {
+ // Enabling the watchpoint on the device side failed.
+ // Remove the said watchpoint from the list maintained by the target instance.
+ m_watchpoint_list.Remove(wp_sp->GetID());
wp_sp.reset();
+ }
else
m_last_created_watchpoint = wp_sp;
return wp_sp;