[llvm] [DebugInfo][DWARF] Emit Per-Function Line Table Offsets and End Sequences (PR #110192)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 16:24:13 PDT 2024


================
@@ -527,6 +527,14 @@ DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const DISubprogram *SP) {
           *DD->getCurrentFunction()))
     addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
 
+  if (Asm->OutStreamer->getGenerateFuncLineTableOffsets() &&
+      Asm->OutStreamer->getCurrentFuncFirstLineStreamSym()) {
+    addSectionLabel(
+        *SPDie, dwarf::DW_AT_LLVM_stmt_sequence,
+        Asm->OutStreamer->getCurrentFuncFirstLineStreamSym(),
+        Asm->getObjFileLowering().getDwarfLineSection()->getBeginSymbol());
+  }
----------------
dwblaikie wrote:

Rather than wiring up the attribute into the streamer, then querying it out here in DwarfCompileUnit, then going back into the streamer with labels - could the streamer "do the right thing" when a label is requested, and otherwise do the old/usual thing?

It doesn't seem like MCStreamer should "know" about function labels, it should know about line table labels, and you could in theory request them anywhere you want to be able to jump into parsing the line table without having to parse additional context. (ie: in `beginFunctionImpl` ? (though maybe that's after the prologue, in which case maybe there's some callback before the prologue, or we should add one))

https://github.com/llvm/llvm-project/pull/110192


More information about the llvm-commits mailing list