Make use of lldv::Triple::isAndroid

It is a new function added to the llvm::Triple class to simplify the
checking if we are targeting android to clean up the confusion between
android being an OS or an environment.

llvm-svn: 250286
This commit is contained in:
Tamas Berghammer 2015-10-14 10:29:17 +00:00
parent c47edbef4c
commit 75cb3c5077
3 changed files with 7 additions and 13 deletions

View File

@ -291,19 +291,13 @@ DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry)
// FreeBSD and on Android it is the full path to the executable.
auto triple = m_process->GetTarget().GetArchitecture().GetTriple();
auto os_type = triple.getOS();
auto env_type = triple.getEnvironment();
switch (os_type) {
switch (triple.getOS()) {
case llvm::Triple::FreeBSD:
return entry.file_spec == m_exe_file_spec;
case llvm::Triple::Linux:
switch (env_type) {
case llvm::Triple::Android:
return entry.file_spec == m_exe_file_spec;
default:
return !entry.file_spec;
}
if (triple.isAndroid())
return entry.file_spec == m_exe_file_spec;
return !entry.file_spec;
default:
return false;
}
@ -381,7 +375,7 @@ isLoadBiasIncorrect(Target& target, const std::string& file_path)
// On Android L (API 21, 22) the load address of the "/system/bin/linker" isn't filled in
// correctly.
uint32_t os_major = 0, os_minor = 0, os_update = 0;
if (target.GetArchitecture().GetTriple().getEnvironment() == llvm::Triple::Android &&
if (target.GetArchitecture().GetTriple().isAndroid() &&
target.GetPlatform()->GetOSVersion(os_major, os_minor, os_update) &&
(os_major == 21 || os_major == 22) &&
(file_path == "/system/bin/linker" || file_path == "/system/bin/linker64"))

View File

@ -290,7 +290,7 @@ EmulateInstructionARM::GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t re
uint32_t
EmulateInstructionARM::GetFramePointerRegisterNumber () const
{
if (m_arch.GetTriple().getEnvironment() == llvm::Triple::Android)
if (m_arch.GetTriple().isAndroid())
return LLDB_INVALID_REGNUM; // Don't use frame pointer on android
bool is_apple = false;

View File

@ -405,7 +405,7 @@ EmulateInstructionARM64::CreateFunctionEntryUnwind (UnwindPlan &unwind_plan)
uint32_t
EmulateInstructionARM64::GetFramePointerRegisterNumber () const
{
if (m_arch.GetTriple().getEnvironment() == llvm::Triple::Android)
if (m_arch.GetTriple().isAndroid())
return LLDB_INVALID_REGNUM; // Don't use frame pointer on android
return arm64_dwarf::sp;