[PATCH] D73318: Print discriminators when printing .debug_line in GNU style.
Sterling Augustine via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 17:58:34 PST 2020
saugustine created this revision.
saugustine added reviewers: rupprecht, labath.
Herald added subscribers: llvm-commits, hiraditya, aprantl.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
gnu addr2line prints DWARF line table discriminators like so:
<file>:<line> (discriminator <Number>)
This matches that behavior.
Add test for new GNU-style discriminator printing.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73318
Files:
llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
llvm/test/tools/llvm-symbolizer/output-style-discriminator.test
Index: llvm/test/tools/llvm-symbolizer/output-style-discriminator.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-symbolizer/output-style-discriminator.test
@@ -0,0 +1,10 @@
+Check that llvm-symbolizer prints line-table discriminators properly.
+
+RUN: llvm-symbolizer --output-style=GNU -f -obj=%p/Inputs/discrim 0x400590 0x400575 | FileCheck %s
+
+CHECK: foo
+CHECK: /tmp/discrim.c:5
+CHECK: main
+CHECK: /tmp/discrim.c:10
+CHECK: foo
+CHECK: /tmp/discrim.c:5 (discriminator 2)
Index: llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
===================================================================
--- llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
+++ llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
@@ -79,6 +79,8 @@
OS << Filename << ":" << Info.Line;
if (Style == OutputStyle::LLVM)
OS << ":" << Info.Column;
+ else if (Style == OutputStyle::GNU && Info.Discriminator != 0)
+ OS << " (discriminator " << Info.Discriminator << ")";
OS << "\n";
printContext(Filename, Info.Line);
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73318.240076.patch
Type: text/x-patch
Size: 1085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200124/ef97d9e3/attachment.bin>
More information about the llvm-commits
mailing list