[Lldb-commits] [lldb] 27893ff - Call WatchpointList::RemoveAll in Target::Destroy.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 27 15:15:16 PDT 2022


Author: Jim Ingham
Date: 2022-07-27T15:15:05-07:00
New Revision: 27893ff1ad750d9828ca3a774ba9f0029c16149f

URL: https://github.com/llvm/llvm-project/commit/27893ff1ad750d9828ca3a774ba9f0029c16149f
DIFF: https://github.com/llvm/llvm-project/commit/27893ff1ad750d9828ca3a774ba9f0029c16149f.diff

LOG: Call WatchpointList::RemoveAll in Target::Destroy.

I noticed that the test TestSetWatchpoint.py was failing every so often
on macOS.  The failure was in the last assert, that after destroying the
SBTarget containing it, the SBWatchpoint was still saying it was valid.

IsValid in this case just meant the watchpoint weak pointer could be turned
into a shared pointer.  The watchpoint shared pointers have two strong references
in general, one to the "Target::m_last_created_watchpoint", and one in the
Target::m_watchpoint_list.  Target::Destroy reset the last created watchpoint
but neglected to call RemoveAll on the watchpoint list (it does the analogous
work for the internal & external breakpoint lists...)  This patch does the
equivalent cleanup for the watchpoint list.

Added: 
    

Modified: 
    lldb/source/Target/Target.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index f16fc6b5da85f..ab6f231772c1f 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -284,6 +284,7 @@ void Target::Destroy() {
   m_breakpoint_list.RemoveAll(notify);
   m_internal_breakpoint_list.RemoveAll(notify);
   m_last_created_breakpoint.reset();
+  m_watchpoint_list.RemoveAll(notify);
   m_last_created_watchpoint.reset();
   m_search_filter_sp.reset();
   m_image_search_paths.Clear(notify);


        


More information about the lldb-commits mailing list