[Lldb-commits] [lldb] r237866 - Fix the logic in DynamicLoaderMacOSXDYLD::Clear that would only remove the old dyld notification

Jim Ingham jingham at apple.com
Wed May 20 17:27:01 PDT 2015


Author: jingham
Date: Wed May 20 19:27:01 2015
New Revision: 237866

URL: http://llvm.org/viewvc/llvm-project?rev=237866&view=rev
Log:
Fix the logic in DynamicLoaderMacOSXDYLD::Clear that would only remove the old dyld notification        
breakpoint only  if the process it was for is still alive.  We need to always remove this because
it has a pointer to the old loader, and    if we ever hit it we will crash.  I also put in a sanity
check in the callback function to make sure we don't invoke it if the process is wrong.

<rdar://problem/21006189>

Modified:
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=237866&r1=237865&r2=237866&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Wed May 20 19:27:01 2015
@@ -242,7 +242,7 @@ DynamicLoaderMacOSXDYLD::Clear (bool cle
 {
     Mutex::Locker locker(m_mutex);
 
-    if (m_process->IsAlive() && LLDB_BREAK_ID_IS_VALID(m_break_id))
+    if (LLDB_BREAK_ID_IS_VALID(m_break_id))
         m_process->GetTarget().RemoveBreakpointByID (m_break_id);
 
     if (clear_process)
@@ -607,11 +607,16 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpoin
     // will do so and return true.  In the course of initializing the all_image_infos it will read the complete
     // current state, so we don't need to figure out what has changed from the data passed in to us.
     
+    ExecutionContext exe_ctx (context->exe_ctx_ref);
+    Process *process = exe_ctx.GetProcessPtr();
+
+    // This is a sanity check just in case this dyld_instance is an old dyld plugin's breakpoint still lying around.
+    if (process != dyld_instance->m_process)
+        return false;
+
     if (dyld_instance->InitializeFromAllImageInfos())
         return dyld_instance->GetStopWhenImagesChange(); 
 
-    ExecutionContext exe_ctx (context->exe_ctx_ref);
-    Process *process = exe_ctx.GetProcessPtr();
     const lldb::ABISP &abi = process->GetABI();
     if (abi)
     {





More information about the lldb-commits mailing list