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

Method read_wasm_stack

crates/gdbstub-component/src/target.rs:419–438  ·  view source on GitHub ↗
(
        &self,
        _tid: Tid,
        frame_depth: usize,
        index: usize,
        buf: &mut [u8],
    )

Source from the content-addressed store, hash-verified

417 }
418
419 fn read_wasm_stack(
420 &self,
421 _tid: Tid,
422 frame_depth: usize,
423 index: usize,
424 buf: &mut [u8],
425 ) -> Result<usize, Self::Error> {
426 let Some(f) = self.frame_cache.get(frame_depth) else {
427 return Ok(0);
428 };
429 let Ok(stack) = f.get_stack(self.debuggee) else {
430 return Ok(0);
431 };
432 let Some(val) = stack.get(index) else {
433 return Ok(0);
434 };
435 let bytes = self.value_to_bytes(val.clone());
436 buf[..bytes.len()].copy_from_slice(&bytes);
437 Ok(bytes.len())
438 }
439}
440
441impl<'a> HostInfo for Debugger<'a> {

Callers

nothing calls this directly

Calls 7

OkFunction · 0.85
get_stackMethod · 0.80
value_to_bytesMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45
copy_from_sliceMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected