[Lldb-commits] [lldb] r354526 - Merge target triple into module triple when constructing module from memory

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 20 15:12:56 PST 2019


Author: xiaobai
Date: Wed Feb 20 15:12:56 2019
New Revision: 354526

URL: http://llvm.org/viewvc/llvm-project?rev=354526&view=rev
Log:
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

Modified:
    lldb/trunk/source/Core/Module.cpp

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=354526&r1=354525&r2=354526&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Feb 20 15:12:56 2019
@@ -309,6 +309,10 @@ ObjectFile *Module::GetMemoryObjectFile(
           // 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");
         }




More information about the lldb-commits mailing list