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,8 @@ return; } - target.SetExecutableModule(module_sp, eLoadDependentsNo); + if (!module_sp || module_sp.get() != executable_module_sp.get()) + target.SetExecutableModule(executable_module_sp, eLoadDependentsNo); } bool DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo( Index: lldb/source/Target/Platform.cpp =================================================================== --- lldb/source/Target/Platform.cpp +++ lldb/source/Target/Platform.cpp @@ -1516,6 +1516,7 @@ if (error.Success()) { module_spec.GetFileSpec() = module_sp->GetFileSpec(); module_spec.GetPlatformFileSpec() = platform_spec; + module_spec.GetUUID() = module_sp->GetUUID(); } return error; 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