[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 16 09:09:23 PDT 2025
https://github.com/royitaqi updated https://github.com/llvm/llvm-project/pull/139174
>From d98210b81f7b49f5384e968b1a18e00e432aaf2c Mon Sep 17 00:00:00 2001
From: Roy Shi <royshi at meta.com>
Date: Thu, 8 May 2025 16:21:53 -0700
Subject: [PATCH] Fix macOS FindProcessImpl()
---
lldb/source/Host/macosx/objcxx/Host.mm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm
index e187bf98188ae..e8a1c597eea53 100644
--- a/lldb/source/Host/macosx/objcxx/Host.mm
+++ b/lldb/source/Host/macosx/objcxx/Host.mm
@@ -595,7 +595,9 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size,
const llvm::Triple::ArchType triple_arch = triple.getArch();
const bool check_for_ios_simulator =
(triple_arch == llvm::Triple::x86 ||
- triple_arch == llvm::Triple::x86_64);
+ triple_arch == llvm::Triple::x86_64 ||
+ triple_arch == llvm::Triple::aarch64);
+
const char *cstr = data.GetCStr(&offset);
if (cstr) {
process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native);
@@ -621,22 +623,25 @@ DataExtractor data(arg_data.GetBytes(), arg_data_size,
}
Environment &proc_env = process_info.GetEnvironment();
+ bool is_simulator = false;
while ((cstr = data.GetCStr(&offset))) {
if (cstr[0] == '\0')
break;
- if (check_for_ios_simulator) {
- if (strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) ==
- 0)
- process_info.GetArchitecture().GetTriple().setOS(
- llvm::Triple::IOS);
- else
- process_info.GetArchitecture().GetTriple().setOS(
- llvm::Triple::MacOSX);
- }
+ if (check_for_ios_simulator &&
+ strncmp(cstr, "SIMULATOR_UDID=", strlen("SIMULATOR_UDID=")) ==
+ 0)
+ is_simulator = true;
proc_env.insert(cstr);
}
+ llvm::Triple &triple = process_info.GetArchitecture().GetTriple();
+ if (is_simulator) {
+ triple.setOS(llvm::Triple::IOS);
+ triple.setEnvironment(llvm::Triple::Simulator);
+ } else {
+ triple.setOS(llvm::Triple::MacOSX);
+ }
return true;
}
}
More information about the lldb-commits
mailing list