[PATCH] D70705: [DebugInfo]Support for debug_macinfo.dwo section in llvm and llvm-dwarfdump.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 08:04:49 PST 2019


dblaikie reopened this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

This seems like the wrong direction since the macinfo section was replaced (like loc/ranges) with a new format in DWARFv5: "Replace the .debug_macinfo macro information representation with with a .debug_macro representation that can potentially be much more compact."

Seems the thing to do would be to correct the DWARFv5 non-split-DWARF support by using the new format there, then expand that support to cover the split DWARF case as well.



================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:2771-2807
 /// Emit macros into a debug macinfo section.
 void DwarfDebug::emitDebugMacinfo() {
   for (const auto &P : CUMap) {
     auto &TheCU = *P.second;
     auto *SkCU = TheCU.getSkeleton();
     DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;
     auto *CUNode = cast<DICompileUnit>(P.first);
----------------
Please refactor these functions to use a common implementation.

eg:

  void DwarfDebug::emitDebugMacinfoDWO() {
    emitDebugMacinfoImpl(Asm->getObjFileLowering().getDwarfMacinfoDWOSection());
  }
  void DwarfDebug::emitDebugMacinfo() {
    emitDebugMacinfoImpl(Asm->getObjFileLowering().getDwarfMacinfoSection());
  }
  void DwarfDebug::emitDebugMacinfoImpl(MCSection *Section) {
    for (const auto &P : CUMap) {
      auto &TheCU = *P.second;
      auto *SkCU = TheCU.getSkeleton();
      DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;
      auto *CUNode = cast<DICompileUnit>(P.first);
      DIMacroNodeArray Macros = CUNode->getMacros();
      if (Macros.empty())
        continue;
      Asm->OutStreamer->SwitchSection(Section);
      Asm->OutStreamer->EmitLabel(U.getMacroLabelBegin());
      handleMacroNodes(Macros, U);
      Asm->OutStreamer->AddComment("End Of Macro List Mark");
      Asm->emitInt8(0);
    }
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70705/new/

https://reviews.llvm.org/D70705





More information about the llvm-commits mailing list