diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -60,7 +60,9 @@ bool ModuleIsExcludedForUnconstrainedSearches( lldb_private::Target &target, const lldb::ModuleSP &module_sp) override; - void ARMGetSupportedArchitectures(std::vector &archs); + void + ARMGetSupportedArchitectures(std::vector &archs, + llvm::Optional os = {}); void x86GetSupportedArchitectures(std::vector &archs); @@ -141,6 +143,8 @@ const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl *old_modules, bool *did_create_ptr); + virtual bool CheckLocalSharedCache() const { return IsHost(); } + struct SDKEnumeratorInfo { lldb_private::FileSpec found_path; lldb_private::XcodeSDK::Type sdk_type; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -237,7 +237,7 @@ Status err; - if (IsHost()) { + if (CheckLocalSharedCache()) { // When debugging on the host, we are most likely using the same shared // cache as our inferior. The dylibs from the shared cache might not // exist on the filesystem, so let's use the images in our own memory @@ -644,7 +644,7 @@ /// distinct names (e.g. armv7f) but armv7 binaries run fine on an armv7f /// processor. void PlatformDarwin::ARMGetSupportedArchitectures( - std::vector &archs) { + std::vector &archs, llvm::Optional os) { const ArchSpec system_arch = GetSystemArchitecture(); const ArchSpec::Core system_core = system_arch.GetCore(); @@ -654,6 +654,8 @@ llvm::Triple triple; triple.setArchName(compatible_arch); triple.setVendor(llvm::Triple::VendorType::Apple); + if (os) + triple.setOS(*os); archs.push_back(ArchSpec(triple)); } } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -137,15 +137,13 @@ std::vector result; #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) // macOS for ARM64 support both native and translated x86_64 processes - ARMGetSupportedArchitectures(result); + ARMGetSupportedArchitectures(result, llvm::Triple::MacOSX); // We can't use x86GetSupportedArchitectures() because it uses // the system architecture for some of its return values and also // has a 32bits variant. result.push_back(ArchSpec("x86_64-apple-macosx")); result.push_back(ArchSpec("x86_64-apple-ios-macabi")); - result.push_back(ArchSpec("arm64-apple-ios")); - result.push_back(ArchSpec("arm64e-apple-ios")); #else x86GetSupportedArchitectures(result); #endif diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp @@ -127,7 +127,7 @@ std::vector PlatformRemoteMacOSX::GetSupportedArchitectures() { // macOS for ARM64 support both native and translated x86_64 processes std::vector result; - ARMGetSupportedArchitectures(result); + ARMGetSupportedArchitectures(result, llvm::Triple::MacOSX); // We can't use x86GetSupportedArchitectures() because it uses // the system architecture for some of its return values and also diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -42,6 +42,8 @@ std::vector GetSupportedArchitectures() override; protected: + bool CheckLocalSharedCache() const override; + llvm::StringRef GetDeviceSupportDirectoryName() override; llvm::StringRef GetPlatformName() override; }; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -135,10 +135,17 @@ std::vector PlatformRemoteiOS::GetSupportedArchitectures() { std::vector result; - ARMGetSupportedArchitectures(result); + ARMGetSupportedArchitectures(result, llvm::Triple::IOS); return result; } +bool PlatformRemoteiOS::CheckLocalSharedCache() const { + // You can run iPhone and iPad apps on Mac with Apple Silicon. At the + // platform level there's no way to distinguish them from remote iOS + // applications. Make sure we still read from our own shared cache. + return true; +} + llvm::StringRef PlatformRemoteiOS::GetDeviceSupportDirectoryName() { return "iOS DeviceSupport"; }