diff options
author | dan sinclair <dj2@everburning.com> | 2018-06-19 16:02:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-19 16:02:44 -0400 |
commit | f80696eaf64298ab60e545086a6a5ab8be2c5ac1 (patch) | |
tree | 00b4dca4162a3f7bee8be95f33b4b501a2aa28ef /tools | |
parent | 356193ea8cc9aa05c89bc67c10c6cd072ce97b8d (diff) |
[val] Add extra context to error messages. (#1600)
[val] Add extra context to error messages.
This CL extends the error messages produced by the validator to output the
disassembly of the errored line.
The validation_id messages have also been updated to print the line number of
the error instead of the word number. Note, the error number is from the start
of the SPIR-V, it does not include any headers printed in the disassembled code.
Fixes #670, #1581
Diffstat (limited to 'tools')
-rw-r--r-- | tools/io.h | 5 | ||||
-rw-r--r-- | tools/val/val.cpp | 7 |
2 files changed, 8 insertions, 4 deletions
@@ -39,7 +39,10 @@ bool ReadFile(const char* filename, const char* mode, std::vector<T>* data) { } } else { if (sizeof(T) != 1 && (ftell(fp) % sizeof(T))) { - fprintf(stderr, "error: corrupted word found in file '%s'\n", filename); + fprintf( + stderr, + "error: file size should be a multiple of %zd; file '%s' corrupt\n", + sizeof(T), filename); return false; } } diff --git a/tools/val/val.cpp b/tools/val/val.cpp index 7c215e4d..ca16f2dd 100644 --- a/tools/val/val.cpp +++ b/tools/val/val.cpp @@ -163,15 +163,16 @@ int main(int argc, char** argv) { case SPV_MSG_FATAL: case SPV_MSG_INTERNAL_ERROR: case SPV_MSG_ERROR: - std::cerr << "error: " << position.index << ": " << message + std::cerr << "error: line " << position.index << ": " << message << std::endl; break; case SPV_MSG_WARNING: - std::cout << "warning: " << position.index << ": " << message + std::cout << "warning: line " << position.index << ": " << message << std::endl; break; case SPV_MSG_INFO: - std::cout << "info: " << position.index << ": " << message << std::endl; + std::cout << "info: line " << position.index << ": " << message + << std::endl; break; default: break; |