[PATCH] D45566: [CodeGen/Dwarf] Make debug_names compatible with split-dwarf
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 18 05:15:35 PDT 2018
This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Closed by commit rL330249: [CodeGen/Dwarf] Make debug_names compatible with split-dwarf (authored by labath, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45566?vs=142159&id=142908#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45566
Files:
llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/test/DebugInfo/Generic/debug-names-one-cu.ll
Index: llvm/trunk/test/DebugInfo/Generic/debug-names-one-cu.ll
===================================================================
--- llvm/trunk/test/DebugInfo/Generic/debug-names-one-cu.ll
+++ llvm/trunk/test/DebugInfo/Generic/debug-names-one-cu.ll
@@ -3,6 +3,10 @@
; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
+; Now try the same with split dwarf.
+; RUN: %llc_dwarf -split-dwarf-file=foo.dwo -accel-tables=Dwarf -filetype=obj -o %t < %s
+; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
+
; Check the header
; CHECK: CU count: 1
; CHECK: Local TU count: 0
Index: llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -416,7 +416,9 @@
for (const auto &CU : enumerate(CompUnits)) {
assert(CU.index() == CU.value()->getUniqueID());
Asm->OutStreamer->AddComment("Compilation unit " + Twine(CU.index()));
- Asm->emitDwarfSymbolReference(CU.value()->getLabelBegin());
+ const DwarfCompileUnit *MainCU =
+ DD.useSplitDwarf() ? CU.value()->getSkeleton() : CU.value().get();
+ Asm->emitDwarfSymbolReference(MainCU->getLabelBegin());
}
}
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -339,6 +339,10 @@
/// Construct a DIE for this abstract scope.
void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &SrcCU, LexicalScope *Scope);
+ /// Helper function to add a name to the .debug_names table, using the
+ /// appropriate string pool.
+ void addAccelDebugName(StringRef Name, const DIE &Die);
+
void finishVariableDefinitions();
void finishSubprogramDefinitions();
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2267,6 +2267,13 @@
CU.addDIETypeSignature(RefDie, Signature);
}
+void DwarfDebug::addAccelDebugName(StringRef Name, const DIE &Die) {
+ assert(getAccelTableKind() == AccelTableKind::Dwarf);
+
+ DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
+ AccelDebugNames.addName(Holder.getStringPool().getEntry(*Asm, Name), Die);
+}
+
// Accelerator table mutators - add each name along with its companion
// DIE to the proper table while ensuring that the name that we're going
// to reference is in the string table. We do this since the names we
@@ -2277,8 +2284,7 @@
AccelNames.addName(InfoHolder.getStringPool().getEntry(*Asm, Name), &Die);
break;
case AccelTableKind::Dwarf:
- AccelDebugNames.addName(InfoHolder.getStringPool().getEntry(*Asm, Name),
- Die);
+ addAccelDebugName(Name, Die);
break;
case AccelTableKind::None:
return;
@@ -2300,8 +2306,7 @@
&Die);
break;
case AccelTableKind::Dwarf:
- AccelDebugNames.addName(InfoHolder.getStringPool().getEntry(*Asm, Name),
- Die);
+ addAccelDebugName(Name, Die);
break;
case AccelTableKind::None:
return;
@@ -2316,8 +2321,7 @@
AccelTypes.addName(InfoHolder.getStringPool().getEntry(*Asm, Name), &Die);
break;
case AccelTableKind::Dwarf:
- AccelDebugNames.addName(InfoHolder.getStringPool().getEntry(*Asm, Name),
- Die);
+ addAccelDebugName(Name, Die);
break;
case AccelTableKind::None:
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45566.142908.patch
Type: text/x-patch
Size: 3774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180418/f843ff79/attachment.bin>
More information about the llvm-commits
mailing list