[PATCH] D71244: [DWARF5][DWARFVerifier] Check that Skeleton compilation unit does not have children.
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 04:55:27 PST 2019
avl updated this revision to Diff 233318.
avl edited the summary of this revision.
avl added a comment.
addressed comments(removed clang part, reworked testcase).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71244/new/
https://reviews.llvm.org/D71244
Files:
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/test/DebugInfo/X86/skeleton-unit-verify.ll
Index: llvm/test/DebugInfo/X86/skeleton-unit-verify.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/skeleton-unit-verify.ll
@@ -0,0 +1,65 @@
+; RUN: llc %s -mtriple=x86_64-linux -filetype=obj --split-dwarf-file=test.dwo -o %t
+; RUN: llvm-dwarfdump --verify %t | FileCheck %s
+; RUN: sed 's/splitDebugInlining: false/splitDebugInlining: true/' < %s > %t2
+; RUN: llc %t2 -mtriple=x86_64-linux -filetype=obj --split-dwarf-file=test.dwo -o %t1
+; RUN: not llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=CHECK-SINL %s
+
+; Hand-reduced from this example, test.cpp:
+;
+;void f1();
+;__attribute__((always_inline)) void f2() {
+; f1();
+;}
+;void f3() {
+; f2();
+;}
+;
+; clang++ -O3 -g -gdwarf-5 test.cpp
+
+; CHECK: No errors.
+; CHECK-SINL: error: Skeleton compilation unit has children.
+; CHECK-SINL: Errors detected.
+
+; ModuleID = 'test.cpp'
+source_filename = "test.cpp"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+; Function Attrs: alwaysinline uwtable
+define dso_local void @_Z2f2v() local_unnamed_addr #0 !dbg !11 {
+entry:
+ tail call void @_Z2f1v(), !dbg !12
+ ret void, !dbg !13
+}
+declare !dbg !4 dso_local void @_Z2f1v() local_unnamed_addr #1
+; Function Attrs: uwtable
+define dso_local void @_Z2f3v() local_unnamed_addr #1 !dbg !14 {
+entry:
+ tail call void @_Z2f1v(), !dbg !15
+ ret void, !dbg !17
+}
+
+attributes #0 = { alwaysinline nounwind readnone speculatable willreturn }
+attributes #1 = { nounwind readnone speculatable willreturn }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!7, !8, !9}
+!llvm.ident = !{!10}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "test.cpp", directory: "test-split-dwarf", checksumkind: CSK_MD5, checksum: "b6f70d9f08417d5bfeb4d1b3ee3ea3af")
+!2 = !{}
+!3 = !{!4}
+!4 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
+!5 = !DISubroutineType(types: !6)
+!6 = !{null}
+!7 = !{i32 7, !"Dwarf Version", i32 5}
+!8 = !{i32 2, !"Debug Info Version", i32 3}
+!9 = !{i32 1, !"wchar_size", i32 4}
+!10 = !{!"clang version"}
+!11 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !5, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
+!12 = !DILocation(line: 3, column: 3, scope: !11)
+!13 = !DILocation(line: 4, column: 1, scope: !11)
+!14 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
+!15 = !DILocation(line: 3, column: 3, scope: !11, inlinedAt: !16)
+!16 = distinct !DILocation(line: 6, column: 3, scope: !14)
+!17 = !DILocation(line: 7, column: 1, scope: !14)
Index: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -196,6 +196,14 @@
NumUnitErrors++;
}
+ // According to DWARF Debugging Information Format Version 5,
+ // 3.1.2 Skeleton Compilation Unit Entries:
+ // "A skeleton compilation unit has no children."
+ if (Die.getTag() == dwarf::DW_TAG_skeleton_unit && Die.hasChildren()) {
+ error() << "Skeleton compilation unit has children.\n";
+ NumUnitErrors++;
+ }
+
DieRangeInfo RI;
NumUnitErrors += verifyDieRanges(Die, RI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71244.233318.patch
Type: text/x-patch
Size: 3934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191211/28d90038/attachment.bin>
More information about the llvm-commits
mailing list