[PATCH] D58952: [llvm] Skip over empty line table entries.
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 4 22:10:14 PST 2019
mtrofin created this revision.
Herald added subscribers: llvm-commits, jdoerfert, rupprecht, hiraditya.
Herald added a project: LLVM.
mtrofin added a reviewer: dblaikie.
This is similar to how addr2line handles consecutive entries with the
same address - pick the last one.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D58952
Files:
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/test/tools/llvm-symbolizer/fission-ranges.test
llvm/test/tools/llvm-symbolizer/sym-verbose.test
Index: llvm/test/tools/llvm-symbolizer/sym-verbose.test
===================================================================
--- llvm/test/tools/llvm-symbolizer/sym-verbose.test
+++ llvm/test/tools/llvm-symbolizer/sym-verbose.test
@@ -19,8 +19,8 @@
#CHECK-NEXT: foo
#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c
#CHECK-NEXT: Function start line: 4
-#CHECK-NEXT: Line: 9
-#CHECK-NEXT: Column: 0
+#CHECK-NEXT: Line: 5
+#CHECK-NEXT: Column: 7
#CHECK-NEXT: main
#CHECK-NEXT: Filename: /tmp{{[\\/]}}discrim.c
#CHECK-NEXT: Function start line: 9
Index: llvm/test/tools/llvm-symbolizer/fission-ranges.test
===================================================================
--- llvm/test/tools/llvm-symbolizer/fission-ranges.test
+++ llvm/test/tools/llvm-symbolizer/fission-ranges.test
@@ -1,4 +1,4 @@
RUN: llvm-symbolizer --obj=%p/Inputs/fission-ranges.elf-x86_64 0x720 | FileCheck %s
CHECK: main
-CHECK-NEXT: {{.*}}fission-ranges.cc:6
+CHECK-NEXT: {{.*}}fission-ranges.cc:2
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -867,8 +867,11 @@
Row.Address = Address;
RowIter FirstRow = Rows.begin() + Seq.FirstRowIndex;
RowIter LastRow = Rows.begin() + Seq.LastRowIndex;
- LineTable::RowIter RowPos = std::lower_bound(
+ // 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::upper_bound(
FirstRow, LastRow, Row, DWARFDebugLine::Row::orderByAddress);
+ --RowPos;
if (RowPos == LastRow) {
return Seq.LastRowIndex - 1;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58952.189277.patch
Type: text/x-patch
Size: 1748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190305/fb6754a9/attachment-0001.bin>
More information about the llvm-commits
mailing list