Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -3539,7 +3539,7 @@ bool SplitDWARFInlining = Args.hasFlag(options::OPT_fsplit_dwarf_inlining, - options::OPT_fno_split_dwarf_inlining, true); + options::OPT_fno_split_dwarf_inlining, false); Args.ClaimAllArgs(options::OPT_g_Group); Index: clang/test/Driver/split-debug.c =================================================================== --- clang/test/Driver/split-debug.c +++ clang/test/Driver/split-debug.c @@ -79,7 +79,7 @@ // CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited" // CHECK-SPLIT-WITH-NOINL: "-split-dwarf-output" -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -fsplit-dwarf-inlining -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s // // CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only" 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); Index: llvm/test/DebugInfo/skeleton-unit-verify.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/skeleton-unit-verify.ll @@ -0,0 +1,86 @@ +; RUN: llc %s -mtriple=x86_64-linux -filetype=obj -split-dwarf-cross-cu-references --split-dwarf-file=test.dwo -O3 -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-cross-cu-references --split-dwarf-file=test.dwo -O3 -o %t1 +; RUN: not llvm-dwarfdump --verify %t1 | FileCheck --check-prefix=CHECK-SINL %s + +; Hand-reduced from this example, test.cpp: +; +;int foo ( int p1 ) { +; return p1 + 10; +;} +; +;int bar ( int p1 ) { +; return foo(p1); +;} +; +;int main ( void ) { +; return bar(100); +;} +; +; clang++ -O3 -g -gdwarf-5 test.cpp -gno-column-info + +; 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: norecurse nounwind readnone uwtable +define dso_local i32 @_Z3fooi(i32 %p1) local_unnamed_addr #0 !dbg !7 { +entry: + call void @llvm.dbg.value(metadata i32 %p1, metadata !12, metadata !DIExpression()), !dbg !13 + %add = add nsw i32 %p1, 10, !dbg !14 + ret i32 %add, !dbg !14 +} +; Function Attrs: norecurse nounwind readnone uwtable +define dso_local i32 @_Z3bari(i32 %p1) local_unnamed_addr #0 !dbg !15 { +entry: + call void @llvm.dbg.value(metadata i32 %p1, metadata !17, metadata !DIExpression()), !dbg !18 + call void @llvm.dbg.value(metadata i32 %p1, metadata !12, metadata !DIExpression()), !dbg !19 + %add.i = add nsw i32 %p1, 10, !dbg !21 + ret i32 %add.i, !dbg !22 +} +; Function Attrs: norecurse nounwind readnone uwtable +define dso_local i32 @main() local_unnamed_addr #0 !dbg !23 { +entry: + ret i32 110, !dbg !26 +} +; Function Attrs: nounwind readnone speculatable willreturn +declare void @llvm.dbg.value(metadata, metadata, metadata) #0 + +attributes #0 = { nounwind readnone speculatable willreturn } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!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, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "test.cpp", directory: "test-split-dwarf", checksumkind: CSK_MD5, checksum: "189325d7ad5cd481bc7a631dac6345be") +!2 = !{} +!3 = !{i32 7, !"Dwarf Version", i32 5} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang version 10.0.0"} +!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) +!8 = !DISubroutineType(types: !9) +!9 = !{!10, !10} +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!11 = !{!12} +!12 = !DILocalVariable(name: "p1", arg: 1, scope: !7, file: !1, line: 2, type: !10) +!13 = !DILocation(line: 0, scope: !7) +!14 = !DILocation(line: 3, scope: !7) +!15 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !16) +!16 = !{!17} +!17 = !DILocalVariable(name: "p1", arg: 1, scope: !15, file: !1, line: 6, type: !10) +!18 = !DILocation(line: 0, scope: !15) +!19 = !DILocation(line: 0, scope: !7, inlinedAt: !20) +!20 = distinct !DILocation(line: 7, scope: !15) +!21 = !DILocation(line: 3, scope: !7, inlinedAt: !20) +!22 = !DILocation(line: 7, scope: !15) +!23 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 10, type: !24, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!24 = !DISubroutineType(types: !25) +!25 = !{!10} +!26 = !DILocation(line: 11, scope: !23)