[lldb] Upstream a few remaining Triple::XROS patches (#126335)

Recognize the visionOS Triple::OSType::XROS os type. Some of these have
already been landed on main, but I reviewed the downstream sources and
there were a few that still needed to be landed upstream.
This commit is contained in:
Jason Molenda
2025-02-08 15:50:52 -08:00
committed by GitHub
parent 8e61aae4a8
commit fec6d168bb
6 changed files with 20 additions and 5 deletions

View File

@@ -79,6 +79,7 @@ ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch)
case llvm::Triple::OSType::IOS:
case llvm::Triple::OSType::TvOS:
case llvm::Triple::OSType::WatchOS:
case llvm::Triple::OSType::XROS:
switch (os_env) {
case llvm::Triple::EnvironmentType::MacABI:
case llvm::Triple::EnvironmentType::Simulator:

View File

@@ -419,6 +419,8 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo(
image_infos[i].os_type = llvm::Triple::WatchOS;
else if (os_name == "bridgeos")
image_infos[i].os_type = llvm::Triple::BridgeOS;
else if (os_name == "xros")
image_infos[i].os_type = llvm::Triple::XROS;
else if (os_name == "maccatalyst") {
image_infos[i].os_type = llvm::Triple::IOS;
image_infos[i].os_env = llvm::Triple::MacABI;
@@ -431,6 +433,9 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo(
} else if (os_name == "watchossimulator") {
image_infos[i].os_type = llvm::Triple::WatchOS;
image_infos[i].os_env = llvm::Triple::Simulator;
} else if (os_name == "xrsimulator") {
image_infos[i].os_type = llvm::Triple::XROS;
image_infos[i].os_env = llvm::Triple::Simulator;
}
}
if (image->HasKey("min_version_os_sdk")) {
@@ -765,7 +770,8 @@ bool DynamicLoaderDarwin::AddModulesUsingPreloadedModules(
(dyld_triple.getEnvironment() == llvm::Triple::Simulator &&
(dyld_triple.getOS() == llvm::Triple::IOS ||
dyld_triple.getOS() == llvm::Triple::TvOS ||
dyld_triple.getOS() == llvm::Triple::WatchOS)))
dyld_triple.getOS() == llvm::Triple::WatchOS ||
dyld_triple.getOS() == llvm::Triple::XROS)))
image_module_sp->MergeArchitecture(dyld_spec);
}
}
@@ -835,7 +841,7 @@ lldb_private::ArchSpec DynamicLoaderDarwin::ImageInfo::GetArchitecture() const {
}
if (os_env == llvm::Triple::Simulator &&
(os_type == llvm::Triple::IOS || os_type == llvm::Triple::TvOS ||
os_type == llvm::Triple::WatchOS)) {
os_type == llvm::Triple::WatchOS || os_type == llvm::Triple::XROS)) {
llvm::Triple triple(llvm::Twine(arch_spec.GetArchitectureName()) +
"-apple-" + llvm::Triple::getOSTypeName(os_type) +
min_version_os_sdk + "-simulator");

View File

@@ -2848,7 +2848,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
"DSC unmapped local symbol[{0}] has invalid "
"string table offset {1:x} in {2}, ignoring symbol",
nlist_index, nlist.n_strx,
module_sp->GetFileSpec().GetPath());
module_sp->GetFileSpec().GetPath()));
continue;
}
if (symbol_name[0] == '\0')
@@ -6557,9 +6557,8 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
target_triple.getOS() == llvm::Triple::IOS ||
target_triple.getOS() == llvm::Triple::WatchOS ||
target_triple.getOS() == llvm::Triple::TvOS ||
target_triple.getOS() == llvm::Triple::BridgeOS ||
target_triple.getOS() == llvm::Triple::XROS)) {
// NEED_BRIDGEOS_TRIPLE target_triple.getOS() == llvm::Triple::BridgeOS))
// {
bool make_core = false;
switch (target_arch.GetMachine()) {
case llvm::Triple::aarch64:

View File

@@ -126,6 +126,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::WatchOS:
case llvm::Triple::XROS:
case llvm::Triple::TvOS:
case llvm::Triple::BridgeOS:
break;
@@ -329,6 +330,8 @@ void PlatformDarwinKernel::CollectKextAndKernelDirectories() {
"/Platforms/AppleTVOS.platform/Developer/SDKs");
AddSDKSubdirsToSearchPaths(developer_dir +
"/Platforms/WatchOS.platform/Developer/SDKs");
AddSDKSubdirsToSearchPaths(developer_dir +
"/Platforms/XROS.platform/Developer/SDKs");
AddSDKSubdirsToSearchPaths(developer_dir +
"/Platforms/BridgeOS.platform/Developer/SDKs");
}

View File

@@ -212,6 +212,8 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo(
response.PutCString("ostype:tvos;");
#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
response.PutCString("ostype:watchos;");
#elif defined(TARGET_OS_XR) && TARGET_OS_XR == 1
response.PutCString("ostype:xros;");
#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
response.PutCString("ostype:bridgeos;");
#else

View File

@@ -6369,6 +6369,8 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) {
rep << "ostype:bridgeos;";
#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
rep << "ostype:macosx;";
#elif defined(TARGET_OS_XR) && TARGET_OS_XR == 1
rep << "ostype:xros;";
#else
rep << "ostype:ios;";
#endif
@@ -6422,6 +6424,8 @@ rnb_err_t RNBRemote::HandlePacket_qProcessInfo(const char *p) {
rep << "ostype:watchos;";
#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
rep << "ostype:bridgeos;";
#elif defined(TARGET_OS_XR) && TARGET_OS_XR == 1
rep << "ostype:xros;";
#else
rep << "ostype:ios;";
#endif