DebugInfo: Push header handling down into CompileUnit

This is a preliminary step to handling type units by abstracting over
all (type or compile) units.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2013-10-30 20:42:41 +00:00
parent f132bf39b9
commit 1d36113c05
3 changed files with 29 additions and 18 deletions
+5 -18
View File
@@ -1972,11 +1972,8 @@ void DwarfUnits::computeSizeAndOffsets() {
(*I)->setDebugInfoOffset(SecOffset);
// CU-relative offset is reset to 0 here.
unsigned Offset =
sizeof(int32_t) + // Length of Compilation Unit Info
sizeof(int16_t) + // DWARF version number
sizeof(int32_t) + // Offset Into Abbrev. Section
sizeof(int8_t); // Pointer Size (in bytes)
unsigned Offset = sizeof(int32_t) + // Length of Unit Info
(*I)->getHeaderSize(); // Unit-specific headers
// EndOffset here is CU-relative, after laying out
// all of the CU DIE.
@@ -2163,20 +2160,10 @@ void DwarfUnits::emitUnits(DwarfDebug *DD,
TheCU->getUniqueID()));
// Emit size of content not including length itself
unsigned ContentSize = Die->getSize() +
sizeof(int16_t) + // DWARF version number
sizeof(int32_t) + // Offset Into Abbrev. Section
sizeof(int8_t); // Pointer Size (in bytes)
Asm->OutStreamer.AddComment("Length of Unit");
Asm->EmitInt32(TheCU->getHeaderSize() + Die->getSize());
Asm->OutStreamer.AddComment("Length of Compilation Unit Info");
Asm->EmitInt32(ContentSize);
Asm->OutStreamer.AddComment("DWARF version number");
Asm->EmitInt16(DD->getDwarfVersion());
Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
Asm->EmitSectionOffset(Asm->GetTempSymbol(ASection->getLabelBeginName()),
ASectionSym);
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
TheCU->emitHeader(ASection, ASectionSym);
DD->emitDIE(Die, Abbreviations);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(USection->getLabelEndName(),