diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp --- a/lldb/source/Host/common/HostInfoBase.cpp +++ b/lldb/source/Host/common/HostInfoBase.cpp @@ -209,7 +209,8 @@ normalized_triple.setVendor(host_triple.getVendor()); if (normalized_triple.getOSName().empty()) normalized_triple.setOS(host_triple.getOS()); - if (normalized_triple.getEnvironmentName().empty()) + if (normalized_triple.getEnvironmentName().empty() && + !host_triple.getEnvironmentName().empty()) normalized_triple.setEnvironment(host_triple.getEnvironment()); return ArchSpec(normalized_triple); } diff --git a/lldb/unittests/Host/HostInfoTest.cpp b/lldb/unittests/Host/HostInfoTest.cpp --- a/lldb/unittests/Host/HostInfoTest.cpp +++ b/lldb/unittests/Host/HostInfoTest.cpp @@ -43,6 +43,9 @@ // Test LLDB_ARCH_DEFAULT EXPECT_EQ(HostInfo::GetAugmentedArchSpec(LLDB_ARCH_DEFAULT).GetTriple(), HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple()); + EXPECT_NE( + HostInfo::GetAugmentedArchSpec("armv7k").GetTriple().getEnvironmentName(), + "unknown"); } TEST_F(HostInfoTest, GetHostname) {