[Lldb-commits] [lldb] r228910 - Search through all memory regions of the core file for

Jason Molenda jmolenda at apple.com
Wed Feb 11 22:14:23 PST 2015

Author: jmolenda
Date: Thu Feb 12 00:14:23 2015
New Revision: 228910

URL: http://llvm.org/viewvc/llvm-project?rev=228910&view=rev
Search through all memory regions of the core file for
both a user process dyld and for a kernel binary -- we
will decide which to prefer after one or both have been

It would be faster to stop the search thorugh the core
segments one we've found a dyld/kernel binary - but that
may trick us into missing the one we would prefer.



Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=228910&r1=228909&r2=228910&view=diff
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Thu Feb 12 00:14:23 2015
@@ -311,10 +311,14 @@ ProcessMachCore::DoLoadCore ()
         // We need to locate the main executable in the memory ranges
         // we have in the core file.  We need to search for both a user-process dyld binary
         // and a kernel binary in memory; we must look at all the pages in the binary so
-        // we don't miss one or the other.  If we find a user-process dyld binary, stop
-        // searching -- that's the one we'll prefer over the mach kernel.
+        // we don't miss one or the other.  Step through all memory segments searching for
+        // a kernel binary and for a user process dyld -- we'll decide which to prefer 
+        // later if both are present.
         const size_t num_core_aranges = m_core_aranges.GetSize();
-        for (size_t i=0; i<num_core_aranges && m_dyld_addr == LLDB_INVALID_ADDRESS; ++i)
+        for (size_t i = 0; 
+             i < num_core_aranges && (m_dyld_addr == LLDB_INVALID_ADDRESS || m_mach_kernel_addr == LLDB_INVALID_ADDRESS); 
+             ++i)
             const VMRangeToFileOffset::Entry *entry = m_core_aranges.GetEntryAtIndex(i);
             lldb::addr_t section_vm_addr_start = entry->GetRangeBase();

More information about the lldb-commits mailing list