[PATCH] D55113: [llvm-dwarfdump] - Stop printing the bogus empty section name on invalid dwarf.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 30 03:11:22 PST 2018


grimar created this revision.
grimar added a reviewer: dblaikie.
Herald added subscribers: JDevlieghere, aprantl.

When there is no `.debug_addr` section for some reason,
llvm-dwarfdump would print the bogus empty section name when dumping ranges
in `.debug_info`:

  # CHECK:       DW_AT_ranges [DW_FORM_rnglistx]   (indexed (0x0) rangelist = 0x00000004
  # CHECK-NEXT:    [0x0000000000000000, 0x0000000000000001) ""
  # CHECK-NEXT:    [0x0000000000000000, 0x0000000000000002) "")

That happens because of the code which uses `0` (zero) as a section index as a default value.
The code should use `-1ULL` instead because technically `0` is a valid zero section index
in ELF and `-1ULL` is a special constant used that means "no section available".

This is mostly a fix for the overall correctness/safety of the code, but a test case is provided too.


https://reviews.llvm.org/D55113

Files:
  lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
  test/tools/llvm-dwarfdump/X86/no_debug_addr.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55113.176073.patch
Type: text/x-patch
Size: 10101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181130/5b9f8ec6/attachment-0001.bin>


More information about the llvm-commits mailing list