[PATCH] D108261: [DebugInfo] Fix end_sequence of debug_line in LTO Object

Kyungwoo Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 13 16:39:12 PST 2021


kyulee added inline comments.


================
Comment at: llvm/lib/MC/MCDwarf.cpp:171-173
+      // If it is the last entry, don't emit another end entry after the loop.
+      if (&LineEntries.back() == &LineEntry)
+        return;
----------------
dblaikie wrote:
> When does this occur? I guess when the last function with debug info in this section is followed by a function in another section (with or without debug info) or a nodebug function?
> 
> That does seem a bit subtle and like it'd be nicer if this API's invariant was just that all callers terminated their own lists. (this would involve fixing up the GenDwarfForAssembly codepath to do that too, I'd guess)
> 
> For DwarfDebug/etc I guess this would be addressed by calling terminateLineTableForPrevCU (or perhaps resetPrevCU) in finishModule or whatever it's called?
I can see we can terminate the line table for DwarfDebug in finishModule via `resetPrevCU` -- this will use an end label of range. 

However, for assembly path, I don't think we have explicit labels/symbols to terminate. I may introduce an api to patch the line table for all sections that do not have an end entry at the end.  But in that case, I still need to synthesize/emit a label using section symbol like `MCStreamer::endSection`. It's just moving the place when we fill this gap -- either here or before coming here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108261



More information about the llvm-commits mailing list