[PATCH] D32228: [DWARF] - Take relocations in account when exctracting ranges from .debug_ranges

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 08:27:02 PDT 2017


grimar created this revision.
Herald added a subscriber: aprantl.

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.
FWIW DWARFFormValue::extractValue() already do that for calculating DW_AT_low_pc/DW_AT_high_pc,
when ranges are not involved. So solution seems to be consistent with existent code.


https://reviews.llvm.org/D32228

Files:
  include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
  include/llvm/DebugInfo/DWARF/DWARFContext.h
  include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
  include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
  include/llvm/DebugInfo/DWARF/DWARFUnit.h
  lib/DebugInfo/DWARF/DWARFContext.cpp
  lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
  lib/DebugInfo/DWARF/DWARFUnit.cpp
  test/DebugInfo/dwarfdump-ranges-unrelocated.s
  tools/dsymutil/DwarfLinker.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32228.95752.patch
Type: text/x-patch
Size: 17489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/cd8b278d/attachment.bin>


More information about the llvm-commits mailing list