Skip to content
DwarfDebug.cpp 102 KiB
Newer Older
/// The rest of the entry consists of a {die_offset, low_pc} pair for each
/// inlined instance; the die_offset points to the inlined_subroutine die in the
/// __debug_info section, and the low_pc is the starting address for the
/// inlining instance.
void DwarfDebug::emitDebugInlineInfo() {
  if (!MAI->doesDwarfUsesInlineInfoSection())
Devang Patel's avatar
Devang Patel committed
  if (!ModuleCU)
  Asm->OutStreamer.SwitchSection(
                        Asm->getObjFileLowering().getDwarfDebugInlineSection());
  Asm->EOL();
  EmitDifference("debug_inlined_end", 1,
                 "debug_inlined_begin", 1, true);
  Asm->EOL("Length of Debug Inlined Information Entry");
  EmitLabel("debug_inlined_begin", 1);
  Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("Dwarf Version");
  Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)");
  for (SmallVector<MDNode *, 4>::iterator I = InlinedSPNodes.begin(),
         E = InlinedSPNodes.end(); I != E; ++I) {
//  for (ValueMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator
    //        I = InlineInfo.begin(), E = InlineInfo.end(); I != E; ++I) {
    MDNode *Node = *I;
Jim Grosbach's avatar
Jim Grosbach committed
    ValueMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator II
      = InlineInfo.find(Node);
    SmallVector<InlineInfoLabels, 4> &Labels = II->second;
Devang Patel's avatar
Devang Patel committed
    DISubprogram SP(Node);
    StringRef LName = SP.getLinkageName();
    StringRef Name = SP.getName();
    if (LName.empty())
      // Skip special LLVM prefix that is used to inform the asm printer to not
      // emit usual symbol prefix before the symbol name. This happens for
      // Objective-C symbol names and symbol whose name is replaced using GCC's
      // __asm__ attribute.
        LName = LName.substr(1);
//      Asm->EmitString(LName);
      EmitSectionOffset("string", "section_str",
                        StringPool.idFor(LName), false, true);

    Asm->EOL("MIPS linkage name");
Jim Grosbach's avatar
Jim Grosbach committed
//    Asm->EmitString(Name);
    EmitSectionOffset("string", "section_str",
                      StringPool.idFor(Name), false, true);
    Asm->EOL("Function name");
    Asm->EmitULEB128Bytes(Labels.size()); Asm->EOL("Inline count");
    for (SmallVector<InlineInfoLabels, 4>::iterator LI = Labels.begin(),
           LE = Labels.end(); LI != LE; ++LI) {
      DIE *SP = LI->second;
      Asm->EmitInt32(SP->getOffset()); Asm->EOL("DIE offset");
      if (TD->getPointerSize() == sizeof(int32_t))
        O << MAI->getData32bitsDirective();
        O << MAI->getData64bitsDirective();
      PrintLabelName("label", LI->first); Asm->EOL("low_pc");
  EmitLabel("debug_inlined_end", 1);
  Asm->EOL();