diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-05-08 01:45:38 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-05-08 01:45:38 +0000 |
| commit | 7051231709ac438a59b5b4577b93511584885794 (patch) | |
| tree | 72e0e2af6ce771c65dd9171220075b812ae95f31 /lldb/source/Plugins | |
| parent | d6560a6384b9dc3c3e7189a60c117b2f0b5c0985 (diff) | |
| download | bcm5719-llvm-7051231709ac438a59b5b4577b93511584885794.tar.gz bcm5719-llvm-7051231709ac438a59b5b4577b93511584885794.zip | |
<rdar://problem/11358639>
Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples.
Also make the selection process for auto selecting platforms based off of an arch much better.
llvm-svn: 156354
Diffstat (limited to 'lldb/source/Plugins')
18 files changed, 376 insertions, 109 deletions
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp index d629aea88ed..9ec2e64e0e8 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp @@ -592,7 +592,7 @@ ABIMacOSX_arm::CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) row.SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, ptr_size * -1, true); unwind_plan.AppendRow (row); - unwind_plan.SetSourceName ("arm-apple-darwin default unwind plan"); + unwind_plan.SetSourceName ("arm-apple-ios default unwind plan"); return true; } @@ -623,7 +623,7 @@ ABIMacOSX_arm::RegisterIsVolatile (const RegisterInfo *reg_info) case '2': return name[2] == '\0'; // r2 case '3': return name[2] == '\0'; // r3 - case '9': return name[2] == '\0'; // r9 (apple-darwin only...) + case '9': return name[2] == '\0'; // r9 (apple-ios only...) break; } diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp index 47e6ddb208c..dd77e3061d4 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp @@ -684,7 +684,10 @@ DisassemblerLLVM::DisassemblerLLVM(const ArchSpec &arch) : // addresses. if (llvm_arch == llvm::Triple::arm) { - if (EDGetDisassembler(&m_disassembler_thumb, "thumbv7-apple-darwin", kEDAssemblySyntaxARMUAL)) + ArchSpec thumb_arch(arch); + thumb_arch.GetTriple().setArchName(llvm::StringRef("thumbv7")); + std::string thumb_triple(thumb_arch.GetTriple().getTriple()); + if (EDGetDisassembler(&m_disassembler_thumb, thumb_triple.c_str(), kEDAssemblySyntaxARMUAL)) m_disassembler_thumb = NULL; } } diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 93b8b949779..b2df3105453 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -65,7 +65,17 @@ DynamicLoaderDarwinKernel::CreateInstance (Process* process, bool force) if (create) { const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple(); - create = triple_ref.getOS() == llvm::Triple::Darwin && triple_ref.getVendor() == llvm::Triple::Apple; + switch (triple_ref.getOS()) + { + case llvm::Triple::Darwin: + case llvm::Triple::MacOSX: + case llvm::Triple::IOS: + create = triple_ref.getVendor() == llvm::Triple::Apple; + break; + default: + create = false; + break; + } } } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 2ea134c42d7..6219fef98b2 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -105,7 +105,17 @@ DynamicLoaderMacOSXDYLD::CreateInstance (Process* process, bool force) if (create) { const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple(); - create = triple_ref.getOS() == llvm::Triple::Darwin && triple_ref.getVendor() == llvm::Triple::Apple; + switch (triple_ref.getOS()) + { + case llvm::Triple::Darwin: + case llvm::Triple::MacOSX: + case llvm::Triple::IOS: + create = triple_ref.getVendor() == llvm::Triple::Apple; + break; + default: + create = false; + break; + } } } diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index 4f09f00ae9d..b443bf349e3 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -280,19 +280,37 @@ EmulateInstructionARM::GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num, Reg uint32_t EmulateInstructionARM::GetFramePointerRegisterNumber () const { - if (m_opcode_mode == eModeThumb || m_arch.GetTriple().getOS() == llvm::Triple::Darwin) - return 7; - else - return 11; + if (m_opcode_mode == eModeThumb) + { + switch (m_arch.GetTriple().getOS()) + { + case llvm::Triple::Darwin: + case llvm::Triple::MacOSX: + case llvm::Triple::IOS: + return 7; + default: + break; + } + } + return 11; } uint32_t EmulateInstructionARM::GetFramePointerDWARFRegisterNumber () const { - if (m_opcode_mode == eModeThumb || m_arch.GetTriple().getOS() == llvm::Triple::Darwin) - return dwarf_r7; - else - return dwarf_r11; + if (m_opcode_mode == eModeThumb) + { + switch (m_arch.GetTriple().getOS()) + { + case llvm::Triple::Darwin: + case llvm::Triple::MacOSX: + case llvm::Triple::IOS: + return dwarf_r7; + default: + break; + } + } + return dwarf_r11; } // Push Multiple Registers stores multiple registers to the stack, storing to diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp index 1abb0293e61..c2d97bc2cc9 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -197,7 +197,7 @@ ObjectContainerUniversalMachO::GetObjectFile (const FileSpec *file) { arch = Target::GetDefaultArchitecture (); if (!arch.IsValid()) - arch.SetTriple (LLDB_ARCH_DEFAULT, NULL); + arch.SetTriple (LLDB_ARCH_DEFAULT); } else arch = module_sp->GetArchitecture(); diff --git a/lldb/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp b/lldb/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp index 4598f64ebbc..1243e8133d8 100644 --- a/lldb/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp +++ b/lldb/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp @@ -75,7 +75,7 @@ OperatingSystemDarwinKernel::CreateInstance (Process *process, bool force) } } - // We can limit the creation of this plug-in to "*-apple-darwin" triples + // We can limit the creation of this plug-in to "*-apple-macosx" or "*-apple-ios" triples // if we command out the lines below... // if (create) // { diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 4a262279ef7..45d3cdc55e0 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -35,9 +35,37 @@ PlatformFreeBSD::CreateInstance (bool force, const lldb_private::ArchSpec *arch) if (create == false && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); - const llvm::Triple::OSType os = triple.getOS(); - if (os == llvm::Triple::FreeBSD || os == llvm::Triple::KFreeBSD) - create = true; + switch (triple.getVendor()) + { + case llvm::Triple::PC: + create = true; + break; + + case llvm::Triple::UnknownArch: + create = !arch->TripleVendorWasSpecified(); + break; + + default: + break; + } + + if (create) + { + switch (triple.getOS()) + { + case llvm::Triple::FreeBSD: + case llvm::Triple::KFreeBSD: + break; + + case llvm::Triple::UnknownOS: + create = arch->TripleOSWasSpecified(); + break; + + default: + create = false; + break; + } + } } if (create) return new PlatformFreeBSD (is_host); diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index c1dc25de277..c4dd4a8044f 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -39,9 +39,36 @@ PlatformLinux::CreateInstance (bool force, const ArchSpec *arch) if (create == false && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); - const llvm::Triple::OSType os = triple.getOS(); - if (os == llvm::Triple::Linux) - create = true; + switch (triple.getVendor()) + { + case llvm::Triple::PC: + create = true; + break; + + case llvm::Triple::UnknownArch: + create = !arch->TripleVendorWasSpecified(); + break; + + default: + break; + } + + if (create) + { + switch (triple.getOS()) + { + case llvm::Triple::Linux: + break; + + case llvm::Triple::UnknownOS: + create = !arch->TripleOSWasSpecified(); + break; + + default: + create = false; + break; + } + } } if (create) return new PlatformLinux(true); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index eea30625be0..fc6180e13b2 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -612,14 +612,22 @@ PlatformDarwin::ARMGetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch default: switch (idx) { - case 0: arch.SetTriple ("armv7-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv7f-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("armv7k-apple-darwin", NULL); return true; - case 3: arch.SetTriple ("armv7s-apple-darwin", NULL); return true; - case 4: arch.SetTriple ("armv6-apple-darwin", NULL); return true; - case 5: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 6: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 7: arch.SetTriple ("arm-apple-darwin", NULL); return true; + case 0: arch.SetTriple ("armv7-apple-ios"); return true; + case 1: arch.SetTriple ("armv7f-apple-ios"); return true; + case 2: arch.SetTriple ("armv7k-apple-ios"); return true; + case 3: arch.SetTriple ("armv7s-apple-ios"); return true; + case 4: arch.SetTriple ("armv6-apple-ios"); return true; + case 5: arch.SetTriple ("armv5-apple-ios"); return true; + case 6: arch.SetTriple ("armv4-apple-ios"); return true; + case 7: arch.SetTriple ("arm-apple-ios"); return true; + case 8: arch.SetTriple ("thumbv7-apple-ios"); return true; + case 9: arch.SetTriple ("thumbv7f-apple-ios"); return true; + case 10: arch.SetTriple ("thumbv7k-apple-ios"); return true; + case 11: arch.SetTriple ("thumbv7s-apple-ios"); return true; + case 12: arch.SetTriple ("thumbv6-apple-ios"); return true; + case 13: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 14: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 15: arch.SetTriple ("thumb-apple-ios"); return true; default: break; } break; @@ -627,81 +635,113 @@ PlatformDarwin::ARMGetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch case ArchSpec::eCore_arm_armv7f: switch (idx) { - case 0: arch.SetTriple ("armv7f-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true; - case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv7f-apple-ios"); return true; + case 1: arch.SetTriple ("armv7-apple-ios"); return true; + case 2: arch.SetTriple ("armv6-apple-ios"); return true; + case 3: arch.SetTriple ("armv5-apple-ios"); return true; + case 4: arch.SetTriple ("armv4-apple-ios"); return true; + case 5: arch.SetTriple ("arm-apple-ios"); return true; + case 6: arch.SetTriple ("thumbv7f-apple-ios"); return true; + case 7: arch.SetTriple ("thumbv7-apple-ios"); return true; + case 8: arch.SetTriple ("thumbv6-apple-ios"); return true; + case 9: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 10: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 11: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; case ArchSpec::eCore_arm_armv7k: switch (idx) { - case 0: arch.SetTriple ("armv7k-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true; - case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv7k-apple-ios"); return true; + case 1: arch.SetTriple ("armv7-apple-ios"); return true; + case 2: arch.SetTriple ("armv6-apple-ios"); return true; + case 3: arch.SetTriple ("armv5-apple-ios"); return true; + case 4: arch.SetTriple ("armv4-apple-ios"); return true; + case 5: arch.SetTriple ("arm-apple-ios"); return true; + case 6: arch.SetTriple ("thumbv7k-apple-ios"); return true; + case 7: arch.SetTriple ("thumbv7-apple-ios"); return true; + case 8: arch.SetTriple ("thumbv6-apple-ios"); return true; + case 9: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 10: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 11: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; case ArchSpec::eCore_arm_armv7s: switch (idx) { - case 0: arch.SetTriple ("armv7s-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true; - case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv7s-apple-ios"); return true; + case 1: arch.SetTriple ("armv7-apple-ios"); return true; + case 2: arch.SetTriple ("armv6-apple-ios"); return true; + case 3: arch.SetTriple ("armv5-apple-ios"); return true; + case 4: arch.SetTriple ("armv4-apple-ios"); return true; + case 5: arch.SetTriple ("arm-apple-ios"); return true; + case 6: arch.SetTriple ("thumbv7s-apple-ios"); return true; + case 7: arch.SetTriple ("thumbv7-apple-ios"); return true; + case 8: arch.SetTriple ("thumbv6-apple-ios"); return true; + case 9: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 10: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 11: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; case ArchSpec::eCore_arm_armv7: switch (idx) { - case 0: arch.SetTriple ("armv7-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv6-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 3: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 4: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv7-apple-ios"); return true; + case 1: arch.SetTriple ("armv6-apple-ios"); return true; + case 2: arch.SetTriple ("armv5-apple-ios"); return true; + case 3: arch.SetTriple ("armv4-apple-ios"); return true; + case 4: arch.SetTriple ("arm-apple-ios"); return true; + case 5: arch.SetTriple ("thumbv7-apple-ios"); return true; + case 6: arch.SetTriple ("thumbv6-apple-ios"); return true; + case 7: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 8: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 9: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; case ArchSpec::eCore_arm_armv6: switch (idx) { - case 0: arch.SetTriple ("armv6-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 3: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv6-apple-ios"); return true; + case 1: arch.SetTriple ("armv5-apple-ios"); return true; + case 2: arch.SetTriple ("armv4-apple-ios"); return true; + case 3: arch.SetTriple ("arm-apple-ios"); return true; + case 4: arch.SetTriple ("thumbv6-apple-ios"); return true; + case 5: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 6: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 7: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; case ArchSpec::eCore_arm_armv5: switch (idx) { - case 0: arch.SetTriple ("armv5-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 2: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv5-apple-ios"); return true; + case 1: arch.SetTriple ("armv4-apple-ios"); return true; + case 2: arch.SetTriple ("arm-apple-ios"); return true; + case 3: arch.SetTriple ("thumbv5-apple-ios"); return true; + case 4: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 5: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; case ArchSpec::eCore_arm_armv4: switch (idx) { - case 0: arch.SetTriple ("armv4-apple-darwin", NULL); return true; - case 1: arch.SetTriple ("arm-apple-darwin", NULL); return true; - default: break; + case 0: arch.SetTriple ("armv4-apple-ios"); return true; + case 1: arch.SetTriple ("arm-apple-ios"); return true; + case 2: arch.SetTriple ("thumbv4t-apple-ios"); return true; + case 3: arch.SetTriple ("thumb-apple-ios"); return true; + default: break; } break; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index f7c2374da2c..613a08b8135 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -71,10 +71,37 @@ PlatformMacOSX::CreateInstance (bool force, const ArchSpec *arch) if (create == false && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); - const llvm::Triple::OSType os = triple.getOS(); - const llvm::Triple::VendorType vendor = triple.getVendor(); - if (os == llvm::Triple::Darwin && vendor == llvm::Triple::Apple) - create = true; + switch (triple.getVendor()) + { + case llvm::Triple::Apple: + create = true; + break; + + case llvm::Triple::UnknownArch: + create = !arch->TripleVendorWasSpecified(); + break; + + default: + break; + } + + if (create) + { + switch (triple.getOS()) + { + case llvm::Triple::Darwin: // Deprecated, but still support Darwin for historical reasons + case llvm::Triple::MacOSX: + break; + + case llvm::Triple::UnknownOS: + create = !arch->TripleOSWasSpecified(); + break; + + default: + create = false; + break; + } + } } if (create) return new PlatformMacOSX (is_host); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index a1fcaf2b953..e4699d61bb8 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -94,10 +94,37 @@ PlatformRemoteiOS::CreateInstance (bool force, const ArchSpec *arch) case llvm::Triple::thumb: { const llvm::Triple &triple = arch->GetTriple(); - const llvm::Triple::OSType os = triple.getOS(); - const llvm::Triple::VendorType vendor = triple.getVendor(); - if (os == llvm::Triple::Darwin && vendor == llvm::Triple::Apple) - create = true; + llvm::Triple::VendorType vendor = triple.getVendor(); + switch (vendor) + { + case llvm::Triple::Apple: + create = true; + + case llvm::Triple::UnknownArch: + create = !arch->TripleVendorWasSpecified(); + break; + + default: + break; + } + + if (create) + { + switch (triple.getOS()) + { + case llvm::Triple::Darwin: // Deprecated, but still support Darwin for historical reasons + case llvm::Triple::IOS: // This is the right triple value for iOS debugging + break; + + case llvm::Triple::UnknownOS: + create = !arch->TripleOSWasSpecified(); + break; + + default: + create = false; + break; + } + } } break; default: diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 7a8884eba0a..5dfa11bffc1 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -71,10 +71,38 @@ PlatformiOSSimulator::CreateInstance (bool force, const ArchSpec *arch) case llvm::Triple::x86: { const llvm::Triple &triple = arch->GetTriple(); - const llvm::Triple::OSType os = triple.getOS(); - const llvm::Triple::VendorType vendor = triple.getVendor(); - if (os == llvm::Triple::Darwin && vendor == llvm::Triple::Apple) - create = true; + switch (triple.getVendor()) + { + case llvm::Triple::Apple: + create = true; + break; + + case llvm::Triple::UnknownArch: + create = !arch->TripleVendorWasSpecified(); + break; + + default: + break; + } + + if (create) + { + switch (triple.getOS()) + { + case llvm::Triple::Darwin: // Deprecated, but still support Darwin for historical reasons + case llvm::Triple::MacOSX: + case llvm::Triple::IOS: // IOS is not used for simulator triples, but accept it just in case + break; + + case llvm::Triple::UnknownOS: + create = !arch->TripleOSWasSpecified(); + break; + + default: + create = false; + break; + } + } } break; default: diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 4d9cd96def4..a596618ab51 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -58,9 +58,17 @@ PlatformRemoteGDBServer::Terminate () Platform* PlatformRemoteGDBServer::CreateInstance (bool force, const lldb_private::ArchSpec *arch) { - return new PlatformRemoteGDBServer (); + bool create = force; + if (!create) + { + create = !arch->TripleVendorWasSpecified() && !arch->TripleOSWasSpecified(); + } + if (create) + return new PlatformRemoteGDBServer (); + return NULL; } + const char * PlatformRemoteGDBServer::GetShortPluginNameStatic() { diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 45ed9b5f854..3c08a147246 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -71,13 +71,22 @@ ProcessKDP::CanDebug(Target &target, bool plugin_specified_by_name) if (exe_module) { const llvm::Triple &triple_ref = target.GetArchitecture().GetTriple(); - if (triple_ref.getOS() == llvm::Triple::Darwin && - triple_ref.getVendor() == llvm::Triple::Apple) + switch (triple_ref.getOS()) { - ObjectFile *exe_objfile = exe_module->GetObjectFile(); - if (exe_objfile->GetType() == ObjectFile::eTypeExecutable && - exe_objfile->GetStrata() == ObjectFile::eStrataKernel) - return true; + case llvm::Triple::Darwin: // Should use "macosx" for desktop and "ios" for iOS, but accept darwin just in case + case llvm::Triple::MacOSX: // For desktop targets + case llvm::Triple::IOS: // For arm targets + if (triple_ref.getVendor() == llvm::Triple::Apple) + { + ObjectFile *exe_objfile = exe_module->GetObjectFile(); + if (exe_objfile->GetType() == ObjectFile::eTypeExecutable && + exe_objfile->GetStrata() == ObjectFile::eStrataKernel) + return true; + } + break; + + default: + break; } } return false; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 7ed0f5f2c7b..6774b5f807d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1020,6 +1020,20 @@ GDBRemoteCommunicationClient::GetHostInfo (bool force) { assert (byte_order == m_host_arch.GetByteOrder()); } + + if (!os_name.empty() && vendor_name.compare("apple") == 0 && os_name.find("darwin") == 0) + { + switch (m_host_arch.GetMachine()) + { + case llvm::Triple::arm: + case llvm::Triple::thumb: + os_name = "ios"; + break; + default: + os_name = "macosx"; + break; + } + } if (!vendor_name.empty()) m_host_arch.GetTriple().setVendorName (llvm::StringRef (vendor_name)); if (!os_name.empty()) @@ -1031,17 +1045,35 @@ GDBRemoteCommunicationClient::GetHostInfo (bool force) { std::string triple; triple += arch_name; - triple += '-'; - if (vendor_name.empty()) - triple += "unknown"; - else - triple += vendor_name; - triple += '-'; - if (os_name.empty()) - triple += "unknown"; - else - triple += os_name; - m_host_arch.SetTriple (triple.c_str(), NULL); + if (!vendor_name.empty() || !os_name.empty()) + { + triple += '-'; + if (vendor_name.empty()) + triple += "unknown"; + else + triple += vendor_name; + triple += '-'; + if (os_name.empty()) + triple += "unknown"; + else + triple += os_name; + } + m_host_arch.SetTriple (triple.c_str()); + + llvm::Triple &host_triple = m_host_arch.GetTriple(); + if (host_triple.getVendor() == llvm::Triple::Apple && host_triple.getOS() == llvm::Triple::Darwin) + { + switch (m_host_arch.GetMachine()) + { + case llvm::Triple::arm: + case llvm::Triple::thumb: + host_triple.setOS(llvm::Triple::IOS); + break; + default: + host_triple.setOS(llvm::Triple::MacOSX); + break; + } + } if (pointer_byte_size) { assert (pointer_byte_size == m_host_arch.GetAddressByteSize()); @@ -1055,7 +1087,7 @@ GDBRemoteCommunicationClient::GetHostInfo (bool force) } else { - m_host_arch.SetTriple (triple.c_str(), NULL); + m_host_arch.SetTriple (triple.c_str()); if (pointer_byte_size) { assert (pointer_byte_size == m_host_arch.GetAddressByteSize()); @@ -1402,7 +1434,7 @@ GDBRemoteCommunicationClient::DecodeProcessInfoResponse (StringExtractorGDBRemot extractor.GetStringRef().swap(value); extractor.SetFilePos(0); extractor.GetHexByteString (value); - process_info.GetArchitecture ().SetTriple (value.c_str(), NULL); + process_info.GetArchitecture ().SetTriple (value.c_str()); } else if (name.compare("name") == 0) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5b59289bb9a..0cad8366c66 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -383,15 +383,16 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) // We didn't get anything. See if we are debugging ARM and fill with // a hard coded register set until we can get an updated debugserver // down on the devices. - - if (!GetTarget().GetArchitecture().IsValid() - && m_gdb_comm.GetHostArchitecture().IsValid() - && m_gdb_comm.GetHostArchitecture().GetMachine() == llvm::Triple::arm - && m_gdb_comm.GetHostArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) + const ArchSpec &target_arch = GetTarget().GetArchitecture(); + const ArchSpec &remote_arch = m_gdb_comm.GetHostArchitecture(); + if (!target_arch.IsValid()) { - m_register_info.HardcodeARMRegisters(); + if (remote_arch.IsValid() + && remote_arch.GetMachine() == llvm::Triple::arm + && remote_arch.GetTriple().getVendor() == llvm::Triple::Apple) + m_register_info.HardcodeARMRegisters(); } - else if (GetTarget().GetArchitecture().GetMachine() == llvm::Triple::arm) + else if (target_arch.GetMachine() == llvm::Triple::arm) { m_register_info.HardcodeARMRegisters(); } diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index abff31688d0..e9fe81e8b53 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -81,8 +81,7 @@ ProcessMachCore::CanDebug(Target &target, bool plugin_specified_by_name) if (m_core_module_sp) { const llvm::Triple &triple_ref = m_core_module_sp->GetArchitecture().GetTriple(); - if (triple_ref.getOS() == llvm::Triple::Darwin && - triple_ref.getVendor() == llvm::Triple::Apple) + if (triple_ref.getVendor() == llvm::Triple::Apple) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); if (core_objfile && core_objfile->GetType() == ObjectFile::eTypeCoreFile) |

