Index: lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp =================================================================== --- lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -732,12 +732,14 @@ ModuleSpec module_spec(process_info.GetExecutableFile(), process_info.GetArchitecture()); + if (module_sp && module_sp->MatchesModuleSpec(module_spec)) return; + lldb::ModuleSP executable_module_sp; const auto executable_search_paths(Target::GetDefaultExecutableSearchPaths()); auto error = platform_sp->ResolveExecutable( - module_spec, module_sp, + module_spec, executable_module_sp, !executable_search_paths.IsEmpty() ? &executable_search_paths : nullptr); if (error.Fail()) { StreamString stream; @@ -750,7 +752,9 @@ return; } - target.SetExecutableModule(module_sp, eLoadDependentsNo); + if (!module_sp || !module_sp->GetUUID().IsValid() || + module_sp->GetUUID() != executable_module_sp->GetUUID()) + target.SetExecutableModule(executable_module_sp, eLoadDependentsNo); } bool DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo( Index: lldb/source/Target/TargetList.cpp =================================================================== --- lldb/source/Target/TargetList.cpp +++ lldb/source/Target/TargetList.cpp @@ -398,6 +398,8 @@ if (user_exe_path_is_bundle) exe_module_sp->GetFileSpec().GetPath(resolved_bundle_exe_path, sizeof(resolved_bundle_exe_path)); + if (target_sp->GetPreloadSymbols()) + exe_module_sp->PreloadSymbols(); } } else { // No file was specified, just create an empty target with any arch if a