[Lldb-commits] [lldb] r203724 - When clearing a breakpoint site, make sure the owning process still exists before asking it to remove the breakpoint site the rest of the way.

Jim Ingham jingham at apple.com
Wed Mar 12 15:03:14 PDT 2014


Author: jingham
Date: Wed Mar 12 17:03:13 2014
New Revision: 203724

URL: http://llvm.org/viewvc/llvm-project?rev=203724&view=rev
Log:
When clearing a breakpoint site, make sure the owning process still exists before asking it to remove the breakpoint site the rest of the way.

<rdar://problem/16303500>

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=203724&r1=203723&r2=203724&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Wed Mar 12 17:03:13 2014
@@ -257,6 +257,7 @@ public:
 
 private:
     friend class Process;
+    friend class BreakpointLocation;
 
     //------------------------------------------------------------------
     /// The method removes the owner at \a break_loc_id from this breakpoint list.

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=203724&r1=203723&r2=203724&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Wed Mar 12 17:03:13 2014
@@ -521,8 +521,15 @@ BreakpointLocation::ClearBreakpointSite
 {
     if (m_bp_site_sp.get())
     {
-        m_owner.GetTarget().GetProcessSP()->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(), 
+        ProcessSP process_sp(m_owner.GetTarget().GetProcessSP());
+        // If the process exists, get it to remove the owner, it will remove the physical implementation
+        // of the breakpoint as well if there are no more owners.  Otherwise just remove this owner.
+        if (process_sp)
+            process_sp->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(),
                                                                            GetID(), m_bp_site_sp);
+        else
+            m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
+        
         m_bp_site_sp.reset();
         return true;
     }





More information about the lldb-commits mailing list