[Lldb-commits] [PATCH] D55422: Rename ObjectFile::GetHeaderAddress to GetBaseAddress

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 7 03:23:10 PST 2018

labath marked an inline comment as done.
labath added a comment.

Adding a bunch of people to make sure this makes sense for all object formats (I am particularly oblivious to how COFF works). If this makes sense, I'll implement this function in ObjectFilePECOFF and ELF to return the "image base" and "base address" respectively.

Comment at: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:1676-1677
     if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
       // Check to see if the module was read from memory?
-      if (module_sp->GetObjectFile()->GetHeaderAddress().IsValid()) {
+      if (module_sp->GetObjectFile()->GetBaseAddress().IsValid()) {
         // We have a module that is in memory and needs to have its file
This is the most dodgy usage I believe. It looks like this piece of code is expecting to use the base ObjectFile implementation of this function, which returns the `m_memory_addr` member. However, this will in reality call the MachO implementation which does something completely different (and independent of being in memory). It might be better to change this to `GetObjectFile()->IsInMemory()`, but I have no idea how to verify that.



More information about the lldb-commits mailing list