[PATCH] D87022: [DebugInfo] Fix emitting DWARF64 .debug_addr sections (15/19).

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


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

The patch fixes emitting the header of the table. The content is independent of the DWARF format.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87022

Files:
  llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
  llvm/test/DebugInfo/X86/debug-addr-dwarf64.ll


Index: llvm/test/DebugInfo/X86/debug-addr-dwarf64.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/debug-addr-dwarf64.ll
@@ -0,0 +1,28 @@
+; This checks that .debug_addr can be generated in the DWARF64 format.
+
+; RUN: llc -mtriple=x86_64 -dwarf-version=5 -dwarf64 -filetype=obj %s -o %t
+; RUN: llvm-dwarfdump -debug-info -debug-addr %t | FileCheck %s
+
+; CHECK:      .debug_info contents:
+; CHECK:      DW_TAG_compile_unit
+; CHECK:        DW_AT_addr_base (0x0000000000000010)
+
+; CHECK:      .debug_addr contents:
+; CHECK-NEXT: Address table header: length = 0x000000000000000c, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00
+; CHECK-NEXT: Addrs: [
+; CHECK-NEXT: 0x0000000000000004
+; CHECK-NEXT: ]
+
+ at foo = common dso_local global i32 0, align 4, !dbg !5
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = !DIFile(filename: "foo.c", directory: "/tmp")
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Manual", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4, splitDebugInlining: false, nameTableKind: None)
+!3 = !{}
+!4 = !{!5}
+!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
+!6 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true)
+!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
Index: llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -29,9 +29,7 @@
   MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start");
   MCSymbol *EndLabel = Asm.createTempSymbol(Prefix + "end");
 
-  Asm.OutStreamer->AddComment("Length of contribution");
-  Asm.emitLabelDifference(EndLabel, BeginLabel,
-                          4); // TODO: Support DWARF64 format.
+  Asm.emitDwarfUnitLength(EndLabel, BeginLabel, "Length of contribution");
   Asm.OutStreamer->emitLabel(BeginLabel);
   Asm.OutStreamer->AddComment("DWARF version number");
   Asm.emitInt16(Asm.getDwarfVersion());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87022.289427.patch
Type: text/x-patch
Size: 2251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200902/3aa23381/attachment.bin>


More information about the llvm-commits mailing list