[Lldb-commits] [lldb] r279704 - If the user has specified target.memory-module-load-level 'minimal'

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 24 19:33:10 PDT 2016


Author: jmolenda
Date: Wed Aug 24 21:33:09 2016
New Revision: 279704

URL: http://llvm.org/viewvc/llvm-project?rev=279704&view=rev
Log:
If the user has specified target.memory-module-load-level 'minimal'
and we couldn't find a dyld binary on the debug system, override
that setting and read dyld out of memory - we need to put an
internal breakpoint on dyld to register binaries being loaded or
unloaded; the debugger won't work right without dyld symbols.

<rdar://problem/27857025> 

Modified:
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=279704&r1=279703&r2=279704&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Aug 24 21:33:09 2016
@@ -2454,7 +2454,10 @@ ObjectFileMachO::ParseSymtab ()
 
                 if (!data_was_read)
                 {
-                    if (memory_module_load_level == eMemoryModuleLoadLevelComplete)
+                    // Always load dyld - the dynamic linker - from memory if we didn't find a binary anywhere else.
+                    // lldb will not register dylib/framework/bundle loads/unloads if we don't have the dyld symbols,
+                    // we force dyld to load from memory despite the user's target.memory-module-load-level setting.
+                    if (memory_module_load_level == eMemoryModuleLoadLevelComplete || m_header.filetype == llvm::MachO::MH_DYLINKER)
                     {
                         DataBufferSP nlist_data_sp (ReadMemory (process_sp, symoff_addr, nlist_data_byte_size));
                         if (nlist_data_sp)
@@ -2472,8 +2475,7 @@ ObjectFileMachO::ParseSymtab ()
                                 indirect_symbol_index_data.SetData (indirect_syms_data_sp, 0, indirect_syms_data_sp->GetByteSize());
                         }
                     }
-                    
-                    if (memory_module_load_level >= eMemoryModuleLoadLevelPartial)
+                    else if (memory_module_load_level >= eMemoryModuleLoadLevelPartial)
                     {
                         if (function_starts_load_command.cmd)
                         {




More information about the lldb-commits mailing list