llvm.org GIT mirror llvm / f9d223b
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305314 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Beckmann 2 years ago
5 changed file(s) with 20 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
117117 class TreeNode;
118118 WindowsResourceParser();
119119 Error parse(WindowsResource *WR);
120 void printTree() const;
120 void printTree(raw_ostream &OS) const;
121121 const TreeNode &getTree() const { return Root; }
122122 const ArrayRef> getData() const { return Data; }
123123 const ArrayRef> getStringTable() const {
6969 const WindowsResource *Owner, Error &Err)
7070 : Reader(Ref), OwningRes(Owner) {
7171 if (loadNext())
72 Err = make_error("Could not read first entry.",
72 Err = make_error("Could not read first entry.\n",
7373 object_error::unexpected_eof);
7474 }
7575
155155 return Error::success();
156156 }
157157
158 void WindowsResourceParser::printTree() const {
159 ScopedPrinter Writer(outs());
158 void WindowsResourceParser::printTree(raw_ostream &OS) const {
159 ScopedPrinter Writer(OS);
160160 Root.print(Writer, "Resource Tree");
161161 }
162162
77 // > cvtres /machine:X86 /readonly /nologo /out:combined.obj.coff \
88 // languages.res test_resource.res
99
10 RUN: llvm-cvtres /out:%t %p/Inputs/languages.res %p/Inputs/test_resource.res
10 RUN: llvm-cvtres /verbose /out:%t %p/Inputs/languages.res %p/Inputs/test_resource.res
1111 RUN: llvm-readobj -coff-resources -section-data %t | FileCheck %s
1212
1313 CHECK: Resources [
66 // > cvtres /machine:X86 /readonly /nologo /out:test_resource.obj.coff \
77 // test_resource.res
88
9 RUN: llvm-cvtres /out:%t %p/Inputs/test_resource.res
9 RUN: llvm-cvtres /verbose /out:%t %p/Inputs/test_resource.res
1010 RUN: llvm-readobj -coff-resources -section-data %t | FileCheck %s
1111
1212 CHECK: Resources [
190190 error(Parser.parse(RF));
191191 }
192192
193 if (Verbose)
194 Parser.printTree();
193 if (Verbose) {
194 Parser.printTree(outs());
195 Parser.printTree(errs());
196 }
195197
196198 error(
197199 llvm::object::writeWindowsResourceCOFF(OutputFile, MachineType, Parser));
198200
201 if (Verbose) {
202 Expected> BinaryOrErr =
203 object::createBinary(OutputFile);
204 if (!BinaryOrErr)
205 reportError(OutputFile, errorToErrorCode(BinaryOrErr.takeError()));
206 Binary &Binary = *BinaryOrErr.get().getBinary();
207 ScopedPrinter W(errs());
208 W.printBinaryBlock("Output File Raw Data", Binary.getData());
209 }
210
199211 return 0;
200212 }