-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Debugging: add the debug-main world. #12756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cfallin
merged 23 commits into
bytecodealliance:main
from
cfallin:a-whole-wide-world-for-debuggers-to-play-in
Mar 13, 2026
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3dc2544
Debugging: add the debug-main world.
cfallin 7f542d3
Review feedback.
cfallin 1caf84f
Review feedback.
cfallin adec476
Review feedback: update vendor-wit.sh.
cfallin d2515bb
Review feedback: -Ddebugger-arg= -> -Darg=.
cfallin 18705e2
Review feedback.
cfallin a15e743
Review feedback.
cfallin 8d5db0d
Review feedback: factor host.rs into several submodules.
cfallin 647853b
Review feedback: rename Debugger to Debuggee on host side.
cfallin dcf03f9
Review feedback: split inherit_stdin_stdout, and add corresponding op…
cfallin 49ff2fc
Review feedback.
cfallin eaebb70
Review feedback.
cfallin c9e59a8
Add simple debug-component tests.
cfallin 55d6bc8
Add wasm32-wasip2 target in a few places in CI
cfallin d0027a6
Cargo vets for wstd dependency.
cfallin 59be108
Add wasm32-wasip2 in more places
cfallin 329c8d7
fix debug-component test dependence on componentization byte offsets
cfallin b3fc04d
Review feedback.
cfallin c39e049
Fix cancel-safety of EventFuture.
cfallin 6252848
Fix: Interrupted events should only occur after interrupt(), not on e…
cfallin ea1f7a9
Review feedback.
cfallin 2df52d6
Review feedback: strip down WASI imports in debugger world.
cfallin d7aa6a2
fold debugger test component back into wasip1 + adapter test artifact…
cfallin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| //! Host implementation for the debugger world. | ||
|
|
||
| use wasmtime::{ | ||
| Result, | ||
| component::{Resource, ResourceTable}, | ||
| }; | ||
|
|
||
| mod api; | ||
| mod bindings; | ||
| mod opaque; | ||
|
|
||
| pub use api::Debuggee; | ||
| pub use bindings::DebugMain as DebuggerComponent; | ||
| pub use bindings::bytecodealliance::wasmtime::debuggee as wit; | ||
| use opaque::OpaqueDebugger; | ||
|
|
||
| /// Register a debuggee in a resource table. | ||
| pub fn add_debuggee<T: Send + 'static>( | ||
| table: &mut ResourceTable, | ||
| debuggee: crate::Debuggee<T>, | ||
| ) -> Result<Resource<Debuggee>> { | ||
| let engine = debuggee.engine().clone(); | ||
| let interrupt_pending = debuggee.interrupt_pending().clone(); | ||
| let inner: Option<Box<dyn OpaqueDebugger + Send + 'static>> = Some(Box::new(debuggee)); | ||
| Ok(table.push(Debuggee { | ||
| inner, | ||
| engine, | ||
| interrupt_pending, | ||
| })?) | ||
| } | ||
|
|
||
| /// Add the debugger world's host functions to a [`wasmtime::component::Linker`]. | ||
| pub fn add_to_linker<T: Send + 'static>( | ||
| linker: &mut wasmtime::component::Linker<T>, | ||
| f: fn(&mut T) -> &mut ResourceTable, | ||
| ) -> wasmtime::Result<()> { | ||
| wit::add_to_linker::<_, wasmtime::component::HasSelf<ResourceTable>>(linker, f) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.