summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
diff options
context:
space:
mode:
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