[Lldb-commits] [lldb] 08748d1 - Fix a check that was attempting to see if an object file was in memory.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 18 13:24:31 PDT 2020


Author: Greg Clayton
Date: 2020-08-18T13:24:22-07:00
New Revision: 08748d15b8d696db9f894db38d74a212b8ab43e6

URL: https://github.com/llvm/llvm-project/commit/08748d15b8d696db9f894db38d74a212b8ab43e6
DIFF: https://github.com/llvm/llvm-project/commit/08748d15b8d696db9f894db38d74a212b8ab43e6.diff

LOG: Fix a check that was attempting to see if an object file was in memory.

Checking if an object file is in memory should use the ObjectFile::IsInMemory(), not test ObjectFile::BaseAddress(). ObjectFile::BaseAddress() is designed to be overridden by all classes and is for mach-o, ELF and COFF plug-ins. They find the header base adddress and return that as a section offset address. The default implementation of ObjectFile::BaseAddress() does try and make an Address() from the ObjectFile::m_memory_addr, but I switched it to a correct function call.

Differential Revision: https://reviews.llvm.org/D86122

Added: 
    

Modified: 
    lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index e7701c350ff5..babe5a384727 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1628,7 +1628,7 @@ void ObjectFileMachO::ProcessSegmentCommand(const load_command &load_cmd_,
   } else if (unified_section_sp) {
     if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
       // Check to see if the module was read from memory?
-      if (module_sp->GetObjectFile()->GetBaseAddress().IsValid()) {
+      if (module_sp->GetObjectFile()->IsInMemory()) {
         // We have a module that is in memory and needs to have its file
         // address adjusted. We need to do this because when we load a file
         // from memory, its addresses will be slid already, yet the addresses


        


More information about the lldb-commits mailing list