ghostscope_platform/
types.rs1#[derive(Debug, Clone)]
3pub enum PlatformError {
4 PrologueAnalysisFailed(String),
6 ParameterOptimized(String),
8 EvaluationFailed(String),
10 UnsupportedArchitecture(String),
12}
13
14impl std::fmt::Display for PlatformError {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 match self {
17 PlatformError::PrologueAnalysisFailed(msg) => {
18 write!(f, "Prologue analysis failed: {msg}")
19 }
20 PlatformError::ParameterOptimized(msg) => write!(f, "Parameter optimized: {msg}"),
21 PlatformError::EvaluationFailed(msg) => write!(f, "Evaluation failed: {msg}"),
22 PlatformError::UnsupportedArchitecture(msg) => {
23 write!(f, "Unsupported architecture: {msg}")
24 }
25 }
26 }
27}
28
29impl std::error::Error for PlatformError {}
30
31#[derive(Debug, Clone)]
33pub struct SourceLocation {
34 pub file_path: String,
35 pub line_number: u32,
36 pub column: Option<u32>,
37}
38
39pub trait CodeReader {
41 fn read_code_bytes(&self, address: u64, size: usize) -> Option<Vec<u8>>;
43
44 fn get_source_location_slow(&self, address: u64) -> Option<SourceLocation>;
46
47 fn find_next_stmt_address(&self, function_start: u64) -> Option<u64>;
50}