[lld] [llvm] [Symbolizer] Support for Missing Line Numbers. (PR #82240)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 04:52:26 PDT 2024
================
@@ -1337,7 +1339,17 @@ 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 && DWARFDebugLine::ReportApproximateLine) {
+ for (uint32_t ApproxRowIndex = RowIndex;
+ ApproxRowIndex >= It->FirstRowIndex; --ApproxRowIndex) {
+ if (Rows[ApproxRowIndex].Line)
+ return ApproxRowIndex;
+ *IsApproximateLine = true;
+ }
+ }
+ return RowIndex;
----------------
ampandey-1995 wrote:
> I think it might be clearer to have the early return, rather than having the non-approximate case come out through this for loop?
Yes added the logic of early return.
> ```
> if (RowIndex != UnknownRowIndex || !ReportApproximateLine)
> return RowIndex;
I think the code for early return should match like this.
``` if (RowIndex != UnknownRowIndex || !ReportApproximateLine)
return RowIndex```
> for (...) {
> if (Rows[ApproxRowIndex].Line) {
> *IsApproximateLine = true;
> return ApproxRowIndex;
> }
> }
> return RowIndex;
> ```
> Also, this will ensure that `(approximate)` isn't printed if the approximation doesn't find a non-zero line number (might be worth adding a test for that to demonstrate the fix/change in behavior here).
Yes, the current revision checks if the approximate loop code fails to get a suitable line number then it will return the orignal computed RowIndex.
Although, I would consider if you can help me with a hint to cover this with a test case. I am not sure how to do it in lit test case. Any Suggestions?
https://github.com/llvm/llvm-project/pull/82240
More information about the llvm-commits
mailing list