summaryrefslogtreecommitdiff
path: root/src/binary-reader.c
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-01-23 11:18:54 -0800
committerGitHub <noreply@github.com>2017-01-23 11:18:54 -0800
commit5a658b3f2b90cce2bb3d81994828d29b74e41958 (patch)
tree3c699b33173c95875a7a0a474456b438c02b29f7 /src/binary-reader.c
parenta6a3ff9398e06690081d8d41353ad3715ee19e7a (diff)
downloadwabt-5a658b3f2b90cce2bb3d81994828d29b74e41958.tar.gz
wabt-5a658b3f2b90cce2bb3d81994828d29b74e41958.tar.bz2
wabt-5a658b3f2b90cce2bb3d81994828d29b74e41958.zip
Add function names and relocations to wasmdump disassembly (#285)
Diffstat (limited to 'src/binary-reader.c')
-rw-r--r--src/binary-reader.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/binary-reader.c b/src/binary-reader.c
index e98def74..ebb3b69f 100644
--- a/src/binary-reader.c
+++ b/src/binary-reader.c
@@ -507,6 +507,14 @@ static WasmResult logging_begin_custom_section(WasmBinaryReaderContext* context,
FORWARD(name, value); \
}
+#define LOGGING_UINT32_CTX(name) \
+ static WasmResult logging_##name(WasmBinaryReaderContext* context, \
+ uint32_t value) { \
+ LoggingContext* ctx = context->user_data; \
+ LOGF(#name "(%u)\n", value); \
+ FORWARD_CTX(name, value); \
+ }
+
#define LOGGING_UINT32_DESC(name, desc) \
static WasmResult logging_##name(uint32_t value, void* user_data) { \
LoggingContext* ctx = user_data; \
@@ -577,7 +585,7 @@ LOGGING_UINT32(on_start_function)
LOGGING_END(start_section)
LOGGING_BEGIN(function_bodies_section)
LOGGING_UINT32(on_function_bodies_count)
-LOGGING_UINT32(begin_function_body)
+LOGGING_UINT32_CTX(begin_function_body)
LOGGING_UINT32(end_function_body)
LOGGING_UINT32(on_local_decl_count)
LOGGING_OPCODE(on_binary_expr)
@@ -1985,7 +1993,7 @@ static void read_code_section(Context* ctx, uint32_t section_size) {
uint32_t func_index = ctx->num_func_imports + i;
uint32_t func_offset = ctx->offset;
ctx->offset = func_offset;
- CALLBACK(begin_function_body, func_index);
+ CALLBACK_CTX(begin_function_body, func_index);
uint32_t body_size;
in_u32_leb128(ctx, &body_size, "function body size");
uint32_t body_start_offset = ctx->offset;