Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
//===-- PlatformiOSSimulator.cpp ------------------------------------------===// | //===-- PlatformiOSSimulator.cpp ------------------------------------------===// | ||||
Lint: Lint: clang-format not found in user's PATH; not linting file. | |||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if (log) { | ||||
LLDB_LOGF(log, "PlatformiOSSimulator::%s(force=%s, arch={%s,%s})", | LLDB_LOGF(log, "PlatformiOSSimulator::%s(force=%s, arch={%s,%s})", | ||||
__FUNCTION__, force ? "true" : "false", arch_name, triple_cstr); | __FUNCTION__, force ? "true" : "false", arch_name, triple_cstr); | ||||
} | } | ||||
bool create = force; | bool create = force; | ||||
if (!create && arch && arch->IsValid()) { | if (!create && arch && arch->IsValid()) { | ||||
switch (arch->GetMachine()) { | switch (arch->GetMachine()) { | ||||
case llvm::Triple::aarch64: | |||||
case llvm::Triple::x86_64: | case llvm::Triple::x86_64: | ||||
case llvm::Triple::x86: { | case llvm::Triple::x86: { | ||||
const llvm::Triple &triple = arch->GetTriple(); | const llvm::Triple &triple = arch->GetTriple(); | ||||
switch (triple.getVendor()) { | switch (triple.getVendor()) { | ||||
case llvm::Triple::Apple: | case llvm::Triple::Apple: | ||||
create = true; | create = true; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
const char *PlatformiOSSimulator::GetDescriptionStatic() { | const char *PlatformiOSSimulator::GetDescriptionStatic() { | ||||
return "iOS simulator platform plug-in."; | return "iOS simulator platform plug-in."; | ||||
} | } | ||||
/// Default Constructor | /// Default Constructor | ||||
PlatformiOSSimulator::PlatformiOSSimulator() | PlatformiOSSimulator::PlatformiOSSimulator() | ||||
: PlatformAppleSimulator( | : PlatformAppleSimulator( | ||||
CoreSimulatorSupport::DeviceType::ProductFamilyID::iPhone) {} | CoreSimulatorSupport::DeviceType::ProductFamilyID::iPhone) { | ||||
#ifdef __APPLE__ | |||||
#if __arm64__ | |||||
static const llvm::StringRef supported_triples[] = { | |||||
"arm64e-apple-ios-simulator", | |||||
"arm64-apple-ios-simulator", | |||||
"x86_64-apple-ios-simulator", | |||||
"x86_64h-apple-ios-simulator", | |||||
}; | |||||
#else | |||||
static const llvm::StringRef supported_triples[] = { | |||||
"x86_64h-apple-ios-simulator", | |||||
"x86_64-apple-ios-simulator", | |||||
"i386-apple-ios-simulator", | |||||
}; | |||||
#endif | |||||
m_supported_triples = supported_triples; | |||||
#endif | |||||
} | |||||
/// Destructor. | /// Destructor. | ||||
/// | /// | ||||
/// The destructor is virtual since this class is designed to be | /// The destructor is virtual since this class is designed to be | ||||
/// inherited from by the plug-in instance. | /// inherited from by the plug-in instance. | ||||
PlatformiOSSimulator::~PlatformiOSSimulator() {} | PlatformiOSSimulator::~PlatformiOSSimulator() {} | ||||
void PlatformiOSSimulator::GetStatus(Stream &strm) { | void PlatformiOSSimulator::GetStatus(Stream &strm) { | ||||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | for (uint32_t i = 0; i < n; ++i) { | ||||
const ProcessInstanceInfo &proc_info = all_osx_process_infos[i]; | const ProcessInstanceInfo &proc_info = all_osx_process_infos[i]; | ||||
if (proc_info.GetArchitecture().GetTriple().getOS() == llvm::Triple::IOS) { | if (proc_info.GetArchitecture().GetTriple().getOS() == llvm::Triple::IOS) { | ||||
process_infos.push_back(proc_info); | process_infos.push_back(proc_info); | ||||
} | } | ||||
} | } | ||||
return process_infos.size(); | return process_infos.size(); | ||||
} | } | ||||
bool PlatformiOSSimulator::GetSupportedArchitectureAtIndex(uint32_t idx, | |||||
ArchSpec &arch) { | |||||
static const ArchSpec platform_arch( | |||||
HostInfo::GetArchitecture(HostInfo::eArchKindDefault)); | |||||
static const ArchSpec platform_arch64( | |||||
HostInfo::GetArchitecture(HostInfo::eArchKind64)); | |||||
if (idx == 0) { | |||||
arch = platform_arch; | |||||
if (arch.IsValid()) { | |||||
arch.GetTriple().setOS(llvm::Triple::IOS); | |||||
arch.GetTriple().setEnvironment(llvm::Triple::Simulator); | |||||
return true; | |||||
} | |||||
} else { | |||||
if (platform_arch.IsExactMatch(platform_arch64)) { | |||||
// This macosx platform supports both 32 and 64 bit. | |||||
if (idx == 1) { | |||||
// 32/64: return "x86_64-apple-macosx" for architecture 1 | |||||
arch = platform_arch64; | |||||
return true; | |||||
} else if (idx == 2 || idx == 3) { | |||||
arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); | |||||
if (arch.IsValid()) { | |||||
if (idx == 2) | |||||
arch.GetTriple().setOS(llvm::Triple::IOS); | |||||
// 32/64: return "i386-apple-ios" for architecture 2 32/64: return | |||||
// "i386-apple-macosx" for architecture 3 | |||||
return true; | |||||
} | |||||
} | |||||
} else if (idx == 1) { | |||||
// This macosx platform supports only 32 bit, so return the *-apple- | |||||
// macosx version | |||||
arch = platform_arch; | |||||
return true; | |||||
} | |||||
} | |||||
return false; | |||||
} |
clang-format not found in user's PATH; not linting file.