[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] Set the Section's file address for ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set

Nitesh Jain via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 14 02:11:36 PDT 2017


nitesh.jain updated this revision to Diff 110924.
nitesh.jain retitled this revision from "[LLDB][MIPS] The symbol with NOTYPE and having section type debug doesn't contain any valid address" to "[LLDB][MIPS] Set the Section's file address for ELF section to LLDB_INVALID_ADDRESS if SHF_ALLOC is not set".
nitesh.jain edited the summary of this revision.
nitesh.jain added a comment.

Update diff as per suggestion. Thanks Greg for your suggestion.

Thanks,
Nitesh


https://reviews.llvm.org/D35784

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp


Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1987,7 +1987,9 @@
               ? m_arch_spec.GetDataByteSize()
               : eSectionTypeCode == sect_type ? m_arch_spec.GetCodeByteSize()
                                               : 1;
-
+      const addr_t sect_file_addr = header.sh_flags & SHF_ALLOC
+                                                    ? header.sh_addr
+                                                    : LLDB_INVALID_ADDRESS;
       elf::elf_xword log2align =
           (header.sh_addralign == 0) ? 0 : llvm::Log2_64(header.sh_addralign);
       SectionSP section_sp(new Section(
@@ -1997,7 +1999,7 @@
           SectionIndex(I),     // Section ID.
           name,                // Section name.
           sect_type,           // Section type.
-          header.sh_addr,      // VM address.
+          sect_file_addr,      // VM address.
           vm_size,             // VM size in bytes of this section.
           header.sh_offset,    // Offset of this section in the file.
           file_size,           // Size of the section as found in the file.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35784.110924.patch
Type: text/x-patch
Size: 1274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170814/b51dfb78/attachment.bin>


More information about the lldb-commits mailing list