cpunion opened issue #15290:
A fresh compilation cache can retain an LLDB software breakpoint in compiled code. The first debug session succeeds; the second loads the cached breakpoint instruction and repeatedly stops at the same address after stepping.
-Ccache=navoids the problem.Reproduced with Wasmtime 48.0.1 (
7bac2c277) and 46.0.3 (c5569e6aa) on macOS arm64, Apple LLDB 2103.0.34.103 / Swift 6.4, Clang 22.1.8. The following C reproducer needs no Go runtime, threads, or WASI imports:__attribute__((noinline)) int probe(int input) { volatile int local = input + 7; return local; } volatile int output; void _start(void) { output = probe(14); }clang --target=wasm32-unknown-unknown -g -O0 -nostdlib \ -Wl,--no-entry -Wl,--export=_start probe.c -o probe.wasm mkdir -p "$PWD/repro-cache" printf '[cache]\ndirectory = "%s/repro-cache"\n' "$PWD" > cache.toml # Run this exact command twice, using the same initially empty private cache. lldb --batch \ -O 'settings set plugin.jit-loader.gdb.enable on' \ -o 'breakpoint set --name probe' -o run \ -o 'thread step-over' -o 'frame variable local' -o continue \ -- /path/to/wasmtime run \ "-Ccache=y,cache-config=$PWD/cache.toml" \ -Ddebug-info=y -Oopt-level=0 "$PWD/probe.wasm"First run:
stop reason = step over (volatile int) local = 21 Process ... exited with status = 0Second run:
stop reason = EXC_BREAKPOINT (code=1, subcode=...)Further stepping stays on that instruction. In the larger threaded fixture where this was first found, disassembly still showed
brk #0at the previous breakpoint after deleting it; a separately compiled artifact had the originalldrthere. Disabling the compilation cache restores stepping on the same Wasm input.My inference is that JIT registration lets LLDB patch native code before cache-miss serialization captures it. Cache serialization should not persist debugger-modified instructions. Debugger sessions also need to avoid loading entries already affected by this problem.
alexcrichton closed issue #15290:
A fresh compilation cache can retain an LLDB software breakpoint in compiled code. The first debug session succeeds; the second loads the cached breakpoint instruction and repeatedly stops at the same address after stepping.
-Ccache=navoids the problem.Reproduced with Wasmtime 48.0.1 (
7bac2c277) and 46.0.3 (c5569e6aa) on macOS arm64, Apple LLDB 2103.0.34.103 / Swift 6.4, Clang 22.1.8. The following C reproducer needs no Go runtime, threads, or WASI imports:__attribute__((noinline)) int probe(int input) { volatile int local = input + 7; return local; } volatile int output; void _start(void) { output = probe(14); }clang --target=wasm32-unknown-unknown -g -O0 -nostdlib \ -Wl,--no-entry -Wl,--export=_start probe.c -o probe.wasm mkdir -p "$PWD/repro-cache" printf '[cache]\ndirectory = "%s/repro-cache"\n' "$PWD" > cache.toml # Run this exact command twice, using the same initially empty private cache. lldb --batch \ -O 'settings set plugin.jit-loader.gdb.enable on' \ -o 'breakpoint set --name probe' -o run \ -o 'thread step-over' -o 'frame variable local' -o continue \ -- /path/to/wasmtime run \ "-Ccache=y,cache-config=$PWD/cache.toml" \ -Ddebug-info=y -Oopt-level=0 "$PWD/probe.wasm"First run:
stop reason = step over (volatile int) local = 21 Process ... exited with status = 0Second run:
stop reason = EXC_BREAKPOINT (code=1, subcode=...)Further stepping stays on that instruction. In the larger threaded fixture where this was first found, disassembly still showed
brk #0at the previous breakpoint after deleting it; a separately compiled artifact had the originalldrthere. Disabling the compilation cache restores stepping on the same Wasm input.My inference is that JIT registration lets LLDB patch native code before cache-miss serialization captures it. Cache serialization should not persist debugger-modified instructions. Debugger sessions also need to avoid loading entries already affected by this problem.
alexcrichton commented on issue #15290:
I believe this is a duplicate of https://github.com/bytecodealliance/wasmtime/issues/13865, so I'm going to close in favor of that.
Last updated: Nov 19 2026 at 20:05 UTC