Skip to content

Conversation

@cfallin
Copy link
Member

@cfallin cfallin commented Oct 15, 2025

This permits use of ordinary store accessors, such as GC object accessors, while viewing the stack. In #11835 and related discussion, we've concluded that (i) it is safe to provide this mutable access, including e.g. ability to do a GC, because debugger access comes only at points that are morally like hostcalls (right now, literally with a Caller, and eventually with debug yields); and (ii) we will need this in order to provide the full range of expected debugger functionality. Even before mutation-during-debugging comes into play, with the API before this change, it was not possible to read GC objects at all (because all accessors take a mutable store).

Closes #11835 (this addresses the broader question of access from the debugger, and it seems there wasn't a desire to actually refactor as that issue initially suggested).

…nd provide `AsContextMut`.

This permits use of ordinary store accessors, such as GC object
accessors, while viewing the stack. In bytecodealliance#11835 and related discussion,
we've concluded that (i) it is safe to provide this mutable access,
including e.g. ability to do a GC, because debugger access comes only
at points that are morally like hostcalls (right now, literally with a
`Caller`, and eventually with debug yields); and (ii) we will need
this in order to provide the full range of expected debugger
functionality. Even before mutation-during-debugging comes into play,
with the API before this change, it was not possible to read GC
objects at all (because all accessors take a mutable store).
@cfallin cfallin requested a review from a team as a code owner October 15, 2025 23:00
@cfallin cfallin requested review from alexcrichton and removed request for a team October 15, 2025 23:00
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Oct 16, 2025
@cfallin cfallin enabled auto-merge October 16, 2025 21:40
@cfallin cfallin added this pull request to the merge queue Oct 16, 2025
auto-merge was automatically disabled October 16, 2025 22:23

Pull Request is not mergeable

Merged via the queue into bytecodealliance:main with commit 0203385 Oct 16, 2025
45 checks passed
@cfallin cfallin deleted the wasmtime-debug-store-context branch October 16, 2025 22:25
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
…nd provide `AsContextMut`. (bytecodealliance#11873)

* Debug API: switch `DebugFrameCursor` over to monomorphization on T, and provide `AsContextMut`.

This permits use of ordinary store accessors, such as GC object
accessors, while viewing the stack. In bytecodealliance#11835 and related discussion,
we've concluded that (i) it is safe to provide this mutable access,
including e.g. ability to do a GC, because debugger access comes only
at points that are morally like hostcalls (right now, literally with a
`Caller`, and eventually with debug yields); and (ii) we will need
this in order to provide the full range of expected debugger
functionality. Even before mutation-during-debugging comes into play,
with the API before this change, it was not possible to read GC
objects at all (because all accessors take a mutable store).

* Review feedback.

* Fix some disable-feature builds.
@cfallin cfallin added the wasmtime:debugging Issues related to debugging of JIT'ed code label Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:debugging Issues related to debugging of JIT'ed code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider non-monomorphized type rather than AsContext/AsContextMut for memory/table/GC accessors

2 participants