framehop/
instruction_analysis.rs

1use crate::arch::Arch;
2
3pub trait InstructionAnalysis: Arch {
4    /// Caller guarantees pc_offset <= text_bytes.len()
5    fn rule_from_prologue_analysis(text_bytes: &[u8], pc_offset: usize)
6        -> Option<Self::UnwindRule>;
7
8    /// Caller guarantees pc_offset <= text_bytes.len()
9    fn rule_from_epilogue_analysis(text_bytes: &[u8], pc_offset: usize)
10        -> Option<Self::UnwindRule>;
11
12    /// Caller guarantees pc_offset <= text_bytes.len()
13    fn rule_from_instruction_analysis(
14        text_bytes: &[u8],
15        pc_offset: usize,
16    ) -> Option<Self::UnwindRule> {
17        Self::rule_from_prologue_analysis(text_bytes, pc_offset)
18            .or_else(|| Self::rule_from_epilogue_analysis(text_bytes, pc_offset))
19    }
20}