Skip to content

Commit

Permalink
[lldb] Upstream a few remaining Triple::XROS patches (llvm#126335)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jasonmolenda authored and Icohedron committed Feb 11, 2025
1 parent 7381b4e commit aed0564
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")) {
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lldb/tools/debugserver/source/RNBRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aed0564

Please sign in to comment.