[lld] [llvm] [Symbolizer] Support for Missing Line Numbers. (PR #82240)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 11:41:50 PDT 2024


================
@@ -1337,7 +1339,22 @@ uint32_t DWARFDebugLine::LineTable::lookupAddressImpl(
                                       DWARFDebugLine::Sequence::orderByHighPC);
   if (It == Sequences.end() || It->SectionIndex != Address.SectionIndex)
     return UnknownRowIndex;
-  return findRowInSeq(*It, Address);
+
+  uint32_t RowIndex = findRowInSeq(*It, Address);
+
+  if (RowIndex == UnknownRowIndex)
+    return RowIndex;
+
+  // Approximation will only be attempted if a valid RowIndex exists.
+  if (Approximation && Approximation->Report) {
+    for (uint32_t ApproxRowIndex = RowIndex;
+         ApproxRowIndex >= It->FirstRowIndex; --ApproxRowIndex) {
+      if (Rows[ApproxRowIndex].Line)
+        return ApproxRowIndex;
+      Approximation->IsApproximateLine = true;
----------------
dwblaikie wrote:

Shouldn't this be inside the `if`, just before the `return ApproxRowIndex`? Otherwise we'll show "(approximated)" on the output even when no approximation was done, right? (like if we find a zero line, and then don't find a zero line before it - the result is the originally found zero line, this is not an approximation, even though the user requested approximation - be good not to confuse them and suggest the approximated line was line zero)

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


More information about the llvm-commits mailing list