-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[lldb] Fix FindProcessImpl() for iOS simulators #139174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[lldb] Fix FindProcessImpl() for iOS simulators #139174
Conversation
@llvm/pr-subscribers-lldb Author: None (royitaqi) ChangesBenefitThis patch fixes:
Changes
Manual testWith this patch:
Without this patch:
UnittestI did a couple of code searches (1, 2) and didn't seem to find any existing tests. Any suggestion about how to test this? Full diff: https://github.com/llvm/llvm-project/pull/139174.diff 1 Files Affected:
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;
}
}
|
Could we test this in |
@JDevlieghere Thanks for pointer. It seems the tests in that file are all skipped because of this bug number: E.g.
Did a bit internet search and couldn't find how to find more info about this bug or why these tests are all skipped. Not sure if I should un-skip them. What's your advice on my next steps? |
Ha, that's my radar, and it's no longer relevant. I bisected an issue with the test suite to that particular test, but the last comment says that it wasn't the culprit after all, so there's no reason it should still be disabled. |
Benefit
This patch fixes:
platform select ios-simulator
,platform process list
will now print processes which are running in the iOS simulator. Previously, no process will be listed.platform select ios-simulator
,platform attach --name <name>
will succeed. Previously, it will error out saying no process is found.Changes
aarch64
to the list of CPU types for which iOS simulators are checked for.Environment
toSimulator
, so that such processes can pass the filtering in this line. The original code leave it as the defaultUnknownEnvironment
.Manual test
With this patch:
Without this patch:
Unittest
I did a couple of code searches (1, 2) and didn't seem to find any existing tests.
Any suggestion about how to test this?