summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBDebugger.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp3
-rw-r--r--lldb/source/Core/ArchSpec.cpp309
-rw-r--r--lldb/source/Interpreter/OptionGroupPlatform.cpp17
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp4
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp5
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp12
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp12
-rw-r--r--lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp34
-rw-r--r--lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp2
-rw-r--r--lldb/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp2
-rw-r--r--lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp34
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp33
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp134
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp35
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp35
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp36
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp10
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp21
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp58
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp15
-rw-r--r--lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp3
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp2
-rw-r--r--lldb/source/Target/Platform.cpp38
-rw-r--r--lldb/source/Target/Process.cpp40
-rw-r--r--lldb/source/Target/Target.cpp24
-rw-r--r--lldb/source/Target/TargetList.cpp51
28 files changed, 723 insertions, 251 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 46d5118ef51..8eea87af239 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -435,7 +435,7 @@ SBDebugger::SetDefaultArchitecture (const char *arch_name)
{
if (arch_name)
{
- ArchSpec arch (arch_name, NULL);
+ ArchSpec arch (arch_name);
if (arch.IsValid())
{
Target::SetDefaultArchitecture (arch);
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 357ff956a58..6a29be2bb07 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -134,7 +134,8 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
break;
case 'a':
- arch.SetTriple (option_arg, m_interpreter.GetPlatform (true).get());
+ if (!arch.SetTriple (option_arg, m_interpreter.GetPlatform (true).get()))
+ arch.SetTriple (option_arg);
break;
default:
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index e4d02733276..7d99e714546 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -63,7 +63,8 @@ public:
const bool select = true;
m_platform_options.SetPlatformName (platform_name);
Error error;
- PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error));
+ ArchSpec platform_arch;
+ PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error, platform_arch));
if (platform_sp)
{
platform_sp->GetStatus (result.GetOutputStream());
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp
index 91e5ae8f1a5..1e1497b446c 100644
--- a/lldb/source/Core/ArchSpec.cpp
+++ b/lldb/source/Core/ArchSpec.cpp
@@ -323,6 +323,16 @@ ArchSpec::ArchSpec (const char *triple_cstr, Platform *platform) :
SetTriple(triple_cstr, platform);
}
+
+ArchSpec::ArchSpec (const char *triple_cstr) :
+ m_triple (),
+ m_core (kCore_invalid),
+ m_byte_order (eByteOrderInvalid)
+{
+ if (triple_cstr)
+ SetTriple(triple_cstr);
+}
+
ArchSpec::ArchSpec(const llvm::Triple &triple) :
m_triple (),
m_core (kCore_invalid),
@@ -473,6 +483,34 @@ ArchSpec::SetTriple (const llvm::Triple &triple)
}
bool
+ArchSpec::SetTriple (const char *triple_cstr)
+{
+ if (triple_cstr && triple_cstr[0])
+ {
+ llvm::StringRef triple_stref (triple_cstr);
+ if (triple_stref.startswith (LLDB_ARCH_DEFAULT))
+ {
+ // Special case for the current host default architectures...
+ if (triple_stref.equals (LLDB_ARCH_DEFAULT_32BIT))
+ *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ else if (triple_stref.equals (LLDB_ARCH_DEFAULT_64BIT))
+ *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
+ else if (triple_stref.equals (LLDB_ARCH_DEFAULT))
+ *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ }
+ else
+ {
+ std::string normalized_triple_sstr (llvm::Triple::normalize(triple_stref));
+ triple_stref = normalized_triple_sstr;
+ SetTriple (llvm::Triple (triple_stref));
+ }
+ }
+ else
+ Clear();
+ return IsValid();
+}
+
+bool
ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
{
if (triple_cstr && triple_cstr[0])
@@ -490,6 +528,8 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
}
else
{
+ ArchSpec raw_arch (triple_cstr);
+
std::string normalized_triple_sstr (llvm::Triple::normalize(triple_stref));
triple_stref = normalized_triple_sstr;
llvm::Triple normalized_triple (triple_stref);
@@ -507,18 +547,24 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
// If we were given a platform, use the platform's system
// architecture. If this is not available (might not be
// connected) use the first supported architecture.
- ArchSpec platform_arch (platform->GetSystemArchitecture());
- if (!platform_arch.IsValid())
+ ArchSpec compatible_arch;
+ if (platform->IsCompatibleArchitecture (raw_arch, &compatible_arch))
{
- if (!platform->GetSupportedArchitectureAtIndex (0, platform_arch))
- platform_arch.Clear();
+ if (compatible_arch.IsValid())
+ {
+ const llvm::Triple &compatible_triple = compatible_arch.GetTriple();
+ if (!vendor_specified)
+ normalized_triple.setVendor(compatible_triple.getVendor());
+ if (!os_specified)
+ normalized_triple.setOS(compatible_triple.getOS());
+ if (!env_specified && compatible_triple.getEnvironmentName().size())
+ normalized_triple.setEnvironment(compatible_triple.getEnvironment());
+ }
}
-
- if (platform_arch.IsValid())
+ else
{
- normalized_triple.setVendor(platform_arch.GetTriple().getVendor());
- normalized_triple.setOS(platform_arch.GetTriple().getOS());
- normalized_triple.setEnvironment(platform_arch.GetTriple().getEnvironment());
+ *this = raw_arch;
+ return IsValid();
}
}
else
@@ -526,9 +572,12 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
// No platform specified, fall back to the host system for
// the default vendor, os, and environment.
llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple());
- normalized_triple.setVendor(host_triple.getVendor());
- normalized_triple.setOS(host_triple.getOS());
- normalized_triple.setEnvironment(host_triple.getEnvironment());
+ if (!vendor_specified)
+ normalized_triple.setVendor(host_triple.getVendor());
+ if (!vendor_specified)
+ normalized_triple.setOS(host_triple.getOS());
+ if (!env_specified && host_triple.getEnvironmentName().size())
+ normalized_triple.setEnvironment(host_triple.getEnvironment());
}
}
SetTriple (normalized_triple);
@@ -561,7 +610,20 @@ ArchSpec::SetArchitecture (ArchitectureType arch_type, uint32_t cpu, uint32_t su
if (arch_type == eArchTypeMachO)
{
m_triple.setVendor (llvm::Triple::Apple);
- m_triple.setOS (llvm::Triple::Darwin);
+
+ switch (core_def->machine)
+ {
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+ m_triple.setOS (llvm::Triple::IOS);
+ break;
+
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
+ default:
+ m_triple.setOS (llvm::Triple::MacOSX);
+ break;
+ }
}
else
{
@@ -620,6 +682,155 @@ ArchSpec::CoreUpdated (bool update_triple)
//===----------------------------------------------------------------------===//
// Operators.
+static bool
+cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_inverse)
+{
+ switch (core1)
+ {
+// case ArchSpec::eCore_arm_armv4:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumb)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv4t:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv4t)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv5:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv5)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv5t:
+// case ArchSpec::eCore_arm_armv5e:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv5e)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv6:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv6)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv7:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv7)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv7f:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv7f)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv7k:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv7k)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_arm_armv7s:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_thumbv7s)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumb:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv4)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv4t:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv4t)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv5:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv5)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv5e:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv5t || core2 == ArchSpec::eCore_arm_armv5e)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv6:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv6)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv7:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv7)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv7f:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv7f)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv7k:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv7k)
+// return true;
+// break;
+//
+// case ArchSpec::eCore_thumbv7s:
+// try_inverse = false;
+// if (core2 == ArchSpec::eCore_arm_armv7s)
+// return true;
+// break;
+
+ case ArchSpec::kCore_any:
+ return true;
+
+ case ArchSpec::kCore_arm_any:
+ if (core2 >= ArchSpec::kCore_arm_first && core2 <= ArchSpec::kCore_arm_last)
+ return true;
+ if (core2 >= ArchSpec::kCore_thumb_first && core2 <= ArchSpec::kCore_thumb_last)
+ return true;
+ if (core2 == ArchSpec::kCore_arm_any)
+ return true;
+ break;
+
+ case ArchSpec::kCore_x86_32_any:
+ if ((core2 >= ArchSpec::kCore_x86_32_first && core2 <= ArchSpec::kCore_x86_32_last) || (core2 == ArchSpec::kCore_x86_32_any))
+ return true;
+ break;
+
+ case ArchSpec::kCore_ppc_any:
+ if ((core2 >= ArchSpec::kCore_ppc_first && core2 <= ArchSpec::kCore_ppc_last) || (core2 == ArchSpec::kCore_ppc_any))
+ return true;
+ break;
+
+ case ArchSpec::kCore_ppc64_any:
+ if ((core2 >= ArchSpec::kCore_ppc64_first && core2 <= ArchSpec::kCore_ppc64_last) || (core2 == ArchSpec::kCore_ppc64_any))
+ return true;
+ break;
+
+ default:
+ break;
+ }
+ if (try_inverse)
+ return cores_match (core2, core1, false);
+ return false;
+}
+
bool
lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs)
{
@@ -629,61 +840,11 @@ lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs)
const ArchSpec::Core lhs_core = lhs.GetCore ();
const ArchSpec::Core rhs_core = rhs.GetCore ();
- bool core_match = false;
- if (lhs_core == rhs_core)
- core_match = true;
- else
- {
+ // Check if the cores match, or check a little closer watching for wildcard
+ // and equivalent cores
+ const bool core_match = (lhs_core == rhs_core) || cores_match (lhs_core, rhs_core, true);
- if (lhs_core == ArchSpec::kCore_any || rhs_core == ArchSpec::kCore_any)
- core_match = true;
- else
- {
- if (lhs_core == ArchSpec::kCore_arm_any)
- {
- if ((rhs_core >= ArchSpec::kCore_arm_first && rhs_core <= ArchSpec::kCore_arm_last) || (rhs_core == ArchSpec::kCore_arm_any))
- core_match = true;
- }
- else if (rhs_core == ArchSpec::kCore_arm_any)
- {
- if ((lhs_core >= ArchSpec::kCore_arm_first && lhs_core <= ArchSpec::kCore_arm_last) || (lhs_core == ArchSpec::kCore_arm_any))
- core_match = true;
- }
- else if (lhs_core == ArchSpec::kCore_x86_32_any)
- {
- if ((rhs_core >= ArchSpec::kCore_x86_32_first && rhs_core <= ArchSpec::kCore_x86_32_last) || (rhs_core == ArchSpec::kCore_x86_32_any))
- core_match = true;
- }
- else if (rhs_core == ArchSpec::kCore_x86_32_any)
- {
- if ((lhs_core >= ArchSpec::kCore_x86_32_first && lhs_core <= ArchSpec::kCore_x86_32_last) || (lhs_core == ArchSpec::kCore_x86_32_any))
- core_match = true;
- }
- else if (lhs_core == ArchSpec::kCore_ppc_any)
- {
- if ((rhs_core >= ArchSpec::kCore_ppc_first && rhs_core <= ArchSpec::kCore_ppc_last) || (rhs_core == ArchSpec::kCore_ppc_any))
- core_match = true;
- }
- else if (rhs_core == ArchSpec::kCore_ppc_any)
- {
- if ((lhs_core >= ArchSpec::kCore_ppc_first && lhs_core <= ArchSpec::kCore_ppc_last) || (lhs_core == ArchSpec::kCore_ppc_any))
- core_match = true;
- }
- else if (lhs_core == ArchSpec::kCore_ppc64_any)
- {
- if ((rhs_core >= ArchSpec::kCore_ppc64_first && rhs_core <= ArchSpec::kCore_ppc64_last) || (rhs_core == ArchSpec::kCore_ppc64_any))
- core_match = true;
- }
- else if (rhs_core == ArchSpec::kCore_ppc64_any)
- {
- if ((lhs_core >= ArchSpec::kCore_ppc64_first && lhs_core <= ArchSpec::kCore_ppc64_last) || (lhs_core == ArchSpec::kCore_ppc64_any))
- core_match = true;
- }
- }
- }
- if (!core_match)
- return false;
- else
+ if (core_match)
{
const llvm::Triple &lhs_triple = lhs.GetTriple();
const llvm::Triple &rhs_triple = rhs.GetTriple();
@@ -692,6 +853,13 @@ lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs)
const llvm::Triple::VendorType rhs_triple_vendor = rhs_triple.getVendor();
if (lhs_triple_vendor != rhs_triple_vendor)
{
+ const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified();
+ const bool lhs_vendor_specified = lhs.TripleVendorWasSpecified();
+ // Both architectures had the vendor specified, so if they aren't
+ // equal then we return false
+ if (rhs_vendor_specified && lhs_vendor_specified)
+ return false;
+
// Only fail if both vendor types are not unknown
if (lhs_triple_vendor != llvm::Triple::UnknownVendor &&
rhs_triple_vendor != llvm::Triple::UnknownVendor)
@@ -702,6 +870,12 @@ lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs)
const llvm::Triple::OSType rhs_triple_os = rhs_triple.getOS();
if (lhs_triple_os != rhs_triple_os)
{
+ const bool rhs_os_specified = rhs.TripleOSWasSpecified();
+ const bool lhs_os_specified = lhs.TripleOSWasSpecified();
+ // Both architectures had the OS specified, so if they aren't
+ // equal then we return false
+ if (rhs_os_specified && lhs_os_specified)
+ return false;
// Only fail if both os types are not unknown
if (lhs_triple_os != llvm::Triple::UnknownOS &&
rhs_triple_os != llvm::Triple::UnknownOS)
@@ -720,6 +894,7 @@ lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs)
}
return true;
}
+ return false;
}
bool
diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp
index ca2f3ffc937..8602ca87b1f 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -21,17 +21,30 @@ using namespace lldb;
using namespace lldb_private;
PlatformSP
-OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Error& error) const
+OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter,
+ const ArchSpec &arch,
+ bool make_selected,
+ Error& error,
+ ArchSpec &platform_arch) const
{
PlatformSP platform_sp;
if (!m_platform_name.empty())
{
platform_sp = Platform::Create (m_platform_name.c_str(), error);
+ if (platform_sp)
+ {
+ if (!platform_sp->IsCompatibleArchitecture(arch, &platform_arch))
+ {
+ error.SetErrorStringWithFormat("platform '%s' doesn't support '%s'", platform_sp->GetName(), arch.GetTriple().getTriple().c_str());
+ platform_sp.reset();
+ return platform_sp;
+ }
+ }
}
else if (arch.IsValid())
{
- platform_sp = Platform::Create (arch, error);
+ platform_sp = Platform::Create (arch, &platform_arch, error);
}
if (platform_sp)
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)
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 1d7063b4ebb..2ab9d762d26 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -622,7 +622,7 @@ ClangASTContext::getTargetOptions()
TargetInfo *
ClangASTContext::getTargetInfo()
{
- // target_triple should be something like "x86_64-apple-darwin10"
+ // target_triple should be something like "x86_64-apple-macosx"
if (m_target_info_ap.get() == NULL && !m_target_triple.empty())
m_target_info_ap.reset (TargetInfo::CreateTargetInfo(*getDiagnosticsEngine(), *getTargetOptions()));
return m_target_info_ap.get();
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 03b9d91aed3..af4b7a83af5 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -130,22 +130,26 @@ Platform::Create (const char *platform_name, Error &error)
PlatformSP
-Platform::Create (const ArchSpec &arch, Error &error)
+Platform::Create (const ArchSpec &arch, ArchSpec *platform_arch_ptr, Error &error)
{
lldb::PlatformSP platform_sp;
if (arch.IsValid())
{
+ uint32_t idx;
PlatformCreateInstance create_callback;
- for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
+ for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
{
if (create_callback)
platform_sp.reset(create_callback(false, &arch));
- if (platform_sp && platform_sp->IsCompatibleWithArchitecture(arch))
- break;
+ if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, platform_arch_ptr))
+ return platform_sp;
}
}
else
error.SetErrorString ("invalid platform name");
+ if (platform_arch_ptr)
+ platform_arch_ptr->Clear();
+ platform_sp.reset();
return platform_sp;
}
@@ -632,12 +636,12 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info,
lldb::PlatformSP
-Platform::GetPlatformForArchitecture (const ArchSpec &arch)
+Platform::GetPlatformForArchitecture (const ArchSpec &arch, ArchSpec *platform_arch_ptr)
{
lldb::PlatformSP platform_sp;
Error error;
if (arch.IsValid())
- platform_sp = Platform::Create (arch, error);
+ platform_sp = Platform::Create (arch, platform_arch_ptr, error);
return platform_sp;
}
@@ -647,18 +651,24 @@ Platform::GetPlatformForArchitecture (const ArchSpec &arch)
/// architecture and the target triple contained within.
//------------------------------------------------------------------
bool
-Platform::IsCompatibleWithArchitecture (const ArchSpec &arch)
+Platform::IsCompatibleArchitecture (const ArchSpec &arch, ArchSpec *compatible_arch_ptr)
{
// If the architecture is invalid, we must answer true...
- if (!arch.IsValid())
- return true;
-
- ArchSpec platform_arch;
- for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
+ if (arch.IsValid())
{
- if (arch == platform_arch)
- return true;
+ ArchSpec platform_arch;
+ for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
+ {
+ if (arch == platform_arch)
+ {
+ if (compatible_arch_ptr)
+ *compatible_arch_ptr = platform_arch;
+ return true;
+ }
+ }
}
+ if (compatible_arch_ptr)
+ compatible_arch_ptr->Clear();
return false;
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index deb657c2664..79efa38d93d 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -592,8 +592,8 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op
break;
case 'a':
- launch_info.GetArchitecture().SetTriple (option_arg,
- m_interpreter.GetPlatform(true).get());
+ if (!launch_info.GetArchitecture().SetTriple (option_arg, m_interpreter.GetPlatform(true).get()))
+ launch_info.GetArchitecture().SetTriple (option_arg);
break;
case 'A':
@@ -2741,23 +2741,25 @@ Process::CompleteAttach ()
assert (platform_sp.get());
if (platform_sp)
{
- const ArchSpec &target_arch = m_target.GetArchitecture();
- if (target_arch.IsValid() && !platform_sp->IsCompatibleWithArchitecture (target_arch))
- {
- platform_sp = platform_sp->GetPlatformForArchitecture (target_arch);
- if (platform_sp)
- {
- m_target.SetPlatform (platform_sp);
- }
- }
- else
- {
- ProcessInstanceInfo process_info;
- platform_sp->GetProcessInfo (GetID(), process_info);
- const ArchSpec &process_arch = process_info.GetArchitecture();
- if (process_arch.IsValid() && m_target.GetArchitecture() != process_arch)
- m_target.SetArchitecture (process_arch);
- }
+ const ArchSpec &target_arch = m_target.GetArchitecture();
+ if (target_arch.IsValid() && !platform_sp->IsCompatibleArchitecture (target_arch))
+ {
+ ArchSpec platform_arch;
+ platform_sp = platform_sp->GetPlatformForArchitecture (target_arch, &platform_arch);
+ if (platform_sp)
+ {
+ m_target.SetPlatform (platform_sp);
+ m_target.SetArchitecture(platform_arch);
+ }
+ }
+ else
+ {
+ ProcessInstanceInfo process_info;
+ platform_sp->GetProcessInfo (GetID(), process_info);
+ const ArchSpec &process_arch = process_info.GetArchitecture();
+ if (process_arch.IsValid() && m_target.GetArchitecture() != process_arch)
+ m_target.SetArchitecture (process_arch);
+ }
}
// We have completed the attach, now it is time to find the dynamic loader
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 59927fcdf03..18368e6aa42 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -926,15 +926,12 @@ Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
bool
Target::SetArchitecture (const ArchSpec &arch_spec)
{
- if (m_arch == arch_spec)
+ if (m_arch == arch_spec || !m_arch.IsValid())
{
- // If we're setting the architecture to our current architecture, we
- // don't need to do anything.
- return true;
- }
- else if (!m_arch.IsValid())
- {
- // If we haven't got a valid arch spec, then we just need to set it.
+ // If we haven't got a valid arch spec, or the architectures are
+ // compatible, so just update the architecture. Architectures can be
+ // equal, yet the triple OS and vendor might change, so we need to do
+ // the assignment here just in case.
m_arch = arch_spec;
return true;
}
@@ -963,16 +960,9 @@ Target::SetArchitecture (const ArchSpec &arch_spec)
SetExecutableModule (executable_sp, true);
return true;
}
- else
- {
- return false;
- }
- }
- else
- {
- return false;
}
}
+ return false;
}
void
@@ -2254,7 +2244,7 @@ Target::SettingsController::SetGlobalVariable (const ConstString &var_name,
{
if (var_name == GetSettingNameForDefaultArch())
{
- m_default_architecture.SetTriple (value, NULL);
+ m_default_architecture.SetTriple (value);
if (!m_default_architecture.IsValid())
err.SetErrorStringWithFormat ("'%s' is not a valid architecture or triple.", value);
}
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index d9879139dc5..3ec4b08c190 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -68,11 +68,9 @@ TargetList::CreateTarget (Debugger &debugger,
// This is purposely left empty unless it is specified by triple_cstr.
// If not initialized via triple_cstr, then the currently selected platform
// will set the architecture correctly.
- ArchSpec arch;
-
- if (triple_cstr)
+ const ArchSpec arch(triple_cstr);
+ if (triple_cstr && triple_cstr[0])
{
- arch.SetTriple(triple_cstr, platform_sp.get());
if (!arch.IsValid())
{
error.SetErrorStringWithFormat("invalid triple '%s'", triple_cstr);
@@ -80,6 +78,7 @@ TargetList::CreateTarget (Debugger &debugger,
}
}
+ ArchSpec platform_arch(arch);
CommandInterpreter &interpreter = debugger.GetCommandInterpreter();
if (platform_options)
{
@@ -89,7 +88,8 @@ TargetList::CreateTarget (Debugger &debugger,
platform_sp = platform_options->CreatePlatformWithOptions (interpreter,
arch,
select_platform,
- error);
+ error,
+ platform_arch);
if (!platform_sp)
return error;
}
@@ -101,15 +101,18 @@ TargetList::CreateTarget (Debugger &debugger,
// current architecture if we have a valid architecture.
platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
- if (arch.IsValid() && !platform_sp->IsCompatibleWithArchitecture(arch))
+ if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, &platform_arch))
{
- platform_sp = Platform::GetPlatformForArchitecture(arch);
+ platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
}
}
+
+ if (!platform_arch.IsValid())
+ platform_arch = arch;
error = TargetList::CreateTarget (debugger,
file,
- arch,
+ platform_arch,
get_dependent_files,
platform_sp,
target_sp);
@@ -131,7 +134,7 @@ TargetList::CreateTarget
(
Debugger &debugger,
const FileSpec& file,
- const ArchSpec& arch,
+ const ArchSpec& specified_arch,
bool get_dependent_files,
PlatformSP &platform_sp,
TargetSP &target_sp
@@ -141,28 +144,38 @@ TargetList::CreateTarget
"TargetList::CreateTarget (file = '%s/%s', arch = '%s')",
file.GetDirectory().AsCString(),
file.GetFilename().AsCString(),
- arch.GetArchitectureName());
+ specified_arch.GetArchitectureName());
Error error;
+ ArchSpec arch(specified_arch);
+
+ if (platform_sp)
+ {
+ if (arch.IsValid())
+ {
+ if (!platform_sp->IsCompatibleArchitecture(arch))
+ platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
+ }
+ }
+ else if (arch.IsValid())
+ {
+ platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
+ }
+ if (!platform_sp)
+ platform_sp = debugger.GetPlatformList().GetSelectedPlatform();
+
if (file)
{
ModuleSP exe_module_sp;
FileSpec resolved_file(file);
-
if (platform_sp)
{
FileSpecList executable_search_paths (Target::GetDefaultExecutableSearchPaths());
- error = platform_sp->ResolveExecutable (file, arch,
+ error = platform_sp->ResolveExecutable (file,
+ arch,
exe_module_sp,
executable_search_paths.GetSize() ? &executable_search_paths : NULL);
-
- if (exe_module_sp)
- {
- const ArchSpec &arch = exe_module_sp->GetArchitecture();
- if (arch.IsValid() && !platform_sp->IsCompatibleWithArchitecture(arch))
- platform_sp = Platform::GetPlatformForArchitecture(arch);
- }
}
if (error.Success() && exe_module_sp)
OpenPOWER on IntegriCloud