kbaladurin created this revision. kbaladurin added a reviewer: clayborg. kbaladurin added a project: LLDB. Herald added subscribers: llvm-commits, kristof.beyls, arichardson, emaste.
ObjectFileELF assumes that code section has ".text" name. There is an exception for kalimba toolchain that can use arbitrary names, but other toolchains also could use arbitrary names for code sections. For example, corert <https://github.com/dotnet/corert> uses separate section for compiled managed code. As lldb doesn't recognize such section it leads to problem with breakpoints on arm, because debugger cannot determine instruction set (arm/thumb) and uses incorrect breakpoint opcode that breaks program execution. This change allows debugger to correctly handle such code sections. We assume that section is a code section if it has SHF_EXECINSTR flag set and has SHT_PROGBITS type. Repository: rL LLVM https://reviews.llvm.org/D44998 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 @@ -1947,6 +1947,12 @@ sect_type = kalimbaSectionType(m_header, header); } + if (eSectionTypeOther == sect_type && + llvm::ELF::SHT_PROGBITS == header.sh_type && + (header.sh_flags & SHF_EXECINSTR)) { + sect_type = eSectionTypeCode; + } + const uint32_t target_bytes_size = (eSectionTypeData == sect_type || eSectionTypeZeroFill == sect_type) ? m_arch_spec.GetDataByteSize()
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1947,6 +1947,12 @@ sect_type = kalimbaSectionType(m_header, header); } + if (eSectionTypeOther == sect_type && + llvm::ELF::SHT_PROGBITS == header.sh_type && + (header.sh_flags & SHF_EXECINSTR)) { + sect_type = eSectionTypeCode; + } + const uint32_t target_bytes_size = (eSectionTypeData == sect_type || eSectionTypeZeroFill == sect_type) ? m_arch_spec.GetDataByteSize()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits