[PATCH] D87013: [DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (12/19).
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 07:49:59 PDT 2020
ikudrin updated this revision to Diff 289722.
ikudrin marked an inline comment as done.
ikudrin retitled this revision from "[DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (6/19)." to "[DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (12/19).".
ikudrin added a comment.
- Extended the test. Note that this change required rearranging the patches in the set so that this patch comes after the patches for DWARF units.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87013/new/
https://reviews.llvm.org/D87013
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/X86/debug-pubtables-dwarf64.ll
Index: llvm/test/DebugInfo/X86/debug-pubtables-dwarf64.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/debug-pubtables-dwarf64.ll
@@ -0,0 +1,41 @@
+; This checks that .debug_pubnames and .debug_pubtypes can be generated in the DWARF64 format.
+
+; RUN: llc -mtriple=x86_64 -dwarf64 -filetype=obj %s -o %t
+; RUN: llvm-dwarfdump -debug-info -debug-pubnames -debug-pubtypes %t | FileCheck %s
+
+; CHECK: .debug_info contents:
+; CHECK: 0x[[VAR:.+]]: DW_TAG_variable
+; CHECK-NEXT: DW_AT_name ("foo")
+; CHECK: 0x[[STRUCT:.+]]: DW_TAG_structure_type
+; CHECK-NEXT: DW_AT_name ("Foo")
+; CHECK: 0x[[BASET:.+]]: DW_TAG_base_type
+; CHECK-NEXT: DW_AT_name ("int")
+
+; CHECK: .debug_pubnames contents:
+; CHECK-NEXT: length = 0x0000000000000026, format = DWARF64, version = 0x0002, unit_offset =
+; CHECK-NEXT: Offset Name
+; CHECK-NEXT: 0x00000000[[VAR]] "foo"
+
+; CHECK: .debug_pubtypes contents:
+; CHECK-NEXT: length = 0x0000000000000032, format = DWARF64, version = 0x0002, unit_offset =
+; CHECK-NEXT: Offset Name
+; CHECK-NEXT: 0x00000000[[STRUCT]] "Foo"
+; CHECK-NEXT: 0x00000000[[BASET]] "int"
+
+%struct.Foo = type { i32 }
+ at foo = common dso_local global %struct.Foo zeroinitializer, 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: Default)
+!3 = !{}
+!4 = !{!5}
+!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
+!6 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
+!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, size: 32, elements: !8, identifier: "_ZTS3Foo")
+!8 = !{!9}
+!9 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !7, file: !1, line: 1, baseType: !10, size: 32)
+!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2336,10 +2336,10 @@
TheU = Skeleton;
// Emit the header.
- Asm->OutStreamer->AddComment("Length of Public " + Name + " Info");
MCSymbol *BeginLabel = Asm->createTempSymbol("pub" + Name + "_begin");
MCSymbol *EndLabel = Asm->createTempSymbol("pub" + Name + "_end");
- Asm->emitLabelDifference(EndLabel, BeginLabel, 4);
+ Asm->emitDwarfUnitLength(EndLabel, BeginLabel,
+ "Length of Public " + Name + " Info");
Asm->OutStreamer->emitLabel(BeginLabel);
@@ -2350,7 +2350,7 @@
emitSectionReference(*TheU);
Asm->OutStreamer->AddComment("Compilation Unit Length");
- Asm->emitInt32(TheU->getLength());
+ Asm->emitDwarfLengthOrOffset(TheU->getLength());
// Emit the pubnames for this compilation unit.
for (const auto &GI : Globals) {
@@ -2358,7 +2358,7 @@
const DIE *Entity = GI.second;
Asm->OutStreamer->AddComment("DIE offset");
- Asm->emitInt32(Entity->getOffset());
+ Asm->emitDwarfLengthOrOffset(Entity->getOffset());
if (GnuStyle) {
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheU, Entity);
@@ -2373,7 +2373,7 @@
}
Asm->OutStreamer->AddComment("End Mark");
- Asm->emitInt32(0);
+ Asm->emitDwarfLengthOrOffset(0);
Asm->OutStreamer->emitLabel(EndLabel);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87013.289722.patch
Type: text/x-patch
Size: 3779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200903/201d16d1/attachment.bin>
More information about the llvm-commits
mailing list