Currently, artificial "wrapper" types are created for pointer types. These wrappers display Wasm pointers as i32. To dereference such wrapper/pointer the function's vmctx is needed. This PR is an attempt to provide overrides for artificial type for operator* and operator->.
The runtime/host has to have set_vmctx_memory and resolve_vmctx_memory_ptr builtins. The former sets current context and the former derefernces the Wasm pointer using current context's memory base.
During LLDB session, a user has to call __vmctx.set() to set the current context before calling any dereference operators. It can be automated via e.g. command regex pp 's/(.+)/p __vmctx->set(),%1/'.
Process 50041 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001042ca05d JIT(0x105000600)`check(i=1) at t.c:13:3
10
11 int check(size_t i) {
12 struct Test *y = t + i;
-> 13 y->i++;
14 return y->j;
15 }
16
(lldb) p y
(WebAssemblyPtrWrapper<Test>) $0 = (__ptr = 1032)
(lldb) pp *y
(Test) $1 = (i = 3, j = 4)
(lldb) pp y->j
(int) $2 = 4
(lldb) fr v
(WasmtimeVMContext *) __vmctx = 0x0000000103503ba0
(size_t) i = 1
(WebAssemblyPtrWrapper<Test>) y = (__ptr = 1032)