[PATCH] D87019: [DebugInfo] Fix emitting DWARF64 .debug_rnglists sections (12/19).

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 06:22:49 PDT 2020


ikudrin created this revision.
ikudrin added reviewers: dblaikie, jhenderson, probinson, aprantl.
ikudrin added projects: LLVM, debug-info.
Herald added a subscriber: hiraditya.
ikudrin requested review of this revision.

The size of the offsets in the table depends on the DWARF format.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87019

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll


Index: llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
===================================================================
--- llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
+++ llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll
@@ -1,22 +1,34 @@
-; RUN: llc -split-dwarf-file=foo.dwo -mtriple=x86_64-unknown-linux-gnu -filetype=obj < %s \
-; RUN: 	    | llvm-dwarfdump -v -debug-info -debug-rnglists - | FileCheck %s
+; RUN: llc -split-dwarf-file=foo.dwo -mtriple=x86_64-unknown-linux-gnu -filetype=obj %s -o %t32
+; RUN: llvm-dwarfdump -v -debug-info -debug-rnglists %t32 | \
+; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF32
 
-; CHECK: .debug_info contents:
-; CHECK: .debug_info.dwo contents:
-; CHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000010
-; CHECK:          [0x0000000000000001, 0x000000000000000c) ".text"
-; CHECK:          [0x000000000000000e, 0x0000000000000013) ".text")
+; RUN: llc -dwarf64 -split-dwarf-file=foo.dwo -mtriple=x86_64-unknown-linux-gnu -filetype=obj %s -o %t64
+; RUN: llvm-dwarfdump -v -debug-info -debug-rnglists %t64 | \
+; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF64
 
-; CHECK: .debug_rnglists.dwo contents:
-; CHECK: 0x00000000: range list header: length = 0x00000015, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
-; CHECK: offsets: [
-; CHECK: 0x00000004 => 0x00000010
-; CHECK: ]
-; CHECK: ranges:
-; CHECK: 0x00000010: [DW_RLE_base_addressx]:  0x0000000000000000
-; CHECK: 0x00000012: [DW_RLE_offset_pair  ]:  0x0000000000000001, 0x000000000000000c => [0x0000000000000001, 0x000000000000000c)
-; CHECK: 0x00000015: [DW_RLE_offset_pair  ]:  0x000000000000000e, 0x0000000000000013 => [0x000000000000000e, 0x0000000000000013)
-; CHECK: 0x00000018: [DW_RLE_end_of_list  ]
+; CHECK:   .debug_info contents:
+; CHECK:   .debug_info.dwo contents:
+; DWARF32: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x00000010
+; DWARF64: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x0000001c
+; CHECK:      [0x0000000000000001, 0x000000000000000c) ".text"
+; CHECK:      [0x000000000000000e, 0x0000000000000013) ".text")
+
+; CHECK:   .debug_rnglists.dwo contents:
+; DWARF32: 0x00000000: range list header: length = 0x00000015, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
+; DWARF64: 0x00000000: range list header: length = 0x0000000000000019, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
+; CHECK:   offsets: [
+; DWARF32: 0x00000004 => 0x00000010
+; DWARF64: 0x0000000000000008 => 0x0000001c
+; CHECK:   ]
+; CHECK:   ranges:
+; DWARF32: 0x00000010: [DW_RLE_base_addressx]:  0x0000000000000000
+; DWARF32: 0x00000012: [DW_RLE_offset_pair  ]:  0x0000000000000001, 0x000000000000000c => [0x0000000000000001, 0x000000000000000c)
+; DWARF32: 0x00000015: [DW_RLE_offset_pair  ]:  0x000000000000000e, 0x0000000000000013 => [0x000000000000000e, 0x0000000000000013)
+; DWARF32: 0x00000018: [DW_RLE_end_of_list  ]
+; DWARF64: 0x0000001c: [DW_RLE_base_addressx]:  0x0000000000000000
+; DWARF64: 0x0000001e: [DW_RLE_offset_pair  ]:  0x0000000000000001, 0x000000000000000c => [0x0000000000000001, 0x000000000000000c)
+; DWARF64: 0x00000021: [DW_RLE_offset_pair  ]:  0x000000000000000e, 0x0000000000000013 => [0x000000000000000e, 0x0000000000000013)
+; DWARF64: 0x00000024: [DW_RLE_end_of_list  ]
 
 ; Function Attrs: noinline optnone uwtable
 define dso_local void @_Z2f3v() !dbg !7 {
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2549,7 +2549,8 @@
   Asm->OutStreamer->emitLabel(Holder.getRnglistsTableBaseSym());
 
   for (const RangeSpanList &List : Holder.getRangeLists())
-    Asm->emitLabelDifference(List.Label, Holder.getRnglistsTableBaseSym(), 4);
+    Asm->emitLabelDifference(List.Label, Holder.getRnglistsTableBaseSym(),
+                             Asm->getDwarfOffsetByteSize());
 
   return TableEnd;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87019.289424.patch
Type: text/x-patch
Size: 4149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200902/5568700a/attachment.bin>


More information about the llvm-commits mailing list