[PATCH] D53564: [llvm-dwarfdump] - Fix incorrect parsing of the DW_LLE_startx_length

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 05:48:39 PDT 2018


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

As was already mentioned in comments for https://reviews.llvm.org/D53364, DWARF 5 spec says about:

DW_LLE_startx_length: "This is a form of bounded location description that has two unsigned ULEB operands.
The first value is an address index (into the .debug_addr section) that indicates the beginning of the address range
over which the location is valid. The second value is the length of the range. ")

Currently, the length is parsed as U32, the patch fixes the issue.


https://reviews.llvm.org/D53564

Files:
  lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  test/tools/llvm-dwarfdump/X86/debug_loc_dwo.s


Index: test/tools/llvm-dwarfdump/X86/debug_loc_dwo.s
===================================================================
--- test/tools/llvm-dwarfdump/X86/debug_loc_dwo.s
+++ test/tools/llvm-dwarfdump/X86/debug_loc_dwo.s
@@ -14,7 +14,7 @@
 # end_of_list), which is what llvm generates as well.
 .byte 3          # DW_LLE_startx_length
 .byte 0x01       # Index
-.long 0x10       # Length
+.uleb128 0x10    # Length
 .short 1         # Loc expr size
 .byte 85         # DW_OP_reg5
 .byte 0          # DW_LLE_end_of_list
Index: lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
@@ -158,7 +158,7 @@
     switch (Kind) {
     case dwarf::DW_LLE_startx_length:
       E.Value0 = Data.getULEB128(Offset);
-      E.Value1 = Data.getU32(Offset);
+      E.Value1 = Data.getULEB128(Offset);
       break;
     case dwarf::DW_LLE_start_length:
       E.Value0 = Data.getAddress(Offset);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53564.170615.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/5875ce86/attachment.bin>


More information about the llvm-commits mailing list