[PATCH] D73318: Print discriminators when printing .debug_line in GNU style.
Sterling Augustine via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 12:26:12 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc64b56617da2: Print discriminators when printing .debug_line in GNU style. (authored by saugustine).
Changed prior to commit:
https://reviews.llvm.org/D73318?vs=241229&id=241252#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73318/new/
https://reviews.llvm.org/D73318
Files:
llvm/docs/CommandGuide/llvm-symbolizer.rst
llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
llvm/test/tools/llvm-symbolizer/discriminator.test
Index: llvm/test/tools/llvm-symbolizer/discriminator.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-symbolizer/discriminator.test
@@ -0,0 +1,20 @@
+# Check that llvm-symbolizer prints line-table discriminators properly.
+
+RUN: llvm-symbolizer --output-style=GNU -f --obj=%p/Inputs/discrim 0x400590 0x400575 \
+RUN: | FileCheck %s --check-prefix=GNU --match-full-lines
+RUN: llvm-symbolizer --output-style=LLVM -f --obj=%p/Inputs/discrim 0x400590 0x400575 \
+RUN: | FileCheck %s --check-prefix=LLVM --match-full-lines
+
+GNU: foo
+GNU: /tmp{{[\\/]}}discrim.c:5
+GNU: main
+GNU: /tmp{{[\\/]}}discrim.c:10
+GNU: foo
+GNU: /tmp{{[\\/]}}discrim.c:5 (discriminator 2)
+
+LLVM: foo
+LLVM: /tmp{{[\\/]}}discrim.c:5:7
+LLVM: main
+LLVM: /tmp{{[\\/]}}discrim.c:10:0
+LLVM: foo
+LLVM: /tmp{{[\\/]}}discrim.c:5:17
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;
Index: llvm/docs/CommandGuide/llvm-symbolizer.rst
===================================================================
--- llvm/docs/CommandGuide/llvm-symbolizer.rst
+++ llvm/docs/CommandGuide/llvm-symbolizer.rst
@@ -227,6 +227,9 @@
topmost caller when inlined frames are not shown and :option:`--use-symbol-table`
is on.
+ * Prints an address's debug-data discriminator when it is non-zero. One way to
+ produce discriminators is to compile with clang's -fdebug-info-for-profiling.
+
.. code-block:: console
$ llvm-symbolizer --obj=inlined.elf 0x4004be 0x400486 -p
@@ -244,6 +247,10 @@
baz() at /tmp/test.cpp:11
foo() at /tmp/test.cpp:6
+ $ clang -g -fdebug-info-for-profiling test.cpp -o profiling.elf
+ $ llvm-symbolizer --output-style=GNU --obj=profiling.elf 0x401167 -p -i=0
+ main at /tmp/test.cpp:15 (discriminator 2)
+
.. option:: --pretty-print, -p
Print human readable output. If :option:`--inlining` is specified, the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73318.241252.patch
Type: text/x-patch
Size: 2394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200129/a4572d67/attachment.bin>
More information about the llvm-commits
mailing list