diff --git a/lldb/include/lldb/Breakpoint/WatchpointLocationList.h b/lldb/include/lldb/Breakpoint/WatchpointLocationList.h index 74c8475ebd5b..7afccefa3d89 100644 --- a/lldb/include/lldb/Breakpoint/WatchpointLocationList.h +++ b/lldb/include/lldb/Breakpoint/WatchpointLocationList.h @@ -174,6 +174,9 @@ public: GetDescription (Stream *s, lldb::DescriptionLevel level); + void + ClearAllWatchpointLocations (); + //------------------------------------------------------------------ /// Sets the passed in Locker to hold the Watchpoint Location List mutex. /// diff --git a/lldb/source/Breakpoint/WatchpointLocationList.cpp b/lldb/source/Breakpoint/WatchpointLocationList.cpp index d04c7d20bb40..b6c773ff94e5 100644 --- a/lldb/source/Breakpoint/WatchpointLocationList.cpp +++ b/lldb/source/Breakpoint/WatchpointLocationList.cpp @@ -188,6 +188,16 @@ WatchpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level) } } +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) { diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 607bb90b4ccc..ca9e936b2bba 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -124,6 +124,7 @@ Target::DeleteCurrentProcess () // 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(); } }