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

Method set_debug_handler

crates/wasmtime/src/runtime/store.rs:1213–1236  ·  view source on GitHub ↗
(&mut self, handler: impl DebugHandler<Data = T>)

Source from the content-addressed store, hash-verified

1211 /// [`crate::Config::guest_debug`].
1212 #[cfg(feature = "debug")]
1213 pub fn set_debug_handler(&mut self, handler: impl DebugHandler<Data = T>)
1214 where
1215 // We require `Send` here because the debug handler becomes
1216 // referenced from a future: when `DebugHandler::handle` is
1217 // invoked, its `self` references the `handler` with the
1218 // user's state. Note that we are careful to keep this bound
1219 // constrained to debug-handler-related code only and not
1220 // propagate it outward to the store in general. The presence
1221 // of the trait implementation serves as a witness that `T:
1222 // Send`. This is required in particular because we will have
1223 // a `&mut dyn VMStore` on the stack when we pause a fiber
1224 // with `block_on` to run a debugger hook; that `VMStore` must
1225 // be a `Store<T> where T: Send`.
1226 T: Send,
1227 {
1228 // Debug hooks rely on async support, so async entrypoints are required.
1229 self.inner.set_async_required(Asyncness::Yes);
1230
1231 assert!(
1232 self.engine().tunables().debug_guest,
1233 "debug hooks require guest debugging to be enabled"
1234 );
1235 self.inner.debug_handler = Some(Box::new(handler));
1236 }
1237
1238 /// Clear the debug handler on this store. If any existed, it will
1239 /// be dropped.

Calls 2

newFunction · 0.50
set_async_requiredMethod · 0.45

Tested by 1