From: Colin LeMahieu Date: Wed, 11 Nov 2015 18:11:06 +0000 (+0000) Subject: Reverting r252760 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=55b72798ae1159ef265cda31726f1b0e74265ff5;hp=10dbaba0abc98739882d31cd8b7815ada5941f72 Reverting r252760 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252770 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/CommandGuide/llvm-symbolizer.rst b/docs/CommandGuide/llvm-symbolizer.rst index dfbf4919abe..9d6571d5c4c 100644 --- a/docs/CommandGuide/llvm-symbolizer.rst +++ b/docs/CommandGuide/llvm-symbolizer.rst @@ -56,14 +56,6 @@ EXAMPLE foo(int) /tmp/a.cc:12 - $cat addr.txt - 0x40054d - $llvm-symbolizer -inlining -print-address -pretty-print -obj=addr.exe < addr.txt - 0x40054d: inc at /tmp/x.c:3:3 - (inlined by) main at /tmp/x.c:9:0 - $llvm-symbolizer -inlining -pretty-print -obj=addr.exe < addr.txt - inc at /tmp/x.c:3:3 - (inlined by) main at /tmp/x.c:9:0 OPTIONS ------- @@ -109,10 +101,6 @@ OPTIONS .. option:: -print-address Print address before the source code location. Defaults to false. -.. option:: -pretty-print - Print human readable output. If ``-inlining`` is specified, enclosing scope is - prefixed by (inlined by). Refer to listed examples. - EXIT STATUS ----------- diff --git a/include/llvm/DebugInfo/Symbolize/DIPrinter.h b/include/llvm/DebugInfo/Symbolize/DIPrinter.h index 0703fb14da6..6e192253d5d 100644 --- a/include/llvm/DebugInfo/Symbolize/DIPrinter.h +++ b/include/llvm/DebugInfo/Symbolize/DIPrinter.h @@ -27,14 +27,10 @@ namespace symbolize { class DIPrinter { raw_ostream &OS; bool PrintFunctionNames; - bool PrintPretty; - void printName(const DILineInfo &Info, bool Inlined); public: - DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true, - bool PrintPretty = false) - : OS(OS), PrintFunctionNames(PrintFunctionNames), - PrintPretty(PrintPretty) {} + DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true) + : OS(OS), PrintFunctionNames(PrintFunctionNames) {} DIPrinter &operator<<(const DILineInfo &Info); DIPrinter &operator<<(const DIInliningInfo &Info); diff --git a/lib/DebugInfo/Symbolize/DIPrinter.cpp b/lib/DebugInfo/Symbolize/DIPrinter.cpp index c6bfbc07dcf..ad5f693d77e 100644 --- a/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/lib/DebugInfo/Symbolize/DIPrinter.cpp @@ -24,35 +24,27 @@ namespace symbolize { static const char kDILineInfoBadString[] = ""; static const char kBadString[] = "??"; -void DIPrinter::printName(const DILineInfo &Info, bool Inlined) { +DIPrinter &DIPrinter::operator<<(const DILineInfo &Info) { if (PrintFunctionNames) { std::string FunctionName = Info.FunctionName; if (FunctionName == kDILineInfoBadString) FunctionName = kBadString; - - StringRef Delimiter = (PrintPretty == true) ? " at " : "\n"; - StringRef Prefix = (PrintPretty && Inlined) ? " (inlined by) " : ""; - OS << Prefix << FunctionName << Delimiter; + OS << FunctionName << "\n"; } std::string Filename = Info.FileName; if (Filename == kDILineInfoBadString) Filename = kBadString; OS << Filename << ":" << Info.Line << ":" << Info.Column << "\n"; -} - -DIPrinter &DIPrinter::operator<<(const DILineInfo &Info) { - printName(Info, false); return *this; } DIPrinter &DIPrinter::operator<<(const DIInliningInfo &Info) { uint32_t FramesNum = Info.getNumberOfFrames(); - if (FramesNum == 0) { - printName(DILineInfo(), false); - return *this; + if (FramesNum == 0) + return (*this << DILineInfo()); + for (uint32_t i = 0; i < FramesNum; i++) { + *this << Info.getFrame(i); } - for (uint32_t i = 0; i < FramesNum; i++) - printName(Info.getFrame(i), i > 0); return *this; } diff --git a/test/tools/llvm-symbolizer/Inputs/addr.exe b/test/tools/llvm-symbolizer/Inputs/addr.exe index d87569319e9..0d9e87dd723 100755 Binary files a/test/tools/llvm-symbolizer/Inputs/addr.exe and b/test/tools/llvm-symbolizer/Inputs/addr.exe differ diff --git a/test/tools/llvm-symbolizer/sym.test b/test/tools/llvm-symbolizer/sym.test index 01a6692222e..559124a44c0 100644 --- a/test/tools/llvm-symbolizer/sym.test +++ b/test/tools/llvm-symbolizer/sym.test @@ -1,30 +1,19 @@ #Source: ##include -#static inline int inctwo (int *a) { -# printf ("%d\n",(*a)++); -# return (*a)++; -#} #static inline int inc (int *a) { -# printf ("%d\n",inctwo(a)); +# printf ("%d\n",(*a)++); # return (*a)++; #} # -# #int main () { # int x = 1; # return inc(&x); #} -# #Build as : clang -g -O2 addr.c -RUN: llvm-symbolizer -print-address -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s -RUN: llvm-symbolizer -inlining -print-address -pretty-print -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck --check-prefix="PRETTY" %s +RUN: llvm-symbolizer -inlining -print-address -obj=%p/Inputs/addr.exe < %p/Inputs/addr.inp | FileCheck %s #CHECK: 0x40054d #CHECK: main -#CHECK: {{[/\]+}}tmp{{[/\]+}}x.c:14:0 -# -#PRETTY: {{[0x]+}}40054d: inctwo at {{[/\]+}}tmp{{[/\]+}}x.c:3:3 -#PRETTY: (inlined by) inc at {{[/\]+}}tmp{{[/\]+}}x.c:7:0 -#PRETTY (inlined by) main at {{[/\]+}}tmp{{[/\]+}}x.c:14:0 +#CHECK: {{[/\]+}}tmp{{[/\]+}}x.c:9:0 diff --git a/tools/llvm-symbolizer/llvm-symbolizer.cpp b/tools/llvm-symbolizer/llvm-symbolizer.cpp index e45660c84c7..d0ef51e6f17 100644 --- a/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -78,10 +78,6 @@ static cl::opt ClPrintAddress("print-address", cl::init(false), cl::desc("Show address before line information")); -static cl::opt - ClPrettyPrint("pretty-print", cl::init(false), - cl::desc("Make the output more human friendly")); - static bool error(std::error_code ec) { if (!ec) return false; @@ -147,7 +143,6 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm-symbolizer\n"); LLVMSymbolizer::Options Opts(ClPrintFunctions, ClUseSymbolTable, ClDemangle, ClUseRelativeAddress, ClDefaultArch); - for (const auto &hint : ClDsymHint) { if (sys::path::extension(hint) == ".dSYM") { Opts.DsymHints.push_back(hint); @@ -161,15 +156,13 @@ int main(int argc, char **argv) { bool IsData = false; std::string ModuleName; uint64_t ModuleOffset; - DIPrinter Printer(outs(), ClPrintFunctions != FunctionNameKind::None, - ClPrettyPrint); + DIPrinter Printer(outs(), ClPrintFunctions != FunctionNameKind::None); while (parseCommand(IsData, ModuleName, ModuleOffset)) { if (ClPrintAddress) { outs() << "0x"; outs().write_hex(ModuleOffset); - StringRef Delimiter = (ClPrettyPrint == true) ? ": " : "\n"; - outs() << Delimiter; + outs() << "\n"; } if (IsData) { auto ResOrErr = Symbolizer.symbolizeData(ModuleName, ModuleOffset);