Print discriminators when printing .debug_line in GNU style.
Summary:
gnu addr2line prints DWARF line table discriminators like so:
<file>:<line> (discriminator <Number>)
This matches that behavior.
Document how and when --output-style=GNU prints discriminators
Add test for new GNU-style discriminator printing.
Reviewers: rupprecht, labath, jhenderson
Subscribers: aprantl, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73318
diff --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst
index bb60246..10f72a0 100644
--- a/llvm/docs/CommandGuide/llvm-symbolizer.rst
+++ b/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