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

Method patch

crates/wasmtime/src/runtime/debug.rs:1062–1077  ·  view source on GitHub ↗
(
        patches: impl Iterator<Item = FrameTableBreakpointData<'b>> + 'b,
        mem: &mut CodeMemory,
        enable: bool,
    )

Source from the content-addressed store, hash-verified

1060 }
1061
1062 fn patch<'b>(
1063 patches: impl Iterator<Item = FrameTableBreakpointData<'b>> + 'b,
1064 mem: &mut CodeMemory,
1065 enable: bool,
1066 ) {
1067 let mem = mem.text_mut();
1068 for patch in patches {
1069 let data = if enable { patch.enable } else { patch.disable };
1070 let mem = &mut mem[patch.offset..patch.offset + data.len()];
1071 log::trace!(
1072 "patch: offset 0x{:x} with enable={enable}: data {data:?} replacing {mem:?}",
1073 patch.offset
1074 );
1075 mem.copy_from_slice(data);
1076 }
1077 }
1078
1079 /// Add a breakpoint in the given module at the given PC in that
1080 /// module.

Callers

nothing calls this directly

Calls 3

text_mutMethod · 0.80
lenMethod · 0.45
copy_from_sliceMethod · 0.45

Tested by

no test coverage detected