[lldb] Fix platform selection on Apple Silicon (again)
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Mar 2022 15:50:33 +0000 (08:50 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Mar 2022 16:06:29 +0000 (09:06 -0700)
commitc22c7a61b6d9c90d5d4292205c63cd576f4fd05b
tree633bcf3f10a1e681679cf9aea1e11db5f3eb9b0b
parent6714da0d14f130a799cf044ca6c5dd953a9c59ea
[lldb] Fix platform selection on Apple Silicon (again)

This patch is another attempt to fix platform selection on Apple
Silicon. It partially undoes D117340 which tried to fix the issue by
always instantiating a remote-ios platform for "iPhone and iPad Apps on
Apple Silicon Macs".

While the previous patch worked for attaching, it broke launching and
everything else that expects the remote platform to be connected. I made
an attempt to work around that, but quickly found out that there were
just too may places that had this assumption baked in.

This patch takes a different approach and reverts back to marking the
host platform compatible with iOS triples. This brings us back to the
original situation where platform selection was broken for remote iOS
debugging on Apple Silicon. To fix that, we now look at the process'
host architecture to differentiate between iOS binaries running remotely
and iOS binaries running locally.

I tested the following scenarios, which now all uses the desired
platform:

  - Launching an iOS binary on macOS: uses the host platform
  - Attaching to an iOS binary on macOS: uses the host platform
  - Attaching to a remote iOS binary: uses the remote-ios platform

rdar://89840215

Differential revision: https://reviews.llvm.org/D121444
lldb/lldb/test/API/functionalities/gdb_remote_client/TestPlatformMacOSX.py [new file with mode: 0644]
lldb/lldb/unittests/Platform/PlatformMacOSXTest.cpp [new file with mode: 0644]
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/test/API/functionalities/gdb_remote_client/TestPlatformMacOSX.py [new file with mode: 0644]
lldb/unittests/Platform/CMakeLists.txt
lldb/unittests/Platform/PlatformMacOSXTest.cpp [new file with mode: 0644]