Summary: Added output to stderr so that we can actually see what is happening when the test fails on big endian.
Reviewers: zturner
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D34155
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305314
91177308-0d34-0410-b5e6-
96231b3b80d8
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 {
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);
}
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");
}
// > 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 [
// > 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 [
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;
}