From b284c48616fff555752b426f3792c0a24aad8ac1 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 31 Oct 2016 16:58:52 -0700 Subject: wasmdump improvments (#192) * wasmdump improvments - Split into three different passes: headers, details, and raw - Nest imports correctly - Show element count as part of section header rather than on its own line --- src/wasm-binary-reader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/wasm-binary-reader.c') diff --git a/src/wasm-binary-reader.c b/src/wasm-binary-reader.c index 21b2169d..950b6752 100644 --- a/src/wasm-binary-reader.c +++ b/src/wasm-binary-reader.c @@ -589,7 +589,7 @@ static void logging_on_error(WasmBinaryReaderContext* ctx, FORWARD0(name); \ } -LOGGING0(begin_module) +LOGGING_UINT32(begin_module) LOGGING0(end_module) LOGGING_BEGIN(signature_section) LOGGING_UINT32(on_signature_count) @@ -1706,8 +1706,6 @@ WasmResult wasm_read_binary(WasmAllocator* allocator, wasm_reserve_uint32s(allocator, &ctx->target_depths, INITIAL_BR_TABLE_TARGET_CAPACITY); - CALLBACK0(begin_module); - uint32_t magic; in_u32(ctx, &magic, "magic"); RAISE_ERROR_UNLESS(magic == WASM_BINARY_MAGIC, "bad magic value"); @@ -1717,6 +1715,8 @@ WasmResult wasm_read_binary(WasmAllocator* allocator, "bad wasm file version: %#x (expected %#x)", version, WASM_BINARY_VERSION); + CALLBACK(begin_module, version); + /* type */ uint32_t section_size; if (skip_until_section(ctx, WASM_BINARY_SECTION_TYPE, §ion_size)) { -- cgit v1.2.3