Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
debug_visitor.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <sysio/vm/interpret_visitor.hpp>
4#include <sysio/vm/opcodes.hpp>
5
6#include <iostream>
7
8#define DBG_VISIT(name, code) \
9 void operator()(const SYS_VM_OPCODE_T(name)& op) { \
10 std::cout << "Found " << #name << " at " << get_context().get_pc() << "\n"; \
11 interpret_visitor<ExecutionCTX>::operator()(op); \
12 get_context().print_stack(); \
13 }
14
15#define DBG2_VISIT(name, code) \
16 void operator()(const SYS_VM_OPCODE_T(name)& op) { std::cout << "Found " << #name << "\n"; }
17
18namespace sysio { namespace vm {
19
20template <typename ExecutionCTX>
21struct debug_visitor : public interpret_visitor<ExecutionCTX> {
22 using interpret_visitor<ExecutionCTX>::operator();
23 debug_visitor(ExecutionCTX& ctx) : interpret_visitor<ExecutionCTX>(ctx) {}
42};
43
44struct debug_visitor2 {
62};
63#undef DBG_VISIT
64#undef DBG2_VISIT
65
66#undef DBG_VISIT
67#undef DBG2_VISIT
68
69}} // ns sysio::wasm_backend
ExecutionCTX & get_context()
debug_visitor(ExecutionCTX &ctx)
#define DBG2_VISIT(name, code)
#define DBG_VISIT(name, code)
#define SYS_VM_F64_CONSTANT_OPS(opcode_macro)
#define SYS_VM_RETURN_OP(opcode_macro)
#define SYS_VM_EXIT_OP(opcode_macro)
#define SYS_VM_COMPARISON_OPS(opcode_macro)
#define SYS_VM_MEMORY_OPS(opcode_macro)
#define SYS_VM_I64_CONSTANT_OPS(opcode_macro)
#define SYS_VM_I32_CONSTANT_OPS(opcode_macro)
#define SYS_VM_CALL_OPS(opcode_macro)
#define SYS_VM_NUMERIC_OPS(opcode_macro)
#define SYS_VM_CONVERSION_OPS(opcode_macro)
#define SYS_VM_VARIABLE_ACCESS_OPS(opcode_macro)
#define SYS_VM_CALL_IMM_OPS(opcode_macro)
#define SYS_VM_CONTROL_FLOW_OPS(opcode_macro)
#define SYS_VM_ERROR_OPS(opcode_macro)
#define SYS_VM_PARAMETRIC_OPS(opcode_macro)
#define SYS_VM_F32_CONSTANT_OPS(opcode_macro)
#define SYS_VM_BR_TABLE_OP(opcode_macro)