use wasm_encoder::CoreDumpValue;
use crate::{Backtrace, VMRuntimeLimits};
use super::CallThreadState;
#[derive(Debug)]
pub struct CoreDumpStack {
pub bt: Backtrace,
pub locals: Vec<Vec<CoreDumpValue>>,
pub operand_stack: Vec<Vec<CoreDumpValue>>,
}
impl CallThreadState {
pub(super) fn capture_coredump(
&self,
limits: *const VMRuntimeLimits,
trap_pc_and_fp: Option<(usize, usize)>,
) -> Option<CoreDumpStack> {
if !self.capture_coredump {
return None;
}
let bt = unsafe { Backtrace::new_with_trap_state(limits, self, trap_pc_and_fp) };
Some(CoreDumpStack {
bt,
locals: vec![],
operand_stack: vec![],
})
}
}