Stream: git-wasmtime

Topic: wasmtime / issue #14062 Guest-debug gdbstub omits shared ...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2026 at 07:55):

cpunion opened issue #14062:

Reproduction

Wasmtime's built-in guest-debug gdbstub does not expose a shared linear memory in its synthetic address space. This prevents LLDB from reading globals and runtime-backed values even though source breakpoints, Wasm locals, and backtraces work.

main.wat:

(module
  (memory (export "memory") 1 1 shared)
  (func $entry (export "_start")
    i32.const 0
    i32.const 42
    i32.store
    unreachable))

Build and start guest debugging:

wat2wasm --debug-names --enable-threads main.wat -o main.wasm
wasmtime run -g 1234 -W threads=y,shared-memory=y main.wasm

Using a Wasm-aware LLDB:

(lldb) target create main.wasm
(lldb) process connect --plugin wasm connect://127.0.0.1:1234
(lldb) continue
# stopped at the final `unreachable`, after storing 42
(lldb) process plugin packet send qXfer:memory-map:read::0,ffff
response: ...<memory-map><memory type="rom" start="0x4000000000000000" length="0x51"/></memory-map>
(lldb) memory read --size 4 --format decimal --count 1 0x0
error: memory read failed for 0x0

The equivalent unshared memory is reported as a ram region at address 0 and can be read successfully.

Expected result

The shared memory should appear in the RSP memory map and support reads while the guest is stopped, just like an unshared memory. Guest source-language adapters need this to inspect globals and runtime values.

Likely cause

Instance::debug_memory intentionally returns only unshared Memory and directs callers to debug_shared_memory for shared memory:

https://github.com/bytecodealliance/wasmtime/blob/v47.0.3/crates/wasmtime/src/runtime/debug.rs#L202-L247

However, the debugger host API's instance_get_memory only calls debug_memory:

https://github.com/bytecodealliance/wasmtime/blob/v47.0.3/crates/debugger/src/host/opaque.rs#L166-L173

The gdbstub address-space implementation consequently has no shared-memory resource to enumerate:

https://github.com/bytecodealliance/wasmtime/blob/v47.0.3/crates/gdbstub-component/src/addr.rs#L60-L78

It looks like the debugger resource abstraction needs to represent both Memory and SharedMemory, then implement size/read/write operations for both.

Environment

This was found while implementing WASI source debugging for xgo-dev/llgo#2164, but the WAT reproduction is independent of LLGo.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2026 at 16:36):

alexcrichton added the wasmtime:debugging label to Issue #14062.


Last updated: Aug 30 2026 at 09:07 UTC