12 #if defined(__APPLE__)
25 #include "lldb/Host/Config.h"
47 PlatformDarwin::Initialize();
48 PlatformRemoteiOS::Initialize();
49 PlatformRemoteMacOSX::Initialize();
50 #if defined(__APPLE__)
51 PlatformAppleSimulator::Initialize();
52 PlatformDarwinKernel::Initialize();
53 PlatformRemoteAppleTV::Initialize();
54 PlatformRemoteAppleWatch::Initialize();
55 PlatformRemoteAppleBridge::Initialize();
59 #if defined(__APPLE__)
61 default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
62 Platform::SetHostPlatform(default_platform_sp);
64 PluginManager::RegisterPlugin(PlatformMacOSX::GetPluginNameStatic(),
65 PlatformMacOSX::GetDescriptionStatic(),
66 PlatformMacOSX::CreateInstance);
70 void PlatformMacOSX::Terminate() {
73 PluginManager::UnregisterPlugin(PlatformMacOSX::CreateInstance);
77 #if defined(__APPLE__)
78 PlatformRemoteAppleBridge::Terminate();
79 PlatformRemoteAppleWatch::Terminate();
80 PlatformRemoteAppleTV::Terminate();
81 PlatformDarwinKernel::Terminate();
82 PlatformAppleSimulator::Terminate();
84 PlatformRemoteMacOSX::Initialize();
85 PlatformRemoteiOS::Terminate();
86 PlatformDarwin::Terminate();
89 llvm::StringRef PlatformMacOSX::GetDescriptionStatic() {
90 return "Local Mac OS X user platform plug-in.";
93 PlatformSP PlatformMacOSX::CreateInstance(
bool force,
const ArchSpec *arch) {
107 ObjectFile *objfile = exe_module_sp->GetObjectFile();
116 if (
FileSpec fspec = HostInfo::GetXcodeContentsDirectory()) {
118 sdk_path.
Printf(
"%s/Developer/Platforms/MacOSX.platform/Developer/"
119 "SDKs/MacOSX%u.%u.sdk",
120 fspec.GetPath().c_str(), version.getMajor(),
121 *version.getMinor());
128 if (!sdk_path_or_err) {
130 toString(sdk_path_or_err.takeError()));
143 std::vector<ArchSpec>
145 std::vector<ArchSpec> result;
146 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
152 if (host_os == llvm::Triple::MacOSX) {
156 result.push_back(
ArchSpec(
"x86_64-apple-macosx"));
157 result.push_back(
ArchSpec(
"x86_64-apple-ios-macabi"));
158 result.push_back(
ArchSpec(
"arm64-apple-ios-macabi"));
159 result.push_back(
ArchSpec(
"arm64e-apple-ios-macabi"));
165 if (!process_host_arch ||
166 process_host_arch.
GetTriple().getOS() == llvm::Triple::MacOSX) {
167 result.push_back(
ArchSpec(
"arm64-apple-ios"));
168 result.push_back(
ArchSpec(
"arm64e-apple-ios"));
173 result.push_back(
ArchSpec(
"x86_64-apple-ios-macabi"));
180 lldb::ModuleSP &module_sp,
181 const lldb_private::FileSpecList *module_search_paths_ptr,
184 module_search_paths_ptr,
185 old_modules, did_create_ptr);
190 ObjectFile *objfile = module_sp->GetObjectFile();
191 if (objfile ==
nullptr) {
195 lldb::ModuleSP x86_64_module_sp;
196 llvm::SmallVector<lldb::ModuleSP, 1> old_x86_64_modules;
197 bool did_create =
false;
199 module_spec_x86_64, x86_64_module_sp, module_search_paths_ptr,
200 &old_x86_64_modules, &did_create);
201 if (x86_64_module_sp && x86_64_module_sp->GetObjectFile()) {
202 module_sp = x86_64_module_sp;
204 old_modules->append(old_x86_64_modules.begin(),
205 old_x86_64_modules.end());
207 *did_create_ptr = did_create;
216 module_search_paths_ptr,
217 old_modules, did_create_ptr);
223 return "macOS DeviceSupport";