summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/ArchSpec.cpp13
-rw-r--r--lldb/source/Core/Module.cpp10
2 files changed, 20 insertions, 3 deletions
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp
index e7a5e489af1..015f76bffbb 100644
--- a/lldb/source/Core/ArchSpec.cpp
+++ b/lldb/source/Core/ArchSpec.cpp
@@ -765,6 +765,19 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
return IsValid();
}
+void
+ArchSpec::MergeFrom(const ArchSpec &other)
+{
+ if (GetTriple().getVendor() == llvm::Triple::UnknownVendor && !TripleVendorWasSpecified())
+ GetTriple().setVendor(other.GetTriple().getVendor());
+ if (GetTriple().getOS() == llvm::Triple::UnknownOS && !TripleOSWasSpecified())
+ GetTriple().setOS(other.GetTriple().getOS());
+ if (GetTriple().getArch() == llvm::Triple::UnknownArch)
+ GetTriple().setArch(other.GetTriple().getArch());
+ if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment)
+ GetTriple().setEnvironment(other.GetTriple().getEnvironment());
+}
+
bool
ArchSpec::SetArchitecture (ArchitectureType arch_type, uint32_t cpu, uint32_t sub)
{
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 900eea2e041..d38d403bd31 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1304,10 +1304,14 @@ Module::GetObjectFile()
data_offset);
if (m_objfile_sp)
{
- // Once we get the object file, update our module with the object file's
+ // Once we get the object file, update our module with the object file's
// architecture since it might differ in vendor/os if some parts were
- // unknown.
- m_objfile_sp->GetArchitecture (m_arch);
+ // unknown. But since the matching arch might already be more specific
+ // than the generic COFF architecture, only merge in those values that
+ // overwrite unspecified unknown values.
+ ArchSpec new_arch;
+ m_objfile_sp->GetArchitecture(new_arch);
+ m_arch.MergeFrom(new_arch);
}
else
{
OpenPOWER on IntegriCloud