[PATCH] D58952: [llvm] Skip over empty line table entries.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 14:02:42 PST 2019


dblaikie added a subscriber: echristo.
dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:871
+  // In some cases, e.g. first instruction in a function, the compiler generates
+  // two entries, both with the same address. We want the last one.
   LineTable::RowIter RowPos = std::lower_bound(
----------------
probinson wrote:
> aprantl wrote:
> > Doesn't the DWARF spec require all PC values in the line table to be strictly monotonically increasing? How is it possible to have more than one entry at the same address?
> The DWARF spec's model is based on increasing PC values, however the encoding allows advancing PC by 0. So it's entirely possible to have a line table that (for example) advances line by 2 and PC by 0.
I couldn't find specific wording about that - but please do take a look, quite possible I missed it.

LLVM's been generating line tables like this for a while (the test updates show evidence of that) & it might be justifiable to fix this code even if it's technically invalid DWARF, given how long we've been generating it. (to my mind, it is wasted DWARF - it doesn't describe any location, so I think it should be correct to remove it if we wanted to, but not a high priority bug (@echristo reckons there might be consumers using these empty ranges to find the start of a function or the like))


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58952





More information about the llvm-commits mailing list