[llvm] r293697 - Add a verbose/human readable mode to llvm-symbolizer to investigate discriminators and other line table/backtrace features
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 31 14:19:39 PST 2017
Author: dblaikie
Date: Tue Jan 31 16:19:38 2017
New Revision: 293697
URL: http://llvm.org/viewvc/llvm-project?rev=293697&view=rev
Log:
Add a verbose/human readable mode to llvm-symbolizer to investigate discriminators and other line table/backtrace features
Patch by Simon Que!
Differential Revision: https://reviews.llvm.org/D29094
Modified:
llvm/trunk/include/llvm/DebugInfo/Symbolize/DIPrinter.h
llvm/trunk/lib/DebugInfo/Symbolize/DIPrinter.cpp
llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/Symbolize/DIPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/Symbolize/DIPrinter.h?rev=293697&r1=293696&r2=293697&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/Symbolize/DIPrinter.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/Symbolize/DIPrinter.h Tue Jan 31 16:19:38 2017
@@ -29,15 +29,18 @@ class DIPrinter {
bool PrintFunctionNames;
bool PrintPretty;
int PrintSourceContext;
+ bool Verbose;
void print(const DILineInfo &Info, bool Inlined);
void printContext(const std::string &FileName, int64_t Line);
public:
DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true,
- bool PrintPretty = false, int PrintSourceContext = 0)
+ bool PrintPretty = false, int PrintSourceContext = 0,
+ bool Verbose = false)
: OS(OS), PrintFunctionNames(PrintFunctionNames),
- PrintPretty(PrintPretty), PrintSourceContext(PrintSourceContext) {}
+ PrintPretty(PrintPretty), PrintSourceContext(PrintSourceContext),
+ Verbose(Verbose) {}
DIPrinter &operator<<(const DILineInfo &Info);
DIPrinter &operator<<(const DIInliningInfo &Info);
Modified: llvm/trunk/lib/DebugInfo/Symbolize/DIPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/DIPrinter.cpp?rev=293697&r1=293696&r2=293697&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/DIPrinter.cpp (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/DIPrinter.cpp Tue Jan 31 16:19:38 2017
@@ -78,8 +78,16 @@ void DIPrinter::print(const DILineInfo &
std::string Filename = Info.FileName;
if (Filename == kDILineInfoBadString)
Filename = kBadString;
- OS << Filename << ":" << Info.Line << ":" << Info.Column << "\n";
- printContext(Filename, Info.Line);
+ if (!Verbose) {
+ OS << Filename << ":" << Info.Line << ":" << Info.Column << "\n";
+ printContext(Filename, Info.Line);
+ return;
+ }
+ OS << " Filename: " << Filename << "\n";
+ OS << " Line: " << Info.Line << "\n";
+ OS << " Column: " << Info.Column << "\n";
+ if (Info.Discriminator)
+ OS << " Discriminator: " << Info.Discriminator << "\n";
}
DIPrinter &DIPrinter::operator<<(const DILineInfo &Info) {
Modified: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp?rev=293697&r1=293696&r2=293697&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp Tue Jan 31 16:19:38 2017
@@ -85,6 +85,9 @@ static cl::opt<int> ClPrintSourceContext
"print-source-context-lines", cl::init(0),
cl::desc("Print N number of source file context"));
+static cl::opt<bool> ClVerbose("verbose", cl::init(false),
+ cl::desc("Print verbose line info"));
+
template<typename T>
static bool error(Expected<T> &ResOrErr) {
if (ResOrErr)
@@ -160,7 +163,7 @@ int main(int argc, char **argv) {
LLVMSymbolizer Symbolizer(Opts);
DIPrinter Printer(outs(), ClPrintFunctions != FunctionNameKind::None,
- ClPrettyPrint, ClPrintSourceContextLines);
+ ClPrettyPrint, ClPrintSourceContextLines, ClVerbose);
const int kMaxInputStringLength = 1024;
char InputString[kMaxInputStringLength];
More information about the llvm-commits
mailing list