[PATCH] D148032: [symbolizer] Change error message if module not found
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 10:13:10 PDT 2023
sepavloff created this revision.
sepavloff added reviewers: jhenderson, mgorny, MaskRay, dblaikie.
Herald added a subscriber: hiraditya.
Herald added a project: All.
sepavloff requested review of this revision.
Herald added a project: LLVM.
If llvm-symbolize did not find module, the error looked like:
LLVMSymbolizer: error reading file: No such file or directory
This message does not follow common practice: LLVMSymbolizer is not an
utility name. Also the message did not not contain the name of missed file.
With this change the error message looks differently:
llvm-symbolizer: error: 'abc': No such file or directory
This format is closer to messages produced by other utilities and allow
proper coloring.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148032
Files:
llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
llvm/test/tools/llvm-symbolizer/debuginfod-missing-build-id.test
llvm/test/tools/llvm-symbolizer/output-style-inlined.test
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Index: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
===================================================================
--- llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -94,11 +94,11 @@
// Handle the error.
bool PrintEmpty = true;
- handleAllErrors(std::move(ResOrErr.takeError()),
- [&](const ErrorInfoBase &EI) {
- PrintEmpty = Printer.printError(
- Request, EI, "LLVMSymbolizer: error reading file: ");
- });
+ handleAllErrors(
+ std::move(ResOrErr.takeError()), [&](const ErrorInfoBase &EI) {
+ PrintEmpty =
+ Printer.printError(Request, EI, "llvm-symbolizer: error: ");
+ });
if (PrintEmpty)
Printer.print(Request, T());
Index: llvm/test/tools/llvm-symbolizer/output-style-inlined.test
===================================================================
--- llvm/test/tools/llvm-symbolizer/output-style-inlined.test
+++ llvm/test/tools/llvm-symbolizer/output-style-inlined.test
@@ -37,13 +37,13 @@
RUN: llvm-symbolizer --output-style=LLVM --obj=%p/Inputs/not.exist 0x1 0x2 --no-inlines 2>&1 \
RUN: | FileCheck %s --check-prefix=NOT-EXIST-LLVM -DMSG=%errc_ENOENT
-# NOT-EXIST-GNU: LLVMSymbolizer: error reading file: [[MSG]]
+# NOT-EXIST-GNU: llvm-symbolizer: error: '{{.*}}Inputs/not.exist': [[MSG]]
# NOT-EXIST-GNU-NEXT: ??
# NOT-EXIST-GNU-NEXT: ??:0
# NOT-EXIST-GNU-NEXT: ??
# NOT-EXIST-GNU-NEXT: ??:0
-# NOT-EXIST-LLVM: LLVMSymbolizer: error reading file: [[MSG]]
+# NOT-EXIST-LLVM: llvm-symbolizer: error: '{{.*}}Inputs/not.exist': [[MSG]]
# NOT-EXIST-LLVM-NEXT: ??
# NOT-EXIST-LLVM-NEXT: ??:0:0
# NOT-EXIST-LLVM-EMPTY:
Index: llvm/test/tools/llvm-symbolizer/debuginfod-missing-build-id.test
===================================================================
--- llvm/test/tools/llvm-symbolizer/debuginfod-missing-build-id.test
+++ llvm/test/tools/llvm-symbolizer/debuginfod-missing-build-id.test
@@ -7,4 +7,4 @@
STDOUT: ??
STDOUT: ??:0:0
-STDERR-COUNT-2: LLVMSymbolizer: error reading file: could not find build ID 'ABAD'
+STDERR-COUNT-2: llvm-symbolizer: error: 'ABAD': could not find build ID
Index: llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
===================================================================
--- llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -632,8 +632,7 @@
std::string Path;
if (!getOrFindDebugBinary(BuildID, Path)) {
return createStringError(errc::no_such_file_or_directory,
- Twine("could not find build ID '") +
- toHex(BuildID) + "'");
+ "could not find build ID");
}
return getOrCreateModuleInfo(Path);
}
Index: llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
===================================================================
--- llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
+++ llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
@@ -273,7 +273,7 @@
bool PlainPrinterBase::printError(const Request &Request,
const ErrorInfoBase &ErrorInfo,
StringRef ErrorBanner) {
- ES << ErrorBanner;
+ ES << ErrorBanner << '\'' << Request.ModuleName << "': ";
ErrorInfo.log(ES);
ES << '\n';
// Print an empty struct too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148032.512507.patch
Type: text/x-patch
Size: 3394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/9a57684a/attachment.bin>
More information about the llvm-commits
mailing list