aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2023-04-14 17:37:25 +0700
committerSerge Pavlov <sepavloff@gmail.com>2023-04-14 17:37:25 +0700
commit7a443b1c493df49299f8ceb6275f2502bdf6a79c (patch)
tree05a0a5b2017a0792a811068f6d5785bc259c416e /llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
parent98e50881e91f2d01563282add0b9bb07992a2e0f (diff)
downloadllvm-7a443b1c493df49299f8ceb6275f2502bdf6a79c.zip
llvm-7a443b1c493df49299f8ceb6275f2502bdf6a79c.tar.gz
llvm-7a443b1c493df49299f8ceb6275f2502bdf6a79c.tar.bz2
Revert "[symbolizer] Change error message if module not found"
This reverts commit 75f1f158812dabc03e70697b6b9c272230bce63d. It caused fail on https://lab.llvm.org/buildbot#builders/37/builds/21461
Diffstat (limited to 'llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp')
-rw-r--r--llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index bcbf284..419f998 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -36,7 +36,6 @@
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/StringSaver.h"
-#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstdio>
@@ -84,16 +83,6 @@ public:
};
} // namespace
-static std::string ToolName;
-
-static void printError(const ErrorInfoBase &EI, StringRef Path) {
- WithColor::error(errs(), ToolName);
- if (!EI.isA<FileError>())
- errs() << "'" << Path << "': ";
- EI.log(errs());
- errs() << '\n';
-}
-
template <typename T>
static void print(const Request &Request, Expected<T> &ResOrErr,
DIPrinter &Printer) {
@@ -107,7 +96,8 @@ static void print(const Request &Request, Expected<T> &ResOrErr,
bool PrintEmpty = true;
handleAllErrors(std::move(ResOrErr.takeError()),
[&](const ErrorInfoBase &EI) {
- PrintEmpty = Printer.printError(Request, EI);
+ PrintEmpty = Printer.printError(
+ Request, EI, "LLVMSymbolizer: error reading file: ");
});
if (PrintEmpty)
@@ -388,8 +378,7 @@ int main(int argc, char **argv) {
InitLLVM X(argc, argv);
sys::InitializeCOMRAII COM(sys::COMThreadingMode::MultiThreaded);
- ToolName = argv[0];
- bool IsAddr2Line = sys::path::stem(ToolName).contains("addr2line");
+ bool IsAddr2Line = sys::path::stem(argv[0]).contains("addr2line");
BumpPtrAllocator A;
StringSaver Saver(A);
SymbolizerOptTable Tbl;
@@ -472,11 +461,11 @@ int main(int argc, char **argv) {
std::unique_ptr<DIPrinter> Printer;
if (Style == OutputStyle::GNU)
- Printer = std::make_unique<GNUPrinter>(outs(), printError, Config);
+ Printer = std::make_unique<GNUPrinter>(outs(), errs(), Config);
else if (Style == OutputStyle::JSON)
Printer = std::make_unique<JSONPrinter>(outs(), Config);
else
- Printer = std::make_unique<LLVMPrinter>(outs(), printError, Config);
+ Printer = std::make_unique<LLVMPrinter>(outs(), errs(), Config);
std::vector<std::string> InputAddresses = Args.getAllArgValues(OPT_INPUT);
if (InputAddresses.empty()) {