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

Method invoke_debugger

src/commands/run.rs:909–943  ·  view source on GitHub ↗
(
        &self,
        store: &mut Store<Host>,
        component: &wasmtime::component::Component,
        linker: &mut wasmtime::component::Linker<Host>,
        debuggee_host: Store<T>,
        b

Source from the content-addressed store, hash-verified

907 /// debuggee wraps an arbitrary store type `T` and body closure.
908 #[cfg(feature = "debug")]
909 pub(crate) async fn invoke_debugger<
910 T: Send + 'static,
911 F: for<'a> FnOnce(
912 &'a mut Store<T>,
913 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
914 + Send
915 + 'static,
916 >(
917 &self,
918 store: &mut Store<Host>,
919 component: &wasmtime::component::Component,
920 linker: &mut wasmtime::component::Linker<Host>,
921 debuggee_host: Store<T>,
922 body: F,
923 ) -> Result<()> {
924 let instance = linker.instantiate_async(&mut *store, component).await?;
925 let command = wasmtime_debugger::DebuggerComponent::new(&mut *store, &instance)?;
926 let debuggee = wasmtime_debugger::Debuggee::new(debuggee_host, body);
927 let debuggee = wasmtime_debugger::add_debuggee(store.data_mut().ctx().table, debuggee)?;
928 {
929 // Manually construct a borrow -- wasmtime-wit-bindgen
930 // generates code that consumes the `Resource<T>` for
931 // `call_debug()` below even though the WIT type is a
932 // `borrow<debuggee>`.
933 let borrowed = wasmtime::component::Resource::new_borrow(debuggee.rep());
934 let args = self.compute_argv()?;
935 command
936 .bytecodealliance_wasmtime_debugger()
937 .call_debug(&mut *store, borrowed, &args)
938 .await?;
939 }
940 let mut debuggee = store.data_mut().ctx().table.delete(debuggee)?;
941 debuggee.finish().await?;
942 Ok(())
943 }
944
945 #[cfg(feature = "component-model")]
946 fn search_component_funcs(

Callers 2

serve_under_debuggerMethod · 0.80
executeMethod · 0.80

Calls 10

add_debuggeeFunction · 0.85
OkFunction · 0.85
compute_argvMethod · 0.80
newFunction · 0.50
instantiate_asyncMethod · 0.45
ctxMethod · 0.45
data_mutMethod · 0.45
repMethod · 0.45
deleteMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected