wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

How do you check the stack value when the WASM program is running the iwasm?

Open xubenji opened this issue 8 months ago • 1 comments

The WASM program doesn't like the normal X86 or arm program. It doesn't have the registers, so we can't get the stack memory address. I wonder how to check the stack memory info with lldb? Thank you very much!

xubenji avatar Nov 27 '23 19:11 xubenji

Hi, the official lldb doesn't have the ability to get the operand stack values. In WAMR, we use a patch https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/build-scripts/lldb_wasm.patch to add some extended capabilities:

  1. process extended DW_OP_WASM_location opcode as defined here
  2. add a custom gdb serial command qWasmStackValue <frame index> <index> to get the index slot of the specified frame

xujuntwt95329 avatar Nov 30 '23 14:11 xujuntwt95329