mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-17 00:46:42 +00:00
Store an use the symbols emitted at the start of the debug
sections instead of magically rematerializing them later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100362 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fa070b0175
commit
9c69e28553
@ -304,6 +304,14 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
|
|||||||
AbbreviationsSet(InitAbbreviationsSetSize), shouldEmit(false),
|
AbbreviationsSet(InitAbbreviationsSetSize), shouldEmit(false),
|
||||||
CurrentFnDbgScope(0), DebugTimer(0) {
|
CurrentFnDbgScope(0), DebugTimer(0) {
|
||||||
NextStringPoolNumber = 0;
|
NextStringPoolNumber = 0;
|
||||||
|
|
||||||
|
DwarfFrameSectionSym = 0;
|
||||||
|
DwarfInfoSectionSym = 0;
|
||||||
|
DwarfAbbrevSectionSym = 0;
|
||||||
|
DwarfStrSectionSym = 0;
|
||||||
|
TextSectionSym = 0;
|
||||||
|
DataSectionSym = 0;
|
||||||
|
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer = new Timer("Dwarf Debug Writer");
|
DebugTimer = new Timer("Dwarf Debug Writer");
|
||||||
}
|
}
|
||||||
@ -1667,8 +1675,7 @@ void DwarfDebug::constructCompileUnit(MDNode *N) {
|
|||||||
addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data1,
|
addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data1,
|
||||||
DIUnit.getLanguage());
|
DIUnit.getLanguage());
|
||||||
addString(Die, dwarf::DW_AT_name, dwarf::DW_FORM_string, FN);
|
addString(Die, dwarf::DW_AT_name, dwarf::DW_FORM_string, FN);
|
||||||
addLabel(Die, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
addLabel(Die, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, TextSectionSym);
|
||||||
Asm->GetTempSymbol("text_begin"));
|
|
||||||
addLabel(Die, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
addLabel(Die, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
||||||
Asm->GetTempSymbol("text_end"));
|
Asm->GetTempSymbol("text_end"));
|
||||||
// DW_AT_stmt_list is a offset of line number information for this
|
// DW_AT_stmt_list is a offset of line number information for this
|
||||||
@ -1791,6 +1798,9 @@ void DwarfDebug::beginModule(Module *M) {
|
|||||||
DebugInfoFinder DbgFinder;
|
DebugInfoFinder DbgFinder;
|
||||||
DbgFinder.processModule(*M);
|
DbgFinder.processModule(*M);
|
||||||
|
|
||||||
|
// Emit initial sections
|
||||||
|
EmitSectionLabels();
|
||||||
|
|
||||||
// Create all the compile unit DIEs.
|
// Create all the compile unit DIEs.
|
||||||
for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(),
|
for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(),
|
||||||
E = DbgFinder.compile_unit_end(); I != E; ++I)
|
E = DbgFinder.compile_unit_end(); I != E; ++I)
|
||||||
@ -1832,9 +1842,6 @@ void DwarfDebug::beginModule(Module *M) {
|
|||||||
Asm->OutStreamer.EmitDwarfFileDirective(i, FullPath.str());
|
Asm->OutStreamer.EmitDwarfFileDirective(i, FullPath.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit initial sections
|
|
||||||
EmitSectionLabels();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// endModule - Emit all Dwarf sections that should come after the content.
|
/// endModule - Emit all Dwarf sections that should come after the content.
|
||||||
@ -2437,46 +2444,47 @@ void DwarfDebug::computeSizeAndOffsets() {
|
|||||||
CompileUnitOffsets[ModuleCU] = 0;
|
CompileUnitOffsets[ModuleCU] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitSectionLabels - Emit initial Dwarf declarations. This is necessary for cc
|
static MCSymbol *EmitSectionSym(AsmPrinter *Asm, const MCSection *Section,
|
||||||
/// tools to recognize the object file contains Dwarf information.
|
const char *SymbolStem) {
|
||||||
|
Asm->OutStreamer.SwitchSection(Section);
|
||||||
|
MCSymbol *TmpSym = Asm->GetTempSymbol(SymbolStem);
|
||||||
|
Asm->OutStreamer.EmitLabel(TmpSym);
|
||||||
|
return TmpSym;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// EmitSectionLabels - Emit initial Dwarf sections with a label at
|
||||||
|
/// the start of each one.
|
||||||
void DwarfDebug::EmitSectionLabels() {
|
void DwarfDebug::EmitSectionLabels() {
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
// Dwarf sections base addresses.
|
// Dwarf sections base addresses.
|
||||||
if (MAI->doesDwarfRequireFrameSection()) {
|
if (MAI->doesDwarfRequireFrameSection()) {
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfFrameSection());
|
DwarfFrameSectionSym =
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_debug_frame"));
|
EmitSectionSym(Asm, TLOF.getDwarfFrameSection(), "section_debug_frame");
|
||||||
}
|
}
|
||||||
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfInfoSection());
|
DwarfInfoSectionSym =
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_info"));
|
EmitSectionSym(Asm, TLOF.getDwarfInfoSection(), "section_info");
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfAbbrevSection());
|
DwarfAbbrevSectionSym =
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_abbrev"));
|
EmitSectionSym(Asm, TLOF.getDwarfAbbrevSection(), "section_abbrev");
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfARangesSection());
|
EmitSectionSym(Asm, TLOF.getDwarfARangesSection(), "section_aranges");
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_aranges"));
|
|
||||||
|
if (const MCSection *MacroInfo = TLOF.getDwarfMacroInfoSection())
|
||||||
|
EmitSectionSym(Asm, MacroInfo,"section_macinfo");
|
||||||
|
|
||||||
if (const MCSection *LineInfoDirective = TLOF.getDwarfMacroInfoSection()) {
|
EmitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
|
||||||
Asm->OutStreamer.SwitchSection(LineInfoDirective);
|
EmitSectionSym(Asm, TLOF.getDwarfLocSection(), "section_loc");
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_macinfo"));
|
EmitSectionSym(Asm, TLOF.getDwarfPubNamesSection(), "section_pubnames");
|
||||||
}
|
EmitSectionSym(Asm, TLOF.getDwarfPubTypesSection(), "section_pubtypes");
|
||||||
|
DwarfStrSectionSym =
|
||||||
|
EmitSectionSym(Asm, TLOF.getDwarfStrSection(), "section_str");
|
||||||
|
|
||||||
|
EmitSectionSym(Asm, TLOF.getDwarfRangesSection(), "section_ranges");
|
||||||
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfLineSection());
|
TextSectionSym = EmitSectionSym(Asm, TLOF.getTextSection(), "text_begin");
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_line"));
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfLocSection());
|
// This is subtly used by the ocaml GC stuff.
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_loc"));
|
DataSectionSym = EmitSectionSym(Asm, TLOF.getDataSection(), "data_begin");
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfPubNamesSection());
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_pubnames"));
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfPubTypesSection());
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_pubtypes"));
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfStrSection());
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_str"));
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfRangesSection());
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("section_ranges"));
|
|
||||||
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getTextSection());
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("text_begin"));
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDataSection());
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("data_begin"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// emitDIE - Recusively Emits a debug information entry.
|
/// emitDIE - Recusively Emits a debug information entry.
|
||||||
@ -2561,8 +2569,7 @@ void DwarfDebug::emitDebugInfo() {
|
|||||||
Asm->OutStreamer.AddComment("DWARF version number");
|
Asm->OutStreamer.AddComment("DWARF version number");
|
||||||
Asm->EmitInt16(dwarf::DWARF_VERSION);
|
Asm->EmitInt16(dwarf::DWARF_VERSION);
|
||||||
Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
|
Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
|
||||||
EmitSectionOffset(Asm->GetTempSymbol("abbrev_begin"),
|
EmitSectionOffset(Asm->GetTempSymbol("abbrev_begin"), DwarfAbbrevSectionSym);
|
||||||
Asm->GetTempSymbol("section_abbrev"));
|
|
||||||
Asm->OutStreamer.AddComment("Address Size (in bytes)");
|
Asm->OutStreamer.AddComment("Address Size (in bytes)");
|
||||||
Asm->EmitInt8(TD->getPointerSize());
|
Asm->EmitInt8(TD->getPointerSize());
|
||||||
|
|
||||||
@ -2874,7 +2881,7 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) {
|
|||||||
|
|
||||||
Asm->OutStreamer.AddComment("FDE CIE offset");
|
Asm->OutStreamer.AddComment("FDE CIE offset");
|
||||||
EmitSectionOffset(Asm->GetTempSymbol("debug_frame_common"),
|
EmitSectionOffset(Asm->GetTempSymbol("debug_frame_common"),
|
||||||
Asm->GetTempSymbol("section_debug_frame"));
|
DwarfFrameSectionSym);
|
||||||
|
|
||||||
Asm->OutStreamer.AddComment("FDE initial location");
|
Asm->OutStreamer.AddComment("FDE initial location");
|
||||||
MCSymbol *FuncBeginSym =
|
MCSymbol *FuncBeginSym =
|
||||||
@ -2913,7 +2920,7 @@ void DwarfDebug::emitDebugPubNames() {
|
|||||||
|
|
||||||
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
|
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
|
||||||
EmitSectionOffset(Asm->GetTempSymbol("info_begin", ModuleCU->getID()),
|
EmitSectionOffset(Asm->GetTempSymbol("info_begin", ModuleCU->getID()),
|
||||||
Asm->GetTempSymbol("section_info"));
|
DwarfInfoSectionSym);
|
||||||
|
|
||||||
Asm->OutStreamer.AddComment("Compilation Unit Length");
|
Asm->OutStreamer.AddComment("Compilation Unit Length");
|
||||||
Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()),
|
Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()),
|
||||||
@ -2957,7 +2964,7 @@ void DwarfDebug::emitDebugPubTypes() {
|
|||||||
|
|
||||||
Asm->OutStreamer.AddComment("Offset of Compilation ModuleCU Info");
|
Asm->OutStreamer.AddComment("Offset of Compilation ModuleCU Info");
|
||||||
EmitSectionOffset(Asm->GetTempSymbol("info_begin", ModuleCU->getID()),
|
EmitSectionOffset(Asm->GetTempSymbol("info_begin", ModuleCU->getID()),
|
||||||
Asm->GetTempSymbol("section_info"));
|
DwarfInfoSectionSym);
|
||||||
|
|
||||||
Asm->OutStreamer.AddComment("Compilation ModuleCU Length");
|
Asm->OutStreamer.AddComment("Compilation ModuleCU Length");
|
||||||
Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()),
|
Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()),
|
||||||
@ -3103,11 +3110,10 @@ void DwarfDebug::emitDebugInlineInfo() {
|
|||||||
Asm->OutStreamer.EmitIntValue(0, 1, 0); // nul terminator.
|
Asm->OutStreamer.EmitIntValue(0, 1, 0); // nul terminator.
|
||||||
} else
|
} else
|
||||||
EmitSectionOffset(getStringPoolEntry(getRealLinkageName(LName)),
|
EmitSectionOffset(getStringPoolEntry(getRealLinkageName(LName)),
|
||||||
Asm->GetTempSymbol("section_str"));
|
DwarfStrSectionSym);
|
||||||
|
|
||||||
Asm->OutStreamer.AddComment("Function name");
|
Asm->OutStreamer.AddComment("Function name");
|
||||||
EmitSectionOffset(getStringPoolEntry(Name),
|
EmitSectionOffset(getStringPoolEntry(Name), DwarfStrSectionSym);
|
||||||
Asm->GetTempSymbol("section_str"));
|
|
||||||
Asm->EmitULEB128(Labels.size(), "Inline count");
|
Asm->EmitULEB128(Labels.size(), "Inline count");
|
||||||
|
|
||||||
for (SmallVector<InlineInfoLabels, 4>::iterator LI = Labels.begin(),
|
for (SmallVector<InlineInfoLabels, 4>::iterator LI = Labels.begin(),
|
||||||
|
@ -206,6 +206,14 @@ class DwarfDebug : public DwarfPrinter {
|
|||||||
|
|
||||||
std::vector<FunctionDebugFrameInfo> DebugFrames;
|
std::vector<FunctionDebugFrameInfo> DebugFrames;
|
||||||
|
|
||||||
|
// Section Symbols: these are assembler temporary labels that are emitted at
|
||||||
|
// the beginning of each supported dwarf section. These are used to form
|
||||||
|
// section offsets and are created by EmitSectionLabels.
|
||||||
|
MCSymbol *DwarfFrameSectionSym, *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
|
||||||
|
MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DataSectionSym;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
/// getSourceDirectoryAndFileIds - Return the directory and file ids that
|
/// getSourceDirectoryAndFileIds - Return the directory and file ids that
|
||||||
/// maps to the source id. Source id starts at 1.
|
/// maps to the source id. Source id starts at 1.
|
||||||
std::pair<unsigned, unsigned>
|
std::pair<unsigned, unsigned>
|
||||||
|
Loading…
Reference in New Issue
Block a user