From c7f29dc068c54ff74ced4653f6d0b25a3cf6b429 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 17 Mar 2014 23:29:40 +0000 Subject: DebugInfo: Move line table zero-directory-index (compilation dir) handling into MCDwarf Our handling of compilation directory in DwarfDebug was broken (incorrectly using the 'last' compilation directory (that of the last CU in the metadata list) for all function emission in any CU). By moving this handling down into MCDwarf the issue is fixed as the compilation dir is tracked correctly per line table. llvm-svn: 204089 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 ++---- llvm/lib/MC/MCDwarf.cpp | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 4791e6d5ade..5b05ee1f735 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -679,10 +679,6 @@ unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName, StringRef DirName, if (Asm->OutStreamer.hasRawTextSupport()) CUID = 0; - // TODO: this might not belong here. See if we can factor this better. - if (DirName == CompilationDir) - DirName = ""; - // Print out a .file directive to specify files for .loc directives. return Asm->OutStreamer.EmitDwarfFileDirective(0, DirName, FileName, CUID); } @@ -704,6 +700,8 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) { DwarfCompileUnit *NewCU = new DwarfCompileUnit( InfoHolder.getUnits().size(), Die, DIUnit, Asm, this, &InfoHolder); InfoHolder.addUnit(NewCU); + Asm->OutStreamer.getContext().setMCLineTableCompilationDir( + NewCU->getUniqueID(), CompilationDir); NewCU->addString(Die, dwarf::DW_AT_producer, DIUnit.getProducer()); NewCU->addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2, diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index edeee20ab47..f5260952c7a 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -340,6 +340,8 @@ unsigned MCDwarfLineTable::getFile(StringRef &Directory, StringRef &FileName, unsigned MCDwarfLineTableHeader::getFile(StringRef &Directory, StringRef &FileName, unsigned FileNumber) { + if (Directory == CompilationDir) + Directory = ""; if (FileName.empty()) { FileName = ""; Directory = ""; -- cgit v1.2.3