diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-12-20 20:46:55 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-12-20 20:46:55 +0000 |
commit | b3c56af49b54a4f6a8899d9cd198ce4da4ec15c0 (patch) | |
tree | dece5d398bd58dd8b7beed5bf5adbfe200a78bf8 | |
parent | dcc8fc9e985f16a6df878ec0ff7212e0a2da0c8f (diff) | |
download | bcm5719-llvm-b3c56af49b54a4f6a8899d9cd198ce4da4ec15c0.tar.gz bcm5719-llvm-b3c56af49b54a4f6a8899d9cd198ce4da4ec15c0.zip |
DebugInfo: Fix for missing comp_dir handling with r349207
When deciding lazily whether a CU would be split or non-split I
accidentally dropped some handling for the line tables comp_dir (by
doing it lazily it was too late to be handled properly by the MC line
table code).
Move that bit of the code back to the non-lazy place.
llvm-svn: 349819
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 19 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/lazy-fission-comp-dir.ll | 32 |
2 files changed, 42 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 2d8c9e49738..71fbfaa567c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -573,15 +573,6 @@ void DwarfDebug::finishUnitAttributes(const DICompileUnit *DIUnit, DIE &Die = NewCU.getUnitDie(); StringRef FN = DIUnit->getFilename(); - // LTO with assembly output shares a single line table amongst multiple CUs. - // To avoid the compilation directory being ambiguous, let the line table - // explicitly describe the directory of all files, never relying on the - // compilation directory. - if (!Asm->OutStreamer->hasRawTextSupport() || SingleCU) - Asm->OutStreamer->emitDwarfFile0Directive( - CompilationDir, FN, NewCU.getMD5AsBytes(DIUnit->getFile()), - DIUnit->getSource(), NewCU.getUniqueID()); - StringRef Producer = DIUnit->getProducer(); StringRef Flags = DIUnit->getFlags(); if (!Flags.empty() && !useAppleExtensionAttributes()) { @@ -649,6 +640,16 @@ DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) { for (auto *IE : DIUnit->getImportedEntities()) NewCU.addImportedEntity(IE); + // LTO with assembly output shares a single line table amongst multiple CUs. + // To avoid the compilation directory being ambiguous, let the line table + // explicitly describe the directory of all files, never relying on the + // compilation directory. + if (!Asm->OutStreamer->hasRawTextSupport() || SingleCU) + Asm->OutStreamer->emitDwarfFile0Directive( + CompilationDir, DIUnit->getFilename(), + NewCU.getMD5AsBytes(DIUnit->getFile()), DIUnit->getSource(), + NewCU.getUniqueID()); + if (useSplitDwarf()) { NewCU.setSkeleton(constructSkeletonCU(NewCU)); NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoDWOSection()); diff --git a/llvm/test/DebugInfo/X86/lazy-fission-comp-dir.ll b/llvm/test/DebugInfo/X86/lazy-fission-comp-dir.ll new file mode 100644 index 00000000000..6055e7ecd3e --- /dev/null +++ b/llvm/test/DebugInfo/X86/lazy-fission-comp-dir.ll @@ -0,0 +1,32 @@ +; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t +; RUN: llvm-dwarfdump -debug-info -debug-line %t | FileCheck %s + +; CHECK: .debug_info contents: +; CHECK: DW_AT_comp_dir ("/usr/local/google/home/blaikie/dev/scratch") + +; CHECK: .debug_line contents: +; CHECK: file_names[ 1]: +; CHECK-NEXT: name: "main.c" +; CHECK-NEXT: dir_index: 0 + +; Function Attrs: noinline nounwind optnone uwtable +define dso_local i32 @main() !dbg !6 { +entry: + ret i32 0, !dbg !10 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} +!llvm.ident = !{!5} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 (trunk 349782) (llvm/trunk 349794)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: GNU) +!1 = !DIFile(filename: "main.c", directory: "/usr/local/google/home/blaikie/dev/scratch") +!2 = !{} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!4 = !{i32 1, !"wchar_size", i32 4} +!5 = !{!"clang version 8.0.0 (trunk 349782) (llvm/trunk 349794)"} +!6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) +!7 = !DISubroutineType(types: !8) +!8 = !{!9} +!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!10 = !DILocation(line: 2, column: 1, scope: !6) |