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

Function error_trace

crates/c-api/src/trap.rs:162–178  ·  view source on GitHub ↗
(error: &'a Error, out: &mut wasm_frame_vec_t<'a>)

Source from the content-addressed store, hash-verified

160}
161
162pub(crate) fn error_trace<'a>(error: &'a Error, out: &mut wasm_frame_vec_t<'a>) {
163 let trace = match error.downcast_ref::<WasmBacktrace>() {
164 Some(trap) => trap,
165 None => return out.set_buffer(Vec::new()),
166 };
167 let vec = (0..trace.frames().len())
168 .map(|idx| {
169 Some(Box::new(wasm_frame_t {
170 trace,
171 idx,
172 func_name: OnceCell::new(),
173 module_name: OnceCell::new(),
174 }))
175 })
176 .collect();
177 out.set_buffer(vec);
178}
179
180#[unsafe(no_mangle)]
181pub extern "C" fn wasmtime_trap_code(raw: &wasm_trap_t, code: &mut u8) -> bool {

Callers 2

wasm_trap_traceFunction · 0.85

Calls 6

set_bufferMethod · 0.80
collectMethod · 0.80
newFunction · 0.50
mapMethod · 0.45
lenMethod · 0.45
framesMethod · 0.45

Tested by

no test coverage detected