2026-11-03 19:37:05 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
use crate::SourceRange;
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
#[serde(rename_all = "snake_case")]
|
|
|
|
|
pub enum StackFrameKind {
|
|
|
|
|
Current,
|
|
|
|
|
Caller,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
pub struct StackFrame {
|
|
|
|
|
pub kind: StackFrameKind,
|
|
|
|
|
/// Current instruction or caller's saved return address.
|
|
|
|
|
pub instruction_pointer: usize,
|
|
|
|
|
/// Instruction mapped to source (the call instruction for a caller).
|
|
|
|
|
pub source_instruction_pointer: Option<usize>,
|
|
|
|
|
pub function: Option<String>,
|
|
|
|
|
pub range: Option<SourceRange>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
pub struct ExecutionInspection {
|
|
|
|
|
pub vm_steps: u64,
|
|
|
|
|
pub awaiting: bool,
|
|
|
|
|
pub call_depth: usize,
|
|
|
|
|
pub frames: Vec<StackFrame>,
|
|
|
|
|
pub frames_truncated: bool,
|
|
|
|
|
}
|
2026-11-03 19:53:43 +00:00
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
pub struct SourceBreakpoint {
|
|
|
|
|
/// Zero-based line in the exact installed source. Empty addresses mean unverified.
|
|
|
|
|
pub line: usize,
|
|
|
|
|
pub instruction_pointers: Vec<usize>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
#[serde(rename_all = "snake_case")]
|
|
|
|
|
pub enum DebugStopReason {
|
|
|
|
|
Breakpoint,
|
|
|
|
|
Step,
|
|
|
|
|
Budget,
|
|
|
|
|
Awaiting,
|
|
|
|
|
Completed,
|
|
|
|
|
Failed,
|
|
|
|
|
Removed,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
|
pub struct DebuggerSnapshot {
|
|
|
|
|
pub breakpoints: Vec<SourceBreakpoint>,
|
|
|
|
|
pub stop_reason: Option<DebugStopReason>,
|
|
|
|
|
}
|