MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / drop_debuggee_and_store

Function drop_debuggee_and_store

crates/debugger/src/lib.rs:761–800  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

759 #[tokio::test]
760 #[cfg_attr(miri, ignore)]
761 async fn drop_debuggee_and_store() -> Result<()> {
762 let _ = env_logger::try_init();
763
764 let mut config = Config::new();
765 config.guest_debug(true);
766 let engine = Engine::new(&config)?;
767 let module = Module::new(
768 &engine,
769 r#"
770 (module
771 (func (export "main") (param i32 i32) (result i32)
772 local.get 0
773 local.get 1
774 i32.add))
775 "#,
776 )?;
777
778 let mut store = Store::new(&engine, ());
779 let instance = Instance::new_async(&mut store, &module, &[]).await?;
780 let main = instance.get_func(&mut store, "main").unwrap();
781
782 let mut debuggee = Debuggee::new(store, move |store| {
783 Box::pin(async move {
784 let mut results = [Val::I32(0)];
785 store.edit_breakpoints().unwrap().single_step(true).unwrap();
786 main.call_async(&mut *store, &[Val::I32(1), Val::I32(2)], &mut results[..])
787 .await?;
788 assert_eq!(results[0].unwrap_i32(), 3);
789 Ok(())
790 })
791 });
792
793 // Step once, then drop everything at the end of this
794 // function. Wasmtime's fiber cleanup should safely happen
795 // without attempting to raise debug async handler calls with
796 // missing async context.
797 let _ = debuggee.run().await?;
798
799 Ok(())
800 }
801}

Callers

nothing calls this directly

Calls 9

OkFunction · 0.85
guest_debugMethod · 0.80
edit_breakpointsMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45
get_funcMethod · 0.45
single_stepMethod · 0.45
call_asyncMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected