[Lldb-commits] [lldb] r140418 - in /lldb/trunk: include/lldb/Target/Target.h source/Target/Target.cpp

Johnny Chen johnny.chen at apple.com
Fri Sep 23 14:21:43 PDT 2011


Author: johnny
Date: Fri Sep 23 16:21:43 2011
New Revision: 140418

URL: http://llvm.org/viewvc/llvm-project?rev=140418&view=rev
Log:
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.

Modified:
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=140418&r1=140417&r2=140418&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Fri Sep 23 16:21:43 2011
@@ -324,14 +324,17 @@
     bool
     RemoveBreakpointByID (lldb::break_id_t break_id);
 
+    // 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
-    RemoveAllWatchpointLocations ();
+    RemoveAllWatchpointLocations (bool end_to_end = true);
 
     bool
-    DisableAllWatchpointLocations ();
+    DisableAllWatchpointLocations (bool end_to_end = true);
 
     bool
-    EnableAllWatchpointLocations ();
+    EnableAllWatchpointLocations (bool end_to_end = true);
 
     bool
     DisableWatchpointLocationByID (lldb::watch_id_t watch_id);

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=140418&r1=140417&r2=140418&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Sep 23 16:21:43 2011
@@ -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)
 {





More information about the lldb-commits mailing list