Add cleanup of watchpoint locations during Target::DeleteCurrentProcess().
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139840 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/lldb/Breakpoint/WatchpointLocationList.h b/include/lldb/Breakpoint/WatchpointLocationList.h
index 74c8475..7afccef 100644
--- a/include/lldb/Breakpoint/WatchpointLocationList.h
+++ b/include/lldb/Breakpoint/WatchpointLocationList.h
@@ -174,6 +174,9 @@
GetDescription (Stream *s,
lldb::DescriptionLevel level);
+ void
+ ClearAllWatchpointLocations ();
+
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Watchpoint Location List mutex.
///
diff --git a/source/Breakpoint/WatchpointLocationList.cpp b/source/Breakpoint/WatchpointLocationList.cpp
index d04c7d2..b6c773f 100644
--- a/source/Breakpoint/WatchpointLocationList.cpp
+++ b/source/Breakpoint/WatchpointLocationList.cpp
@@ -189,6 +189,16 @@
}
void
+WatchpointLocationList::ClearAllWatchpointLocations ()
+{
+ Mutex::Locker locker(m_mutex);
+ addr_map::iterator pos, end = m_address_to_location.end();
+
+ for (pos = m_address_to_location.begin(); pos != end; ++pos)
+ m_address_to_location.erase(pos);
+}
+
+void
WatchpointLocationList::GetListMutex (Mutex::Locker &locker)
{
return locker.Reset (m_mutex.GetMutex());
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 607bb90..ca9e936 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -124,6 +124,7 @@
// clean up needs some help from the process.
m_breakpoint_list.ClearAllBreakpointSites();
m_internal_breakpoint_list.ClearAllBreakpointSites();
+ m_watchpoint_location_list.ClearAllWatchpointLocations();
m_process_sp.reset();
}
}