[DWARF] - Take relocations in account when extracting ranges from .debug_ranges
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 24 Apr 2017 10:19:45 +0000 (10:19 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 24 Apr 2017 10:19:45 +0000 (10:19 +0000)
commitca53211beb5e552ed1c661844f333726eca8fd50
tree81a65785491f6dfd449043c21bac08dfb99867f5
parentdf0497c4aaabd119d5d835bce6339be8fed58602
[DWARF] - Take relocations in account when extracting ranges from .debug_ranges

I found this when investigated "Bug 32319 - .gdb_index is broken/incomplete" for LLD.

When we have object file with .debug_ranges section it may be filled with zeroes.
Relocations are exist in file to relocate this zeroes into real values later, but until that
a pair of zeroes is treated as terminator. And DWARF parser thinks there is no ranges at all
when I am trying to collect address ranges for building .gdb_index.

Solution implemented in this patch is to take relocations in account when parsing ranges.

Differential revision: https://reviews.llvm.org/D32228

llvm-svn: 301170
llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/test/DebugInfo/dwarfdump-ranges-unrelocated.s [new file with mode: 0644]
llvm/tools/dsymutil/DwarfLinker.cpp