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

Method single_step

crates/wasmtime/src/runtime/debug.rs:1173–1195  ·  view source on GitHub ↗

Turn on or off single-step mode. In single-step mode, a breakpoint event is emitted at every Wasm PC.

(&mut self, enabled: bool)

Source from the content-addressed store, hash-verified

1171 /// In single-step mode, a breakpoint event is emitted at every
1172 /// Wasm PC.
1173 pub fn single_step(&mut self, enabled: bool) -> Result<()> {
1174 log::trace!(
1175 "single_step({enabled}) with breakpoint set {:?}",
1176 self.state.breakpoints
1177 );
1178 if self.state.single_step == enabled {
1179 // No change to current state; don't go through the effort of re-patching and
1180 // re-publishing code.
1181 return Ok(());
1182 }
1183 let modules = self.registry.all_modules().cloned().collect::<Vec<_>>();
1184 for module in modules {
1185 let mem =
1186 Self::get_code_memory(self.state, self.registry, &mut self.dirty_modules, &module)?;
1187 Self::apply_single_step(mem, &module, enabled, |key| {
1188 self.state.breakpoints.contains_key(key)
1189 })?;
1190 }
1191
1192 self.state.single_step = enabled;
1193
1194 Ok(())
1195 }
1196}
1197
1198impl<'a> Drop for BreakpointEdit<'a> {

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
all_modulesMethod · 0.45
contains_keyMethod · 0.45

Tested by

no test coverage detected