This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix platform selection on Apple Silicon
ClosedPublic

Authored by JDevlieghere on Jan 14 2022, 10:38 AM.

Details

Summary

Currently, when connecting to a remote iOS device from the command line on Apple Silicon, we end up using the host platform (PlatfromMacOSX) instead of remote-ios (PlatformRemoteiOS). The reason is that PlatfromMacOSX includes arm64-apple-ios and arm64e-apple-ios as compatible architectures, presumably to support debugging iOS Apps on Apple Silicon [1]. The problem is that if we use the host platform, we don't look for an expanded shared cache on disk and end up reading everything from memory, incurring a significant performance hit.

The crux of this patch is to make PlatfromMacOSX not compatible with arm64(e)-apple-ios. As a result, we now use remote-ios (PlatformRemoteiOS) for debugging iOS apps on Apple Silicon. This has the (unintended) side effect that unlike the host platform, we would no longer check our local shared cache, and incur a performance hit. To avoid that, PlatformRemoteiOS will now also check the local cache to support this use case.

[1] https://support.apple.com/guide/app-store/iphone-ipad-apps-mac-apple-silicon-fird2c7092da/mac

Diff Detail

Event Timeline

JDevlieghere created this revision.Jan 14 2022, 10:38 AM
JDevlieghere requested review of this revision.Jan 14 2022, 10:38 AM
jasonmolenda accepted this revision.Jan 14 2022, 10:42 AM

I see what you're doing, yeah, this makes sense. Sometimes with firmware debugging, we pick a random platform (basically) and this might change which platform gets picked, host versus remote-ios, but I don't think it will matter for them.

This revision is now accepted and ready to land.Jan 14 2022, 10:42 AM
JDevlieghere edited the summary of this revision. (Show Details)

Avoid a performance hit for debugging iOS apps on AS Mac.

friss accepted this revision.Jan 14 2022, 3:30 PM

LGTM

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2022, 4:04 PM