Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -143,7 +143,7 @@ const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl *old_modules, bool *did_create_ptr); - virtual bool CheckLocalSharedCache() const { return IsHost(); } + bool CheckLocalSharedCache() const { return IsHost(); } struct SDKEnumeratorInfo { lldb_private::FileSpec found_path; Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -151,6 +151,8 @@ result.push_back(ArchSpec("x86_64-apple-ios-macabi")); result.push_back(ArchSpec("arm64-apple-ios-macabi")); result.push_back(ArchSpec("arm64e-apple-ios-macabi")); + result.push_back(ArchSpec("arm64-apple-ios")); + result.push_back(ArchSpec("arm64e-apple-ios")); } #else x86GetSupportedArchitectures(result); Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -42,8 +42,6 @@ std::vector GetSupportedArchitectures() override; protected: - bool CheckLocalSharedCache() const override; - llvm::StringRef GetDeviceSupportDirectoryName() override; llvm::StringRef GetPlatformName() override; }; Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -140,13 +140,6 @@ 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"; } Index: lldb/source/Target/Process.cpp =================================================================== --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -72,6 +72,10 @@ #include "lldb/Utility/State.h" #include "lldb/Utility/Timer.h" +#if defined(__APPLE__) +#include +#endif + using namespace lldb; using namespace lldb_private; using namespace std::chrono; @@ -2922,6 +2926,30 @@ } } +#if TARGET_OS_OSX +#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) + // On Apple Silicon the host platform is compatible with arm64(e)-apple-ios + // to support unmodified "iPhone and iPad Apps on Apple Silicon Macs". + // + // Because the binaries are identical and platform selection relies on the + // triple, there's no way to differentiate the two statically. Once we have a + // process, we can use its system architecture to tell the two apart and + // change the platform if necessary. + if (platform_sp->GetPluginName() == "host") { + llvm::Triple target_triple = GetTarget().GetArchitecture().GetTriple(); + if (target_triple.getOS() == llvm::Triple::IOS && + target_triple.getVendor() == llvm::Triple::Apple) { + llvm::Triple system_triple = GetSystemArchitecture().GetTriple(); + if (system_triple.getOS() == llvm::Triple::IOS) { + Status error; + GetTarget().SetPlatform( + Platform::Create(ConstString("remote-ios"), error)); + } + } + } +#endif +#endif + // We have completed the attach, now it is time to find the dynamic loader // plug-in DynamicLoader *dyld = GetDynamicLoader();