mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-04 01:11:44 +00:00
Improve error messages in order to help with fixing a big-endian bug.
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 llvm-svn: 305314
This commit is contained in:
parent
0f32ca6059
commit
555c3d5066
@ -118,7 +118,7 @@ public:
|
||||
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 {
|
||||
|
@ -70,7 +70,7 @@ ResourceEntryRef::ResourceEntryRef(BinaryStreamRef Ref,
|
||||
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 @@ Error WindowsResourceParser::parse(WindowsResource *WR) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -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 [
|
||||
|
@ -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 [
|
||||
|
@ -191,11 +191,23 @@ int main(int argc_, const char *argv_[]) {
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user