summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2019-02-20 23:12:56 +0000
committerAlex Langford <apl@fb.com>2019-02-20 23:12:56 +0000
commita07287ecc5e333217f378cbb3f3d885ead69dd13 (patch)
tree3e358379ecb0eea0a1e4881121cc5c023089a0ef /lldb/source/Core/Module.cpp
parentdefb5a383b298a786bac2759553be0c500cb660c (diff)
downloadbcm5719-llvm-a07287ecc5e333217f378cbb3f3d885ead69dd13.tar.gz
bcm5719-llvm-a07287ecc5e333217f378cbb3f3d885ead69dd13.zip
Merge target triple into module triple when constructing module from memory
Summary: While debugging an android process remotely from a windows machine, I noticed that the modules constructed from an object file in memory only had information about the architecture. Without knowledge of the OS or environment, expression evaluation sometimes leads to incorrectly generated code or a debugger crash. While we cannot know for certain what triple a module constructed from an in-memory object file will have, we can use the triple from the target to try and fill in the missing details. Reviewers: clayborg, zturner, JDevlieghere, compnerd, aprantl, labath Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58405 llvm-svn: 354526
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index d247e6eb176..8ff01cb2560 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -309,6 +309,10 @@ ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
// file's architecture since it might differ in vendor/os if some
// parts were unknown.
m_arch = m_objfile_sp->GetArchitecture();
+
+ // Augment the arch with the target's information in case
+ // we are unable to extract the os/environment from memory.
+ m_arch.MergeFrom(process_sp->GetTarget().GetArchitecture());
} else {
error.SetErrorString("unable to find suitable object file plug-in");
}
OpenPOWER on IntegriCloud