#[derive(Debug, Clone)]
pub enum PlatformError {
PrologueAnalysisFailed(String),
ParameterOptimized(String),
EvaluationFailed(String),
UnsupportedArchitecture(String),
}
impl std::fmt::Display for PlatformError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
PlatformError::PrologueAnalysisFailed(msg) => {
write!(f, "Prologue analysis failed: {msg}")
}
PlatformError::ParameterOptimized(msg) => write!(f, "Parameter optimized: {msg}"),
PlatformError::EvaluationFailed(msg) => write!(f, "Evaluation failed: {msg}"),
PlatformError::UnsupportedArchitecture(msg) => {
write!(f, "Unsupported architecture: {msg}")
}
}
}
}
impl std::error::Error for PlatformError {}
#[derive(Debug, Clone)]
pub struct SourceLocation {
pub file_path: String,
pub line_number: u32,
pub column: Option<u32>,
}
pub trait CodeReader {
fn read_code_bytes(&self, address: u64, size: usize) -> Option<Vec<u8>>;
fn get_source_location_slow(&self, address: u64) -> Option<SourceLocation>;
fn find_next_stmt_address(&self, function_start: u64) -> Option<u64>;
}