diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 62c0d2183c8..7ca94de980d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1405,8 +1405,9 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) { addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, dwarf::DW_FORM_ref4, OriginDIE); - addLabel(ScopeDIE, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, - getDWLabel("label", StartID)); + MCSymbol *StartLabel = getDWLabel("label", StartID); + + addLabel(ScopeDIE, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, StartLabel); addLabel(ScopeDIE, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr, getDWLabel("label", EndID)); @@ -1417,11 +1418,11 @@ DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) { I = InlineInfo.find(InlinedSP.getNode()); if (I == InlineInfo.end()) { - InlineInfo[InlinedSP.getNode()].push_back(std::make_pair(StartID, + InlineInfo[InlinedSP.getNode()].push_back(std::make_pair(StartLabel, ScopeDIE)); InlinedSPNodes.push_back(InlinedSP.getNode()); } else - I->second.push_back(std::make_pair(StartID, ScopeDIE)); + I->second.push_back(std::make_pair(StartLabel, ScopeDIE)); StringPool.insert(InlinedSP.getName()); StringPool.insert(getRealLinkageName(InlinedSP.getLinkageName())); @@ -2965,13 +2966,12 @@ void DwarfDebug::emitDebugInlineInfo() { for (SmallVector::iterator LI = Labels.begin(), LE = Labels.end(); LI != LE; ++LI) { - DIE *SP = LI->second; - Asm->EmitInt32(SP->getOffset()); EOL("DIE offset"); + if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("DIE offset"); + Asm->EmitInt32(LI->second->getOffset()); - // FIXME: "Labels" should hold MCSymbol*'s - MCSymbol *L = getDWLabel("label", LI->first); if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("low_pc"); - Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(L, Asm->OutContext), + Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(LI->first, + Asm->OutContext), TD->getPointerSize(), 0/*AddrSpace*/); } } diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 2abad8aac2c..0c04502444c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -167,8 +167,8 @@ class DwarfDebug : public DwarfPrinter { /// InlineInfo - Keep track of inlined functions and their location. This /// information is used to populate debug_inlined section. - typedef std::pair InlineInfoLabels; - DenseMap > InlineInfo; + typedef std::pair InlineInfoLabels; + DenseMap > InlineInfo; SmallVector InlinedSPNodes; /// CompileUnitOffsets - A vector of the offsets of the compile units. This is