[lldb] Upstream xros support in lldb (#78389)
Upstream support for debugging xros applications through LLDB.
This commit is contained in:
parent
d525e2b31b
commit
3b6a8f823b
@ -34,6 +34,8 @@ public:
|
||||
AppleTVOS,
|
||||
WatchSimulator,
|
||||
watchOS,
|
||||
XRSimulator,
|
||||
XROS,
|
||||
bridgeOS,
|
||||
Linux,
|
||||
unknown = -1
|
||||
|
@ -276,6 +276,9 @@ void HostInfoMacOSX::ComputeHostArchitectureSupport(ArchSpec &arch_32,
|
||||
#elif defined(TARGET_OS_WATCHOS) && TARGET_OS_WATCHOS == 1
|
||||
arch_32.GetTriple().setOS(llvm::Triple::WatchOS);
|
||||
arch_64.GetTriple().setOS(llvm::Triple::WatchOS);
|
||||
#elif defined(TARGET_OS_XR) && TARGET_OS_XR == 1
|
||||
arch_32.GetTriple().setOS(llvm::Triple::XROS);
|
||||
arch_64.GetTriple().setOS(llvm::Triple::XROS);
|
||||
#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
|
||||
arch_32.GetTriple().setOS(llvm::Triple::MacOSX);
|
||||
arch_64.GetTriple().setOS(llvm::Triple::MacOSX);
|
||||
|
@ -166,6 +166,7 @@ DynamicLoader *DynamicLoaderDarwinKernel::CreateInstance(Process *process,
|
||||
case llvm::Triple::IOS:
|
||||
case llvm::Triple::TvOS:
|
||||
case llvm::Triple::WatchOS:
|
||||
case llvm::Triple::XROS:
|
||||
// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
|
||||
if (triple_ref.getVendor() != llvm::Triple::Apple) {
|
||||
return nullptr;
|
||||
|
@ -55,6 +55,7 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process,
|
||||
case llvm::Triple::IOS:
|
||||
case llvm::Triple::TvOS:
|
||||
case llvm::Triple::WatchOS:
|
||||
case llvm::Triple::XROS:
|
||||
// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
|
||||
create = triple_ref.getVendor() == llvm::Triple::Apple;
|
||||
break;
|
||||
|
@ -75,6 +75,7 @@ DynamicLoader *DynamicLoaderMacOSXDYLD::CreateInstance(Process *process,
|
||||
case llvm::Triple::IOS:
|
||||
case llvm::Triple::TvOS:
|
||||
case llvm::Triple::WatchOS:
|
||||
case llvm::Triple::XROS:
|
||||
// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
|
||||
create = triple_ref.getVendor() == llvm::Triple::Apple;
|
||||
break;
|
||||
|
@ -830,6 +830,7 @@ uint32_t EmulateInstructionARM::GetFramePointerRegisterNumber() const {
|
||||
case llvm::Triple::IOS:
|
||||
case llvm::Triple::TvOS:
|
||||
case llvm::Triple::WatchOS:
|
||||
case llvm::Triple::XROS:
|
||||
// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
|
||||
is_apple = true;
|
||||
break;
|
||||
|
@ -4916,6 +4916,14 @@ struct OSEnv {
|
||||
environment =
|
||||
llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator);
|
||||
return;
|
||||
case llvm::MachO::PLATFORM_XROS:
|
||||
os_type = llvm::Triple::getOSTypeName(llvm::Triple::XROS);
|
||||
return;
|
||||
case llvm::MachO::PLATFORM_XROS_SIMULATOR:
|
||||
os_type = llvm::Triple::getOSTypeName(llvm::Triple::XROS);
|
||||
environment =
|
||||
llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator);
|
||||
return;
|
||||
default: {
|
||||
Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process));
|
||||
LLDB_LOGF(log, "unsupported platform in LC_BUILD_VERSION");
|
||||
@ -6483,7 +6491,8 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
|
||||
(target_triple.getOS() == llvm::Triple::MacOSX ||
|
||||
target_triple.getOS() == llvm::Triple::IOS ||
|
||||
target_triple.getOS() == llvm::Triple::WatchOS ||
|
||||
target_triple.getOS() == llvm::Triple::TvOS)) {
|
||||
target_triple.getOS() == llvm::Triple::TvOS ||
|
||||
target_triple.getOS() == llvm::Triple::XROS)) {
|
||||
// NEED_BRIDGEOS_TRIPLE target_triple.getOS() == llvm::Triple::BridgeOS))
|
||||
// {
|
||||
bool make_core = false;
|
||||
|
@ -14,6 +14,7 @@ list(APPEND PLUGIN_PLATFORM_MACOSX_SOURCES
|
||||
PlatformRemoteAppleBridge.cpp
|
||||
PlatformRemoteAppleTV.cpp
|
||||
PlatformRemoteAppleWatch.cpp
|
||||
PlatformRemoteAppleXR.cpp
|
||||
PlatformRemoteDarwinDevice.cpp
|
||||
PlatformRemoteMacOSX.cpp
|
||||
PlatformRemoteiOS.cpp
|
||||
|
@ -675,6 +675,41 @@ struct PlatformAppleWatchSimulator {
|
||||
}
|
||||
};
|
||||
|
||||
static const char *g_xros_plugin_name = "xros-simulator";
|
||||
static const char *g_xros_description = "XROS simulator platform plug-in.";
|
||||
|
||||
/// XRSimulator Plugin.
|
||||
struct PlatformXRSimulator {
|
||||
static void Initialize() {
|
||||
PluginManager::RegisterPlugin(g_xros_plugin_name, g_xros_description,
|
||||
PlatformXRSimulator::CreateInstance);
|
||||
}
|
||||
|
||||
static void Terminate() {
|
||||
PluginManager::UnregisterPlugin(PlatformXRSimulator::CreateInstance);
|
||||
}
|
||||
|
||||
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
|
||||
return PlatformAppleSimulator::CreateInstance(
|
||||
"PlatformXRSimulator", g_xros_description,
|
||||
ConstString(g_xros_plugin_name),
|
||||
{llvm::Triple::aarch64, llvm::Triple::x86_64, llvm::Triple::x86},
|
||||
llvm::Triple::XROS, {llvm::Triple::XROS},
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
#if __arm64__
|
||||
"arm64e-apple-xros-simulator", "arm64-apple-xros-simulator",
|
||||
#else
|
||||
"x86_64-apple-xros-simulator", "x86_64h-apple-xros-simulator",
|
||||
#endif
|
||||
#endif
|
||||
},
|
||||
"XRSimulator.Internal.sdk", "XRSimulator.sdk",
|
||||
XcodeSDK::Type::XRSimulator,
|
||||
CoreSimulatorSupport::DeviceType::ProductFamilyID::appleXR, force,
|
||||
arch);
|
||||
}
|
||||
};
|
||||
|
||||
static unsigned g_initialize_count = 0;
|
||||
|
||||
@ -685,12 +720,14 @@ void PlatformAppleSimulator::Initialize() {
|
||||
PlatformiOSSimulator::Initialize();
|
||||
PlatformAppleTVSimulator::Initialize();
|
||||
PlatformAppleWatchSimulator::Initialize();
|
||||
PlatformXRSimulator::Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void PlatformAppleSimulator::Terminate() {
|
||||
if (g_initialize_count > 0)
|
||||
if (--g_initialize_count == 0) {
|
||||
PlatformXRSimulator::Terminate();
|
||||
PlatformAppleWatchSimulator::Terminate();
|
||||
PlatformAppleTVSimulator::Terminate();
|
||||
PlatformiOSSimulator::Terminate();
|
||||
|
@ -796,6 +796,9 @@ FileSpec PlatformDarwin::GetSDKDirectoryForModules(XcodeSDK::Type sdk_type) {
|
||||
case XcodeSDK::Type::AppleTVSimulator:
|
||||
sdks_spec.AppendPathComponent("AppleTVSimulator.platform");
|
||||
break;
|
||||
case XcodeSDK::Type::XRSimulator:
|
||||
sdks_spec.AppendPathComponent("XRSimulator.platform");
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("unsupported sdk");
|
||||
}
|
||||
@ -1032,6 +1035,9 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
|
||||
case XcodeSDK::Type::watchOS:
|
||||
use_current_os_version = get_host_os() == llvm::Triple::WatchOS;
|
||||
break;
|
||||
case XcodeSDK::Type::XROS:
|
||||
use_current_os_version = get_host_os() == llvm::Triple::XROS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1049,8 +1055,10 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
|
||||
version = object_file->GetMinimumOSVersion();
|
||||
}
|
||||
}
|
||||
// Only add the version-min options if we got a version from somewhere
|
||||
if (!version.empty() && sdk_type != XcodeSDK::Type::Linux) {
|
||||
// Only add the version-min options if we got a version from somewhere.
|
||||
// clang has no version-min clang flag for XROS.
|
||||
if (!version.empty() && sdk_type != XcodeSDK::Type::Linux &&
|
||||
sdk_type != XcodeSDK::Type::XROS) {
|
||||
#define OPTION(PREFIX, NAME, VAR, ...) \
|
||||
llvm::StringRef opt_##VAR = NAME; \
|
||||
(void)opt_##VAR;
|
||||
@ -1079,6 +1087,9 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
|
||||
case XcodeSDK::Type::watchOS:
|
||||
minimum_version_option << opt_mwatchos_version_min_EQ;
|
||||
break;
|
||||
case XcodeSDK::Type::XRSimulator:
|
||||
case XcodeSDK::Type::XROS:
|
||||
// FIXME: Pass the right argument once it exists.
|
||||
case XcodeSDK::Type::bridgeOS:
|
||||
case XcodeSDK::Type::Linux:
|
||||
case XcodeSDK::Type::unknown:
|
||||
@ -1343,6 +1354,8 @@ llvm::Triple::OSType PlatformDarwin::GetHostOSType() {
|
||||
return llvm::Triple::TvOS;
|
||||
#elif TARGET_OS_BRIDGE
|
||||
return llvm::Triple::BridgeOS;
|
||||
#elif TARGET_OS_XR
|
||||
return llvm::Triple::XROS;
|
||||
#else
|
||||
#error "LLDB being compiled for an unrecognized Darwin OS"
|
||||
#endif
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "PlatformRemoteAppleBridge.h"
|
||||
#include "PlatformRemoteAppleTV.h"
|
||||
#include "PlatformRemoteAppleWatch.h"
|
||||
#include "PlatformRemoteAppleXR.h"
|
||||
#endif
|
||||
#include "lldb/Breakpoint/BreakpointLocation.h"
|
||||
#include "lldb/Core/Debugger.h"
|
||||
@ -53,6 +54,7 @@ void PlatformMacOSX::Initialize() {
|
||||
PlatformRemoteAppleTV::Initialize();
|
||||
PlatformRemoteAppleWatch::Initialize();
|
||||
PlatformRemoteAppleBridge::Initialize();
|
||||
PlatformRemoteAppleXR::Initialize();
|
||||
#endif
|
||||
|
||||
if (g_initialize_count++ == 0) {
|
||||
@ -75,6 +77,7 @@ void PlatformMacOSX::Terminate() {
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
PlatformRemoteAppleXR::Terminate();
|
||||
PlatformRemoteAppleBridge::Terminate();
|
||||
PlatformRemoteAppleWatch::Terminate();
|
||||
PlatformRemoteAppleTV::Terminate();
|
||||
|
157
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleXR.cpp
Normal file
157
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleXR.cpp
Normal file
@ -0,0 +1,157 @@
|
||||
//===-- PlatformRemoteAppleXR.cpp -----------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "PlatformRemoteAppleXR.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocation.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/ModuleList.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/LLDBLog.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
// Static Variables
|
||||
static uint32_t g_xr_initialize_count = 0;
|
||||
|
||||
// Static Functions
|
||||
void PlatformRemoteAppleXR::Initialize() {
|
||||
PlatformDarwin::Initialize();
|
||||
|
||||
if (g_xr_initialize_count++ == 0) {
|
||||
PluginManager::RegisterPlugin(PlatformRemoteAppleXR::GetPluginNameStatic(),
|
||||
PlatformRemoteAppleXR::GetDescriptionStatic(),
|
||||
PlatformRemoteAppleXR::CreateInstance);
|
||||
}
|
||||
}
|
||||
|
||||
void PlatformRemoteAppleXR::Terminate() {
|
||||
if (g_xr_initialize_count > 0) {
|
||||
if (--g_xr_initialize_count == 0) {
|
||||
PluginManager::UnregisterPlugin(PlatformRemoteAppleXR::CreateInstance);
|
||||
}
|
||||
}
|
||||
|
||||
PlatformDarwin::Terminate();
|
||||
}
|
||||
|
||||
PlatformSP PlatformRemoteAppleXR::CreateInstance(bool force,
|
||||
const ArchSpec *arch) {
|
||||
Log *log = GetLog(LLDBLog::Platform);
|
||||
if (log) {
|
||||
const char *arch_name;
|
||||
if (arch && arch->GetArchitectureName())
|
||||
arch_name = arch->GetArchitectureName();
|
||||
else
|
||||
arch_name = "<null>";
|
||||
|
||||
const char *triple_cstr =
|
||||
arch ? arch->GetTriple().getTriple().c_str() : "<null>";
|
||||
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleXR::%s(force=%s, arch={%s,%s})",
|
||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr);
|
||||
}
|
||||
|
||||
bool create = force;
|
||||
if (!create && arch && arch->IsValid()) {
|
||||
switch (arch->GetMachine()) {
|
||||
case llvm::Triple::arm:
|
||||
case llvm::Triple::aarch64:
|
||||
case llvm::Triple::aarch64_32:
|
||||
case llvm::Triple::thumb: {
|
||||
const llvm::Triple &triple = arch->GetTriple();
|
||||
llvm::Triple::VendorType vendor = triple.getVendor();
|
||||
switch (vendor) {
|
||||
case llvm::Triple::Apple:
|
||||
create = true;
|
||||
break;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// Only accept "unknown" for the vendor if the host is Apple and
|
||||
// "unknown" wasn't specified (it was just returned because it was NOT
|
||||
// specified)
|
||||
case llvm::Triple::UnknownVendor:
|
||||
create = !arch->TripleVendorWasSpecified();
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (create) {
|
||||
switch (triple.getOS()) {
|
||||
case llvm::Triple::XROS: // This is the right triple value for Apple
|
||||
// XR debugging
|
||||
break;
|
||||
|
||||
default:
|
||||
create = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TARGET_OS_XR) && TARGET_OS_XR == 1
|
||||
// If lldb is running on a XR device, this isn't a RemoteXR.
|
||||
if (force == false) {
|
||||
create = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (create) {
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleXR::%s() creating platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP(new PlatformRemoteAppleXR());
|
||||
}
|
||||
|
||||
LLDB_LOGF(log, "PlatformRemoteAppleXR::%s() aborting creation of platform",
|
||||
__FUNCTION__);
|
||||
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
||||
llvm::StringRef PlatformRemoteAppleXR::GetPluginNameStatic() {
|
||||
return "remote-xros";
|
||||
}
|
||||
|
||||
llvm::StringRef PlatformRemoteAppleXR::GetDescriptionStatic() {
|
||||
return "Remote Apple XR platform plug-in.";
|
||||
}
|
||||
|
||||
/// Default Constructor
|
||||
PlatformRemoteAppleXR::PlatformRemoteAppleXR() : PlatformRemoteDarwinDevice() {}
|
||||
|
||||
std::vector<lldb_private::ArchSpec>
|
||||
PlatformRemoteAppleXR::GetSupportedArchitectures(
|
||||
const ArchSpec &process_host_arch) {
|
||||
std::vector<ArchSpec> result;
|
||||
result.push_back(ArchSpec("arm64-apple-xros"));
|
||||
result.push_back(ArchSpec("arm64-apple-xros"));
|
||||
return result;
|
||||
}
|
||||
|
||||
llvm::StringRef PlatformRemoteAppleXR::GetDeviceSupportDirectoryName() {
|
||||
return "XROS DeviceSupport";
|
||||
}
|
||||
|
||||
llvm::StringRef PlatformRemoteAppleXR::GetPlatformName() {
|
||||
return "XROS.platform";
|
||||
}
|
38
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleXR.h
Normal file
38
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleXR.h
Normal file
@ -0,0 +1,38 @@
|
||||
//===-- PlatformRemoteAppleXR.h ---------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PlatformRemoteDarwinDevice.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class PlatformRemoteAppleXR : public PlatformRemoteDarwinDevice {
|
||||
public:
|
||||
PlatformRemoteAppleXR();
|
||||
|
||||
static lldb::PlatformSP CreateInstance(bool force,
|
||||
const lldb_private::ArchSpec *arch);
|
||||
|
||||
static void Initialize();
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static llvm::StringRef GetPluginNameStatic();
|
||||
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
|
||||
const lldb_private::ArchSpec &process_host_arch) override;
|
||||
|
||||
protected:
|
||||
llvm::StringRef GetDeviceSupportDirectoryName() override;
|
||||
llvm::StringRef GetPlatformName() override;
|
||||
};
|
||||
} // namespace lldb_private
|
@ -73,7 +73,8 @@ public:
|
||||
iPhone = 1,
|
||||
iPad = 2,
|
||||
appleTV = 3,
|
||||
appleWatch = 4
|
||||
appleWatch = 4,
|
||||
appleXR = 7,
|
||||
};
|
||||
|
||||
DeviceType();
|
||||
|
@ -125,6 +125,7 @@ bool ProcessKDP::CanDebug(TargetSP target_sp, bool plugin_specified_by_name) {
|
||||
case llvm::Triple::IOS: // For arm targets
|
||||
case llvm::Triple::TvOS:
|
||||
case llvm::Triple::WatchOS:
|
||||
case llvm::Triple::XROS:
|
||||
if (triple_ref.getVendor() == llvm::Triple::Apple) {
|
||||
ObjectFile *exe_objfile = exe_module->GetObjectFile();
|
||||
if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&
|
||||
|
@ -1180,7 +1180,8 @@ bool GDBRemoteCommunicationClient::GetDefaultThreadId(lldb::tid_t &tid) {
|
||||
static void ParseOSType(llvm::StringRef value, std::string &os_name,
|
||||
std::string &environment) {
|
||||
if (value.equals("iossimulator") || value.equals("tvossimulator") ||
|
||||
value.equals("watchossimulator")) {
|
||||
value.equals("watchossimulator") || value.equals("xrossimulator") ||
|
||||
value.equals("visionossimulator")) {
|
||||
environment = "simulator";
|
||||
os_name = value.drop_back(environment.size()).str();
|
||||
} else if (value.equals("maccatalyst")) {
|
||||
|
@ -61,6 +61,7 @@ SystemRuntime *SystemRuntimeMacOSX::CreateInstance(Process *process) {
|
||||
case llvm::Triple::IOS:
|
||||
case llvm::Triple::TvOS:
|
||||
case llvm::Triple::WatchOS:
|
||||
case llvm::Triple::XROS:
|
||||
// NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
|
||||
create = triple_ref.getVendor() == llvm::Triple::Apple;
|
||||
break;
|
||||
|
@ -34,6 +34,10 @@ static llvm::StringRef GetName(XcodeSDK::Type type) {
|
||||
return "WatchSimulator";
|
||||
case XcodeSDK::watchOS:
|
||||
return "WatchOS";
|
||||
case XcodeSDK::XRSimulator:
|
||||
return "XRSimulator";
|
||||
case XcodeSDK::XROS:
|
||||
return "XROS";
|
||||
case XcodeSDK::bridgeOS:
|
||||
return "bridgeOS";
|
||||
case XcodeSDK::Linux:
|
||||
@ -75,6 +79,10 @@ static XcodeSDK::Type ParseSDKName(llvm::StringRef &name) {
|
||||
return XcodeSDK::WatchSimulator;
|
||||
if (name.consume_front("WatchOS"))
|
||||
return XcodeSDK::watchOS;
|
||||
if (name.consume_front("XRSimulator"))
|
||||
return XcodeSDK::XRSimulator;
|
||||
if (name.consume_front("XROS"))
|
||||
return XcodeSDK::XROS;
|
||||
if (name.consume_front("bridgeOS"))
|
||||
return XcodeSDK::bridgeOS;
|
||||
if (name.consume_front("Linux"))
|
||||
@ -183,6 +191,12 @@ std::string XcodeSDK::GetCanonicalName(XcodeSDK::Info info) {
|
||||
case watchOS:
|
||||
name = "watchos";
|
||||
break;
|
||||
case XRSimulator:
|
||||
name = "xrsimulator";
|
||||
break;
|
||||
case XROS:
|
||||
name = "xros";
|
||||
break;
|
||||
case bridgeOS:
|
||||
name = "bridgeos";
|
||||
break;
|
||||
@ -212,6 +226,9 @@ bool XcodeSDK::SDKSupportsModules(XcodeSDK::Type sdk_type,
|
||||
case Type::watchOS:
|
||||
case Type::WatchSimulator:
|
||||
return version >= llvm::VersionTuple(6);
|
||||
case Type::XROS:
|
||||
case Type::XRSimulator:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -233,6 +250,8 @@ bool XcodeSDK::SupportsSwift() const {
|
||||
case Type::WatchSimulator:
|
||||
case Type::watchOS:
|
||||
return info.version.empty() || info.version >= llvm::VersionTuple(2);
|
||||
case Type::XROS:
|
||||
case Type::XRSimulator:
|
||||
case Type::Linux:
|
||||
return true;
|
||||
default:
|
||||
@ -276,6 +295,10 @@ XcodeSDK::Type XcodeSDK::GetSDKTypeForTriple(const llvm::Triple &triple) {
|
||||
if (triple.getEnvironment() == Triple::Simulator)
|
||||
return XcodeSDK::WatchSimulator;
|
||||
return XcodeSDK::watchOS;
|
||||
case Triple::XROS:
|
||||
if (triple.getEnvironment() == Triple::Simulator)
|
||||
return XcodeSDK::XRSimulator;
|
||||
return XcodeSDK::XROS;
|
||||
case Triple::Linux:
|
||||
return XcodeSDK::Linux;
|
||||
default:
|
||||
|
@ -72,6 +72,14 @@
|
||||
#define PLATFORM_DRIVERKIT 10
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_XROS
|
||||
#define PLATFORM_XROS 11
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_XR_SIMULATOR
|
||||
#define PLATFORM_XR_SIMULATOR 12
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SPRINGBOARD
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
@ -746,6 +754,10 @@ MachProcess::GetPlatformString(unsigned char platform) {
|
||||
return "bridgeos";
|
||||
case PLATFORM_DRIVERKIT:
|
||||
return "driverkit";
|
||||
case PLATFORM_XROS:
|
||||
return "xros";
|
||||
case PLATFORM_XR_SIMULATOR:
|
||||
return "xrossimulator";
|
||||
default:
|
||||
DNBLogError("Unknown platform %u found for one binary", platform);
|
||||
return std::nullopt;
|
||||
|
@ -3565,10 +3565,11 @@ rnb_err_t RNBRemote::HandlePacket_qSupported(const char *p) {
|
||||
bool enable_compression = false;
|
||||
(void)enable_compression;
|
||||
|
||||
#if (defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1) \
|
||||
|| (defined (TARGET_OS_IOS) && TARGET_OS_IOS == 1) \
|
||||
|| (defined (TARGET_OS_TV) && TARGET_OS_TV == 1) \
|
||||
|| (defined (TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1)
|
||||
#if (defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1) || \
|
||||
(defined(TARGET_OS_IOS) && TARGET_OS_IOS == 1) || \
|
||||
(defined(TARGET_OS_TV) && TARGET_OS_TV == 1) || \
|
||||
(defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1) || \
|
||||
(defined(TARGET_OS_XR) && TARGET_OS_XR == 1)
|
||||
enable_compression = true;
|
||||
#endif
|
||||
|
||||
@ -4866,6 +4867,8 @@ rnb_err_t RNBRemote::HandlePacket_qHostInfo(const char *p) {
|
||||
strm << "ostype:bridgeos;";
|
||||
#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
|
||||
strm << "ostype:macosx;";
|
||||
#elif defined(TARGET_OS_XR) && TARGET_OS_XR == 1
|
||||
strm << "ostype:xros;";
|
||||
#else
|
||||
strm << "ostype:ios;";
|
||||
#endif
|
||||
|
@ -27,6 +27,8 @@ TEST(XcodeSDKTest, ParseTest) {
|
||||
EXPECT_EQ(XcodeSDK("AppleTVOS.sdk").GetType(), XcodeSDK::AppleTVOS);
|
||||
EXPECT_EQ(XcodeSDK("WatchSimulator.sdk").GetType(), XcodeSDK::WatchSimulator);
|
||||
EXPECT_EQ(XcodeSDK("WatchOS.sdk").GetType(), XcodeSDK::watchOS);
|
||||
EXPECT_EQ(XcodeSDK("XRSimulator.sdk").GetType(), XcodeSDK::XRSimulator);
|
||||
EXPECT_EQ(XcodeSDK("XROS.sdk").GetType(), XcodeSDK::XROS);
|
||||
EXPECT_EQ(XcodeSDK("Linux.sdk").GetType(), XcodeSDK::Linux);
|
||||
EXPECT_EQ(XcodeSDK("MacOSX.sdk").GetVersion(), llvm::VersionTuple());
|
||||
EXPECT_EQ(XcodeSDK("MacOSX10.9.sdk").GetVersion(), llvm::VersionTuple(10, 9));
|
||||
@ -127,6 +129,14 @@ TEST(XcodeSDKTest, GetCanonicalNameAndConstruct) {
|
||||
EXPECT_EQ("watchos", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
|
||||
info.type = XcodeSDK::Type::XRSimulator;
|
||||
EXPECT_EQ("xrsimulator", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
|
||||
info.type = XcodeSDK::Type::XROS;
|
||||
EXPECT_EQ("xros", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
|
||||
info.type = XcodeSDK::Type::Linux;
|
||||
EXPECT_EQ("linux", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
@ -164,6 +174,13 @@ TEST(XcodeSDKTest, GetCanonicalNameAndConstruct) {
|
||||
EXPECT_EQ("watchos.internal", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
|
||||
info.type = XcodeSDK::Type::XRSimulator;
|
||||
EXPECT_EQ("xrsimulator.internal", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
|
||||
info.type = XcodeSDK::Type::XROS;
|
||||
EXPECT_EQ("xros.internal", XcodeSDK::GetCanonicalName(info));
|
||||
EXPECT_EQ(XcodeSDK(info).Parse(), info);
|
||||
info.type = XcodeSDK::Type::MacOSX;
|
||||
info.version = llvm::VersionTuple(10, 9);
|
||||
EXPECT_EQ("macosx10.9.internal", XcodeSDK::GetCanonicalName(info));
|
||||
@ -199,6 +216,11 @@ TEST(XcodeSDKTest, GetSDKTypeForTriple) {
|
||||
XcodeSDK::Type::WatchSimulator);
|
||||
EXPECT_EQ(XcodeSDK::GetSDKTypeForTriple(llvm::Triple("arm64-apple-watchos")),
|
||||
XcodeSDK::Type::watchOS);
|
||||
EXPECT_EQ(XcodeSDK::GetSDKTypeForTriple(
|
||||
llvm::Triple("arm64e-apple-xros-simulator")),
|
||||
XcodeSDK::Type::XRSimulator);
|
||||
EXPECT_EQ(XcodeSDK::GetSDKTypeForTriple(llvm::Triple("arm64e-apple-xros")),
|
||||
XcodeSDK::Type::XROS);
|
||||
EXPECT_EQ(XcodeSDK::GetSDKTypeForTriple(llvm::Triple("x86_64-unknown-linux")),
|
||||
XcodeSDK::Type::Linux);
|
||||
EXPECT_EQ(XcodeSDK::GetSDKTypeForTriple(llvm::Triple("i386-unknown-netbsd")),
|
||||
|
Loading…
x
Reference in New Issue
Block a user