Add a (bool)end_to_end parameter, default true, to the Target::Remove/Disable/EnableALLWatchpointLocations()
methods. If passed as false, it signifies that only the debugger side is affected.
Modify Target::DeleteCurrentProcess() to use DisableAllWatchpointLocations(false) to
disable the watchpoint locations, instead of removing them between process instances.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140418 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index 22340ab..9390c1f 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -324,14 +324,17 @@
bool
RemoveBreakpointByID (lldb::break_id_t break_id);
- bool
- RemoveAllWatchpointLocations ();
+ // The flag 'end_to_end', default to true, signifies that the operation is
+ // performed end to end, for both the debugger and the debuggee.
bool
- DisableAllWatchpointLocations ();
+ RemoveAllWatchpointLocations (bool end_to_end = true);
bool
- EnableAllWatchpointLocations ();
+ DisableAllWatchpointLocations (bool end_to_end = true);
+
+ bool
+ EnableAllWatchpointLocations (bool end_to_end = true);
bool
DisableWatchpointLocationByID (lldb::watch_id_t watch_id);
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index ebaab10..299f4ae 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -125,7 +125,8 @@
// clean up needs some help from the process.
m_breakpoint_list.ClearAllBreakpointSites();
m_internal_breakpoint_list.ClearAllBreakpointSites();
- m_watchpoint_location_list.RemoveAll();
+ // Disable watchpoint locations just on the debugger side.
+ DisableAllWatchpointLocations(false);
m_process_sp.reset();
}
}
@@ -562,14 +563,25 @@
return false;
}
-// Assumption: caller holds the list mutex lock for m_watchpoint_location_list.
+// The flag 'end_to_end', default to true, signifies that the operation is
+// performed end to end, for both the debugger and the debuggee.
+
+// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
+// for end to end operations.
bool
-Target::RemoveAllWatchpointLocations ()
+Target::RemoveAllWatchpointLocations (bool end_to_end)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
if (log)
log->Printf ("Target::%s\n", __FUNCTION__);
+ if (!end_to_end) {
+ m_watchpoint_location_list.RemoveAll();
+ return true;
+ }
+
+ // Otherwise, it's an end to end operation.
+
if (!ProcessIsValid())
return false;
@@ -588,14 +600,22 @@
return true; // Success!
}
-// Assumption: caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
+// for end to end operations.
bool
-Target::DisableAllWatchpointLocations ()
+Target::DisableAllWatchpointLocations (bool end_to_end)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
if (log)
log->Printf ("Target::%s\n", __FUNCTION__);
+ if (!end_to_end) {
+ m_watchpoint_location_list.SetEnabledAll(false);
+ return true;
+ }
+
+ // Otherwise, it's an end to end operation.
+
if (!ProcessIsValid())
return false;
@@ -613,14 +633,22 @@
return true; // Success!
}
-// Assumption: caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list
+// for end to end operations.
bool
-Target::EnableAllWatchpointLocations ()
+Target::EnableAllWatchpointLocations (bool end_to_end)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
if (log)
log->Printf ("Target::%s\n", __FUNCTION__);
+ if (!end_to_end) {
+ m_watchpoint_location_list.SetEnabledAll(true);
+ return true;
+ }
+
+ // Otherwise, it's an end to end operation.
+
if (!ProcessIsValid())
return false;
@@ -638,7 +666,7 @@
return true; // Success!
}
-// Assumption: caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
bool
Target::DisableWatchpointLocationByID (lldb::watch_id_t watch_id)
{
@@ -661,7 +689,7 @@
return false;
}
-// Assumption: caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
bool
Target::EnableWatchpointLocationByID (lldb::watch_id_t watch_id)
{
@@ -684,7 +712,7 @@
return false;
}
-// Assumption: caller holds the list mutex lock for m_watchpoint_location_list.
+// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list.
bool
Target::RemoveWatchpointLocationByID (lldb::watch_id_t watch_id)
{