12 #if defined(__APPLE__)
24 #include "lldb/Host/Config.h"
46 PlatformDarwin::Initialize();
47 PlatformRemoteiOS::Initialize();
48 PlatformRemoteMacOSX::Initialize();
49 #if defined(__APPLE__)
50 PlatformAppleSimulator::Initialize();
51 PlatformDarwinKernel::Initialize();
52 PlatformRemoteAppleTV::Initialize();
53 PlatformRemoteAppleWatch::Initialize();
54 PlatformRemoteAppleBridge::Initialize();
58 #if defined(__APPLE__)
60 default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
61 Platform::SetHostPlatform(default_platform_sp);
63 PluginManager::RegisterPlugin(PlatformMacOSX::GetPluginNameStatic(),
64 PlatformMacOSX::GetDescriptionStatic(),
65 PlatformMacOSX::CreateInstance);
69 void PlatformMacOSX::Terminate() {
72 PluginManager::UnregisterPlugin(PlatformMacOSX::CreateInstance);
76 #if defined(__APPLE__)
77 PlatformRemoteAppleBridge::Terminate();
78 PlatformRemoteAppleWatch::Terminate();
79 PlatformRemoteAppleTV::Terminate();
80 PlatformDarwinKernel::Terminate();
81 PlatformAppleSimulator::Terminate();
83 PlatformRemoteMacOSX::Initialize();
84 PlatformRemoteiOS::Terminate();
85 PlatformDarwin::Terminate();
88 llvm::StringRef PlatformMacOSX::GetDescriptionStatic() {
89 return "Local Mac OS X user platform plug-in.";
92 PlatformSP PlatformMacOSX::CreateInstance(
bool force,
const ArchSpec *arch) {
106 ObjectFile *objfile = exe_module_sp->GetObjectFile();
115 if (
FileSpec fspec = HostInfo::GetXcodeContentsDirectory()) {
117 sdk_path.
Printf(
"%s/Developer/Platforms/MacOSX.platform/Developer/"
118 "SDKs/MacOSX%u.%u.sdk",
119 fspec.GetPath().c_str(), version.getMajor(),
120 version.getMinor().getValue());
136 std::vector<ArchSpec>
138 std::vector<ArchSpec> result;
139 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
145 if (host_os == llvm::Triple::MacOSX) {
149 result.push_back(
ArchSpec(
"x86_64-apple-macosx"));
150 result.push_back(
ArchSpec(
"x86_64-apple-ios-macabi"));
151 result.push_back(
ArchSpec(
"arm64-apple-ios-macabi"));
152 result.push_back(
ArchSpec(
"arm64e-apple-ios-macabi"));
158 if (!process_host_arch ||
159 process_host_arch.
GetTriple().getOS() == llvm::Triple::MacOSX) {
160 result.push_back(
ArchSpec(
"arm64-apple-ios"));
161 result.push_back(
ArchSpec(
"arm64e-apple-ios"));
166 result.push_back(
ArchSpec(
"x86_64-apple-ios-macabi"));
173 lldb::ModuleSP &module_sp,
174 const lldb_private::FileSpecList *module_search_paths_ptr,
177 module_search_paths_ptr,
178 old_modules, did_create_ptr);
183 ObjectFile *objfile = module_sp->GetObjectFile();
184 if (objfile ==
nullptr) {
188 lldb::ModuleSP x86_64_module_sp;
189 llvm::SmallVector<lldb::ModuleSP, 1> old_x86_64_modules;
190 bool did_create =
false;
192 module_spec_x86_64, x86_64_module_sp, module_search_paths_ptr,
193 &old_x86_64_modules, &did_create);
194 if (x86_64_module_sp && x86_64_module_sp->GetObjectFile()) {
195 module_sp = x86_64_module_sp;
197 old_modules->append(old_x86_64_modules.begin(),
198 old_x86_64_modules.end());
200 *did_create_ptr = did_create;
209 module_search_paths_ptr,
210 old_modules, did_create_ptr);
216 return "macOS DeviceSupport";