[PATCH] D34155: Improve error messages in order to help with fixing a big-endian bug.
Eric Beckmann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 11:18:22 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL305314: Improve error messages in order to help with fixing a big-endian bug. (authored by ecbeckmann).
Changed prior to commit:
https://reviews.llvm.org/D34155?vs=102366&id=102367#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34155
Files:
llvm/trunk/include/llvm/Object/WindowsResource.h
llvm/trunk/lib/Object/WindowsResource.cpp
llvm/trunk/test/tools/llvm-cvtres/combined.test
llvm/trunk/test/tools/llvm-cvtres/object.test
llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
Index: llvm/trunk/lib/Object/WindowsResource.cpp
===================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp
+++ llvm/trunk/lib/Object/WindowsResource.cpp
@@ -70,7 +70,7 @@
const WindowsResource *Owner, Error &Err)
: Reader(Ref), OwningRes(Owner) {
if (loadNext())
- Err = make_error<GenericBinaryError>("Could not read first entry.",
+ Err = make_error<GenericBinaryError>("Could not read first entry.\n",
object_error::unexpected_eof);
}
@@ -156,8 +156,8 @@
return Error::success();
}
-void WindowsResourceParser::printTree() const {
- ScopedPrinter Writer(outs());
+void WindowsResourceParser::printTree(raw_ostream &OS) const {
+ ScopedPrinter Writer(OS);
Root.print(Writer, "Resource Tree");
}
Index: llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
===================================================================
--- llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
+++ llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
@@ -191,11 +191,23 @@
error(Parser.parse(RF));
}
- if (Verbose)
- Parser.printTree();
+ if (Verbose) {
+ Parser.printTree(outs());
+ Parser.printTree(errs());
+ }
error(
llvm::object::writeWindowsResourceCOFF(OutputFile, MachineType, Parser));
+ if (Verbose) {
+ Expected<object::OwningBinary<object::Binary>> BinaryOrErr =
+ object::createBinary(OutputFile);
+ if (!BinaryOrErr)
+ reportError(OutputFile, errorToErrorCode(BinaryOrErr.takeError()));
+ Binary &Binary = *BinaryOrErr.get().getBinary();
+ ScopedPrinter W(errs());
+ W.printBinaryBlock("Output File Raw Data", Binary.getData());
+ }
+
return 0;
}
Index: llvm/trunk/include/llvm/Object/WindowsResource.h
===================================================================
--- llvm/trunk/include/llvm/Object/WindowsResource.h
+++ llvm/trunk/include/llvm/Object/WindowsResource.h
@@ -118,7 +118,7 @@
class TreeNode;
WindowsResourceParser();
Error parse(WindowsResource *WR);
- void printTree() const;
+ void printTree(raw_ostream &OS) const;
const TreeNode &getTree() const { return Root; }
const ArrayRef<std::vector<uint8_t>> getData() const { return Data; }
const ArrayRef<std::vector<UTF16>> getStringTable() const {
Index: llvm/trunk/test/tools/llvm-cvtres/object.test
===================================================================
--- llvm/trunk/test/tools/llvm-cvtres/object.test
+++ llvm/trunk/test/tools/llvm-cvtres/object.test
@@ -7,7 +7,7 @@
// > cvtres /machine:X86 /readonly /nologo /out:test_resource.obj.coff \
// test_resource.res
-RUN: llvm-cvtres /out:%t %p/Inputs/test_resource.res
+RUN: llvm-cvtres /verbose /out:%t %p/Inputs/test_resource.res
RUN: llvm-readobj -coff-resources -section-data %t | FileCheck %s
CHECK: Resources [
Index: llvm/trunk/test/tools/llvm-cvtres/combined.test
===================================================================
--- llvm/trunk/test/tools/llvm-cvtres/combined.test
+++ llvm/trunk/test/tools/llvm-cvtres/combined.test
@@ -8,7 +8,7 @@
// > cvtres /machine:X86 /readonly /nologo /out:combined.obj.coff \
// languages.res test_resource.res
-RUN: llvm-cvtres /out:%t %p/Inputs/languages.res %p/Inputs/test_resource.res
+RUN: llvm-cvtres /verbose /out:%t %p/Inputs/languages.res %p/Inputs/test_resource.res
RUN: llvm-readobj -coff-resources -section-data %t | FileCheck %s
CHECK: Resources [
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34155.102367.patch
Type: text/x-patch
Size: 3507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/4797c554/attachment.bin>
More information about the llvm-commits
mailing list