summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2019-03-12 20:48:45 +0000
committerMircea Trofin <mtrofin@google.com>2019-03-12 20:48:45 +0000
commit0c29402eb40630699b44f132c73acebcb524d07a (patch)
tree7f589c3ad51f61df6952978b07da35be55ecc591 /llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
parentb5f14326b447e5a97b3d7654448c36d7745a6882 (diff)
downloadbcm5719-llvm-0c29402eb40630699b44f132c73acebcb524d07a.tar.gz
bcm5719-llvm-0c29402eb40630699b44f132c73acebcb524d07a.zip
[llvm] Skip over empty line table entries.
Summary: This is similar to how addr2line handles consecutive entries with the same address - pick the last one. Reviewers: dblaikie, friss, JDevlieghere Reviewed By: dblaikie Subscribers: ormris, echristo, JDevlieghere, probinson, aprantl, hiraditya, rupprecht, jdoerfert, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D58952 llvm-svn: 355972
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index a2c25248618..dee9428be29 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -872,6 +872,13 @@ uint32_t DWARFDebugLine::LineTable::findRowInSeq(
if (RowPos == LastRow) {
return Seq.LastRowIndex - 1;
}
+ // 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.
+ while (RowPos + 1 < LastRow &&
+ RowPos->Address.Address == (RowPos + 1)->Address.Address) {
+ ++RowPos;
+ }
+ assert(RowPos < LastRow);
assert(Seq.SectionIndex == RowPos->Address.SectionIndex);
uint32_t Index = Seq.FirstRowIndex + (RowPos - FirstRow);
if (RowPos->Address.Address > Address.Address) {
OpenPOWER on IntegriCloud