This revision was automatically updated to reflect the committed changes. Closed by commit rGcd2ba23efb3e: PlatformMacOSX should be activated for lldb built to run on an iOS etc device (authored by jasonmolenda).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120517/new/ https://reviews.llvm.org/D120517 Files: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -137,15 +137,21 @@ std::vector<ArchSpec> result; #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) // macOS for ARM64 support both native and translated x86_64 processes - 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-macabi")); - result.push_back(ArchSpec("arm64e-apple-ios-macabi")); + // When cmdline lldb is run on iOS, watchOS, etc, it is still + // using "PlatformMacOSX". + llvm::Triple::OSType host_os = GetHostOSType(); + ARMGetSupportedArchitectures(result, host_os); + + if (host_os == 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-macabi")); + result.push_back(ArchSpec("arm64e-apple-ios-macabi")); + } #else x86GetSupportedArchitectures(result); result.push_back(ArchSpec("x86_64-apple-ios-macabi")); Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -174,6 +174,9 @@ static std::string FindComponentInPath(llvm::StringRef path, llvm::StringRef component); + // The OSType where lldb is running. + static llvm::Triple::OSType GetHostOSType(); + std::string m_developer_directory; llvm::StringMap<std::string> m_sdk_path; std::mutex m_sdk_path_mutex; Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1328,3 +1328,23 @@ return FileSpec(FindComponentInPath(fspec.GetPath(), "CommandLineTools")); return {}; } + +llvm::Triple::OSType PlatformDarwin::GetHostOSType() { +#if !defined(__APPLE__) + return llvm::Triple::MacOSX; +#else +#if TARGET_OS_OSX + return llvm::Triple::MacOSX; +#elif TARGET_OS_IOS + return llvm::Triple::IOS; +#elif TARGET_OS_WATCH + return llvm::Triple::WatchOS; +#elif TARGET_OS_TV + return llvm::Triple::TvOS; +#elif TARGET_OS_BRIDGE + return llvm::Triple::BridgeOS; +#else +#error "LLDB being compiled for an unrecognized Darwin OS" +#endif +#endif // __APPLE__ +}
Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -137,15 +137,21 @@ std::vector<ArchSpec> result; #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) // macOS for ARM64 support both native and translated x86_64 processes - 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-macabi")); - result.push_back(ArchSpec("arm64e-apple-ios-macabi")); + // When cmdline lldb is run on iOS, watchOS, etc, it is still + // using "PlatformMacOSX". + llvm::Triple::OSType host_os = GetHostOSType(); + ARMGetSupportedArchitectures(result, host_os); + + if (host_os == 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-macabi")); + result.push_back(ArchSpec("arm64e-apple-ios-macabi")); + } #else x86GetSupportedArchitectures(result); result.push_back(ArchSpec("x86_64-apple-ios-macabi")); Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -174,6 +174,9 @@ static std::string FindComponentInPath(llvm::StringRef path, llvm::StringRef component); + // The OSType where lldb is running. + static llvm::Triple::OSType GetHostOSType(); + std::string m_developer_directory; llvm::StringMap<std::string> m_sdk_path; std::mutex m_sdk_path_mutex; Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1328,3 +1328,23 @@ return FileSpec(FindComponentInPath(fspec.GetPath(), "CommandLineTools")); return {}; } + +llvm::Triple::OSType PlatformDarwin::GetHostOSType() { +#if !defined(__APPLE__) + return llvm::Triple::MacOSX; +#else +#if TARGET_OS_OSX + return llvm::Triple::MacOSX; +#elif TARGET_OS_IOS + return llvm::Triple::IOS; +#elif TARGET_OS_WATCH + return llvm::Triple::WatchOS; +#elif TARGET_OS_TV + return llvm::Triple::TvOS; +#elif TARGET_OS_BRIDGE + return llvm::Triple::BridgeOS; +#else +#error "LLDB being compiled for an unrecognized Darwin OS" +#endif +#endif // __APPLE__ +}
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits