Implement setting and clearing watchpoints.

llvm-svn: 227930
diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp
index 9c29f32..4c770a2 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -39,6 +39,7 @@
     m_delegates_mutex (Mutex::eMutexTypeRecursive),
     m_delegates (),
     m_breakpoint_list (),
+    m_watchpoint_list (),
     m_terminal_fd (-1),
     m_stop_id (0)
 {
@@ -159,6 +160,12 @@
     return true;
 }
 
+const NativeWatchpointList::WatchpointMap&
+NativeProcessProtocol::GetWatchpointMap () const
+{
+    return m_watchpoint_list.GetWatchpointMap();
+}
+
 uint32_t
 NativeProcessProtocol::GetMaxWatchpoints () const
 {
@@ -199,9 +206,6 @@
 
     Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
-    // FIXME save the watchpoint on the set of process watchpoint vars
-    // so we can add them to a thread each time a new thread is registered.
-
     // Update the thread list
     UpdateThreads ();
 
@@ -261,15 +265,12 @@
             return thread_error;
         }
     }
-    return Error ();
+    return m_watchpoint_list.Add (addr, size, watch_flags, hardware);
 }
 
 Error
 NativeProcessProtocol::RemoveWatchpoint (lldb::addr_t addr)
 {
-    // FIXME remove the watchpoint on the set of process watchpoint vars
-    // so we can add them to a thread each time a new thread is registered.
-
     // Update the thread list
     UpdateThreads ();
 
@@ -292,7 +293,8 @@
                 overall_error = thread_error;
         }
     }
-    return overall_error;
+    const Error error = m_watchpoint_list.Remove(addr);
+    return overall_error.Fail() ? overall_error : error;
 }
 
 bool