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

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 18:09:29 PST 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());
+  }
----------------
alx32 wrote:

Good call. The new implementation seems much more straightforward. LMK what you think. 

I also tested it on [a more complex example](https://gist.github.com/alx32/f35023b7b2939af4d6110f8c37f4d918) and [the result](https://www.diffchecker.com/QesUhKWy/) seems correct.

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


More information about the llvm-commits mailing list