summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/ArchSpec.h11
-rw-r--r--lldb/source/Core/ArchSpec.cpp19
2 files changed, 17 insertions, 13 deletions
diff --git a/lldb/include/lldb/Core/ArchSpec.h b/lldb/include/lldb/Core/ArchSpec.h
index a479f47973e..69fff9fb2fa 100644
--- a/lldb/include/lldb/Core/ArchSpec.h
+++ b/lldb/include/lldb/Core/ArchSpec.h
@@ -294,11 +294,12 @@ public:
//------------------------------------------------------------------
/// Architecture tripple setter.
///
- /// Configures this ArchSpec according to the given triple. At a
- /// minimum, the given triple must describe a valid operating
- /// system. If archetecture or environment components are present
- /// they too will be used to further resolve the CPU type and
- /// subtype, endian characteristics, etc.
+ /// Configures this ArchSpec according to the given triple. If the
+ /// triple has unknown components in all of the vendor, OS, and
+ /// the optional environment field (i.e. "i386-unknown-unknown")
+ /// then default values are taken from the host. Architecture and
+ /// environment components are used to further resolve the CPU type
+ /// and subtype, endian characteristics, etc.
///
/// @return A triple describing this ArchSpec.
//------------------------------------------------------------------
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp
index a5493b3954d..3d59d28a332 100644
--- a/lldb/source/Core/ArchSpec.cpp
+++ b/lldb/source/Core/ArchSpec.cpp
@@ -14,6 +14,7 @@
#include <string>
#include "llvm/Support/ELF.h"
+#include "llvm/Support/Host.h"
#include "llvm/Support/MachO.h"
#include "lldb/Host/Endian.h"
#include "lldb/Host/Host.h"
@@ -407,14 +408,16 @@ ArchSpec::SetTriple (const llvm::Triple &triple)
m_core = core_def->core;
m_byte_order = core_def->default_byte_order;
- // If the vendor, OS or environment aren't specified, default to the system?
- const ArchSpec &host_arch_ref = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
- if (m_triple.getVendor() == llvm::Triple::UnknownVendor)
- m_triple.setVendor(host_arch_ref.GetTriple().getVendor());
- if (m_triple.getOS() == llvm::Triple::UnknownOS)
- m_triple.setOS(host_arch_ref.GetTriple().getOS());
- if (m_triple.getEnvironment() == llvm::Triple::UnknownEnvironment)
- m_triple.setEnvironment(host_arch_ref.GetTriple().getEnvironment());
+ if (m_triple.getVendor() == llvm::Triple::UnknownVendor &&
+ m_triple.getOS() == llvm::Triple::UnknownOS &&
+ m_triple.getEnvironment() == llvm::Triple::UnknownEnvironment)
+ {
+ llvm::Triple host_triple(llvm::sys::getHostTriple());
+
+ m_triple.setVendor(host_triple.getVendor());
+ m_triple.setOS(host_triple.getOS());
+ m_triple.setEnvironment(host_triple.getEnvironment());
+ }
}
else
{
OpenPOWER on IntegriCloud