Skip to content

Debugging: add debugger support for wasmtime serve.#12859

Queued
cfallin wants to merge 1 commit intobytecodealliance:mainfrom
cfallin:debug-wasmtime-serve-2
Queued

Debugging: add debugger support for wasmtime serve.#12859
cfallin wants to merge 1 commit intobytecodealliance:mainfrom
cfallin:debug-wasmtime-serve-2

Conversation

@cfallin
Copy link
Copy Markdown
Member

@cfallin cfallin commented Mar 27, 2026

This adopts a simple solution to #12776: it takes the "instance reuse" paradigm to the extreme, instantiating exactly one instance and serializing all requests into that one instance. This allows the debugger component to operate on one Store, setting breakpoint state and presenting its execution to the attached debugger as a single program execution and minimizing impedance mismatches.

This also adds an integration test that runs an existing wasi-http test component under the debugger.

Contains a few bugfixes to core debug functionality:

  • Give unique names to "libraries" (core Wasm modules) reported in the gdbstub server to the debugger; LLDB otherwise deduplicates all the modules named wasm into one, and gets confused about base addresses and module indices.
  • Use core-module-relative PCs, not component-relative PCs, everywhere.

With these fixes, setting a breakpoint at handle in a wasi-http component and introspecting mid-request works properly.

Closes #12776.

@cfallin cfallin requested review from a team as code owners March 27, 2026 21:29
@cfallin cfallin requested review from fitzgen and removed request for a team March 27, 2026 21:29
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Mar 28, 2026
Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- maybe we should have newtypes for offset in code module, vs offset in component, vs offset in code section? Doesn't need to block this PR landing.

@cfallin
Copy link
Copy Markdown
Member Author

cfallin commented Mar 30, 2026

Good idea -- did the newtype thing and pulled out the underlying fixes from this PR as #12901; only last commit is the wasmtime serve bit now.

@cfallin cfallin force-pushed the debug-wasmtime-serve-2 branch 2 times, most recently from e7c9a35 to 9c766b3 Compare March 31, 2026 04:08
This adopts a simple solution to bytecodealliance#12776: it takes the "instance reuse"
paradigm to the extreme, instantiating exactly one instance and
serializing all requests into that one instance. This allows the
debugger component to operate on one `Store`, setting breakpoint state
and presenting its execution to the attached debugger as a single
program execution and minimizing impedance mismatches.

This also adds an integration test that runs an existing wasi-http
test component under the debugger.
@cfallin cfallin force-pushed the debug-wasmtime-serve-2 branch from 9c766b3 to d21bfc2 Compare March 31, 2026 21:40
@cfallin
Copy link
Copy Markdown
Member Author

cfallin commented Mar 31, 2026

Rebased out the other fixes so now this is just wasmtime serve -g -- should be ready for review!

@cfallin
Copy link
Copy Markdown
Member Author

cfallin commented Mar 31, 2026

(@fitzgen you had written "LGTM" above but no r+ -- fyi, but no rush)

Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh whoops sorry!

@fitzgen fitzgen added this pull request to the merge queue Apr 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 1, 2026
@cfallin cfallin added this pull request to the merge queue Apr 1, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debugging: implement debug component support for wasmtime serve

2 participants