diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp --- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/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; diff --git a/llvm/test/tools/llvm-symbolizer/output-style-discriminator.test b/llvm/test/tools/llvm-symbolizer/output-style-discriminator.test new file mode 100644 --- /dev/null +++ b/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)