aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2012-12-19 22:02:53 +0000
committerEric Christopher <echristo@gmail.com>2012-12-19 22:02:53 +0000
commit6eebe47060eec7e3a4ae95d4b4835869108f9c07 (patch)
tree9341e78f009f9d7dde5d00bfc091f912fd240681 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent37a942cd52725b1d390989a8267a764b42fcb5d3 (diff)
downloadexternal_llvm-6eebe47060eec7e3a4ae95d4b4835869108f9c07.zip
external_llvm-6eebe47060eec7e3a4ae95d4b4835869108f9c07.tar.gz
external_llvm-6eebe47060eec7e3a4ae95d4b4835869108f9c07.tar.bz2
Split out abbreviations for the skeleton info from the rest of
the abbreviations. Part of implementing split dwarf. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp63
1 files changed, 45 insertions, 18 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 73502f2..f058020 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -158,12 +158,15 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
SourceIdMap(DIEValueAllocator), StringPool(DIEValueAllocator),
PrevLabel(NULL), GlobalCUIndexCount(0),
InfoHolder(A, &AbbreviationsSet, &Abbreviations),
- SkeletonCU(0), SkeletonHolder(A, &AbbreviationsSet, &Abbreviations) {
+ SkeletonCU(0),
+ SkeletonAbbrevSet(InitAbbreviationsSetSize),
+ SkeletonHolder(A, &SkeletonAbbrevSet, &SkeletonAbbrevs) {
NextStringPoolNumber = 0;
DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
DwarfStrSectionSym = TextSectionSym = 0;
DwarfDebugRangeSectionSym = DwarfDebugLocSectionSym = 0;
+ DwarfAbbrevDWOSectionSym = 0;
FunctionBeginSym = FunctionEndSym = 0;
// Turn on accelerator tables and older gdb compatibility
@@ -944,6 +947,7 @@ void DwarfDebug::endModule() {
// Corresponding abbreviations into a abbrev section.
emitAbbreviations();
+ emitDebugAbbrevDWO();
// Emit info into a debug loc section.
emitDebugLoc();
@@ -1705,6 +1709,10 @@ void DwarfDebug::emitSectionLabels() {
emitSectionSym(Asm, TLOF.getDwarfInfoSection(), "section_info");
DwarfAbbrevSectionSym =
emitSectionSym(Asm, TLOF.getDwarfAbbrevSection(), "section_abbrev");
+ if (useSplitDwarf())
+ DwarfAbbrevDWOSectionSym =
+ emitSectionSym(Asm, TLOF.getDwarfAbbrevDWOSection(),
+ "section_abbrev_dwo");
emitSectionSym(Asm, TLOF.getDwarfARangesSection());
if (const MCSection *MacroInfo = TLOF.getDwarfMacroInfoSection())
@@ -1726,10 +1734,10 @@ void DwarfDebug::emitSectionLabels() {
}
// Recursively emits a debug information entry.
-void DwarfDebug::emitDIE(DIE *Die) {
+void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
// Get the abbreviation for this DIE.
unsigned AbbrevNumber = Die->getAbbrevNumber();
- const DIEAbbrev *Abbrev = Abbreviations[AbbrevNumber - 1];
+ const DIEAbbrev *Abbrev = Abbrevs->at(AbbrevNumber - 1);
// Emit the code (index) for the abbreviation.
if (Asm->isVerbose())
@@ -1806,7 +1814,7 @@ void DwarfDebug::emitDIE(DIE *Die) {
const std::vector<DIE *> &Children = Die->getChildren();
for (unsigned j = 0, M = Children.size(); j < M; ++j)
- emitDIE(Children[j]);
+ emitDIE(Children[j], Abbrevs);
if (Asm->isVerbose())
Asm->OutStreamer.AddComment("End Of Children Mark");
@@ -1847,7 +1855,7 @@ void DwarfUnits::emitUnits(DwarfDebug *DD,
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
- DD->emitDIE(Die);
+ DD->emitDIE(Die, Abbreviations);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(USection->getLabelEndName(),
TheCU->getUniqueID()));
}
@@ -1864,19 +1872,27 @@ void DwarfDebug::emitDebugInfo() {
// Emit the abbreviation section.
void DwarfDebug::emitAbbreviations() {
+ if (!useSplitDwarf())
+ emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection(),
+ &Abbreviations);
+ else
+ emitSkeletonAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
+}
+
+void DwarfDebug::emitAbbrevs(const MCSection *Section,
+ std::vector<DIEAbbrev *> *Abbrevs) {
// Check to see if it is worth the effort.
- if (!Abbreviations.empty()) {
+ if (!Abbrevs->empty()) {
// Start the debug abbrev section.
- const MCSection *ASec = Asm->getObjFileLowering().getDwarfAbbrevSection();
- Asm->OutStreamer.SwitchSection(ASec);
+ Asm->OutStreamer.SwitchSection(Section);
- MCSymbol *Begin = Asm->GetTempSymbol(ASec->getLabelBeginName());
+ MCSymbol *Begin = Asm->GetTempSymbol(Section->getLabelBeginName());
Asm->OutStreamer.EmitLabel(Begin);
// For each abbrevation.
- for (unsigned i = 0, N = Abbreviations.size(); i < N; ++i) {
+ for (unsigned i = 0, N = Abbrevs->size(); i < N; ++i) {
// Get abbreviation data
- const DIEAbbrev *Abbrev = Abbreviations[i];
+ const DIEAbbrev *Abbrev = Abbrevs->at(i);
// Emit the abbrevations code (base 1 index.)
Asm->EmitULEB128(Abbrev->getNumber(), "Abbreviation Code");
@@ -1888,7 +1904,7 @@ void DwarfDebug::emitAbbreviations() {
// Mark end of abbreviations.
Asm->EmitULEB128(0, "EOM(3)");
- MCSymbol *End = Asm->GetTempSymbol(ASec->getLabelEndName());
+ MCSymbol *End = Asm->GetTempSymbol(Section->getLabelEndName());
Asm->OutStreamer.EmitLabel(End);
}
}
@@ -2382,24 +2398,35 @@ void DwarfDebug::emitSkeletonCU(const MCSection *Section) {
Asm->OutStreamer.AddComment("DWARF version number");
Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
- Asm->EmitSectionOffset(Asm->GetTempSymbol("abbrev_begin"),
+
+ const MCSection *ASec = Asm->getObjFileLowering().getDwarfAbbrevSection();
+ Asm->EmitSectionOffset(Asm->GetTempSymbol(ASec->getLabelBeginName()),
DwarfAbbrevSectionSym);
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
- emitDIE(Die);
+ emitDIE(Die, &SkeletonAbbrevs);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(Section->getLabelEndName(),
SkeletonCU->getUniqueID()));
+}
-
+void DwarfDebug::emitSkeletonAbbrevs(const MCSection *Section) {
+ assert(useSplitDwarf() && "No split dwarf debug info?");
+ emitAbbrevs(Section, &SkeletonAbbrevs);
}
// Emit the .debug_info.dwo section for separated dwarf. This contains the
// compile units that would normally be in debug_info.
void DwarfDebug::emitDebugInfoDWO() {
assert(useSplitDwarf() && "No split dwarf debug info?");
- // FIXME for Abbrev DWO.
InfoHolder.emitUnits(this, Asm->getObjFileLowering().getDwarfInfoDWOSection(),
- Asm->getObjFileLowering().getDwarfAbbrevSection(),
- DwarfAbbrevSectionSym);
+ Asm->getObjFileLowering().getDwarfAbbrevDWOSection(),
+ DwarfAbbrevDWOSectionSym);
+}
+
+// Emit the .debug_abbrev.dwo section for separated dwarf. This contains the
+// abbreviations for the .debug_info.dwo section.
+void DwarfDebug::emitDebugAbbrevDWO() {
+ assert(useSplitDwarf() && "No split dwarf?");
+ emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevDWOSection(), &Abbreviations);
}