diff options
author | Sam Clegg <sbc@chromium.org> | 2017-03-16 18:27:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 18:27:38 -0700 |
commit | 264a9505ecf8dc8834a2f9842793f6d91ad6803b (patch) | |
tree | 19099ff1c588f71655d680f047b698a02430180d /src/binary-reader.cc | |
parent | 5b642c3ce487b77102dec4fc4b55538cfbccc5ff (diff) | |
download | wabt-264a9505ecf8dc8834a2f9842793f6d91ad6803b.tar.gz wabt-264a9505ecf8dc8834a2f9842793f6d91ad6803b.tar.bz2 wabt-264a9505ecf8dc8834a2f9842793f6d91ad6803b.zip |
Add callback for end opcode and end of function (#358)
Without this objdump doesn't show the final byte/opcode
of each function.
Diffstat (limited to 'src/binary-reader.cc')
-rw-r--r-- | src/binary-reader.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/binary-reader.cc b/src/binary-reader.cc index 1c30fae7..27c54157 100644 --- a/src/binary-reader.cc +++ b/src/binary-reader.cc @@ -1161,7 +1161,7 @@ static void read_global_header(Context* ctx, uint8_t mutable_; in_type(ctx, &global_type, "global type"); RAISE_ERROR_UNLESS(is_concrete_type(global_type), - "expected valid global type"); + "invalid global type: %#x", static_cast<int>(global_type)); in_u8(ctx, &mutable_, "global mutability"); RAISE_ERROR_UNLESS(mutable_ <= 1, "global mutability must be 0 or 1"); @@ -1281,10 +1281,12 @@ static void read_function_body(Context* ctx, uint32_t end_offset) { break; case Opcode::End: - if (ctx->offset == end_offset) + if (ctx->offset == end_offset) { seen_end_opcode = true; - else + CALLBACK0(on_end_func); + } else { CALLBACK0(on_end_expr); + } break; case Opcode::I32Const: { |