Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (30 loc) · 1.1 KB

File metadata and controls

38 lines (30 loc) · 1.1 KB
Copy raw file
Download raw file
Edit and raw actions

Debugging WebAssembly

The following steps describe a common way to debug a WebAssembly module in Wasmtime:

  1. Compile your WebAssembly with debug info enabled, usually -g; for example:

    clang foo.c -g -o foo.wasm
  2. Run Wasmtime with the debug info enabled; this is -g from the CLI and Config::debug_info(true) in an embedding (e.g. see debugging in a Rust embedding)

  3. Use a supported debugger:

    lldb -- wasmtime run -g foo.wasm
    gdb --args wasmtime run -g foo.wasm

If you run into trouble, the following discussions might help:

  • On MacOS with LLDB you may need to run: settings set plugin.jit-loader.gdb.enable on (#1953)
  • With LLDB, call __vmctx.set() to set the current context before calling any dereference operators (#1482):
    (lldb) p __vmctx->set()
    (lldb) p *foo
  • The address of the start of instance memory can be found in __vmctx->memory
Morty Proxy This is a proxified and sanitized view of the page, visit original site.