From: Brendan Hansen Date: Fri, 9 Jul 2021 18:59:41 +0000 (-0500) Subject: added code printing X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=e845355d2d98a87ee0e4945b92c893b4f01986ec;p=onyx-wasm-analyzer.git added code printing --- diff --git a/src/test_console.onyx b/src/test_console.onyx index 3b0a60b..a3d6681 100644 --- a/src/test_console.onyx +++ b/src/test_console.onyx @@ -17,9 +17,18 @@ main :: (args: [] cstr) { wasm_sections := wasm.parse_sections(^wasm_binary, context.allocator); defer wasm.free_sections(^wasm_sections); - printf("Types:\n{p}\n", wasm_sections.type_section); - printf("Imports:\n{p}\n", wasm_sections.import_section); - printf("Exports:\n{p}\n", wasm_sections.export_section); + + i := 0; + for ^code: wasm_sections.code_section { + i += 1; + printf("Function {}\n", i); + for instr: wasm.instruction_iterator(^wasm_binary, code) { + printf("{}\n", instr); + } + print("\n"); + } + + // printf("Code:\n{}\n", wasm_sections.code_section); // type_section := wasm.parse_type_section(^wasm_binary);