Struct solana_rbpf::static_analysis::Analysis
source · [−]pub struct Analysis<'a, E: UserDefinedError, I: InstructionMeter> {
pub executable: &'a Executable<E, I>,
pub instructions: Vec<Insn>,
pub functions: BTreeMap<usize, (u32, String)>,
pub cfg_nodes: BTreeMap<usize, CfgNode>,
pub topological_order: Vec<usize>,
pub entrypoint: usize,
pub super_root: usize,
pub dfg_forward_edges: BTreeMap<DfgNode, BTreeSet<DfgEdge>>,
pub dfg_reverse_edges: BTreeMap<DfgNode, BTreeSet<DfgEdge>>,
}
Expand description
Result of the executable analysis
Fields
executable: &'a Executable<E, I>
The program which is analyzed
instructions: Vec<Insn>
Plain list of instructions as they occur in the executable
functions: BTreeMap<usize, (u32, String)>
Functions in the executable
cfg_nodes: BTreeMap<usize, CfgNode>
Nodes of the control-flow graph
topological_order: Vec<usize>
Topological order of cfg_nodes
entrypoint: usize
CfgNode where the execution starts
super_root: usize
Virtual CfgNode that reaches all functions
dfg_forward_edges: BTreeMap<DfgNode, BTreeSet<DfgEdge>>
Data flow edges (the keys are DfgEdge sources)
dfg_reverse_edges: BTreeMap<DfgNode, BTreeSet<DfgEdge>>
Data flow edges (the keys are DfgEdge destinations)
Implementations
sourceimpl<'a, E: UserDefinedError, I: InstructionMeter> Analysis<'a, E, I>
impl<'a, E: UserDefinedError, I: InstructionMeter> Analysis<'a, E, I>
sourcepub fn from_executable(
executable: &'a Executable<E, I>
) -> Result<Self, EbpfError<E>>
pub fn from_executable(
executable: &'a Executable<E, I>
) -> Result<Self, EbpfError<E>>
Analyze an executable statically
sourcepub fn split_into_basic_blocks(&mut self, flatten_call_graph: bool)
pub fn split_into_basic_blocks(&mut self, flatten_call_graph: bool)
Splits the sequence of instructions into basic blocks
Also links the control-flow graph edges between the basic blocks.
sourcepub fn label_basic_blocks(&mut self)
pub fn label_basic_blocks(&mut self)
Gives the basic blocks names
sourcepub fn disassemble_label<W: Write>(
&self,
output: &mut W,
suppress_extra_newlines: bool,
pc: usize,
last_basic_block: &mut usize
) -> Result<()>
pub fn disassemble_label<W: Write>(
&self,
output: &mut W,
suppress_extra_newlines: bool,
pc: usize,
last_basic_block: &mut usize
) -> Result<()>
Generates labels for assembler code
sourcepub fn disassemble<W: Write>(&self, output: &mut W) -> Result<()>
pub fn disassemble<W: Write>(&self, output: &mut W) -> Result<()>
Generates assembler code for the analyzed executable
sourcepub fn iter_cfg_by_function(
&self
) -> impl Iterator<Item = (Range<usize>, usize, &CfgNode)> + '_
pub fn iter_cfg_by_function(
&self
) -> impl Iterator<Item = (Range<usize>, usize, &CfgNode)> + '_
Iterates over the cfg_nodes while providing the PC range of the function they belong to.
sourcepub fn visualize_graphically<W: Write>(
&self,
output: &mut W,
dynamic_analysis: Option<&DynamicAnalysis>
) -> Result<()>
pub fn visualize_graphically<W: Write>(
&self,
output: &mut W,
dynamic_analysis: Option<&DynamicAnalysis>
) -> Result<()>
Generates a graphviz DOT of the analyzed executable
sourcepub fn control_flow_graph_tarjan(&mut self)
pub fn control_flow_graph_tarjan(&mut self)
Finds the strongly connected components
Generates a topological order as by-product.
sourcepub fn control_flow_graph_dominance_hierarchy(&mut self)
pub fn control_flow_graph_dominance_hierarchy(&mut self)
Finds the dominance hierarchy of the control-flow graph
Uses the Cooper-Harvey-Kennedy algorithm.
sourcepub fn intra_basic_block_data_flow(
&mut self
) -> BTreeMap<usize, HashMap<DataResource, usize>>
pub fn intra_basic_block_data_flow(
&mut self
) -> BTreeMap<usize, HashMap<DataResource, usize>>
Connect the dependencies between the instructions inside of the basic blocks
sourcepub fn inter_basic_block_data_flow(
&mut self,
basic_block_outputs: BTreeMap<usize, HashMap<DataResource, usize>>
)
pub fn inter_basic_block_data_flow(
&mut self,
basic_block_outputs: BTreeMap<usize, HashMap<DataResource, usize>>
)
Connect the dependencies inbetween the basic blocks
Auto Trait Implementations
impl<'a, E, I> RefUnwindSafe for Analysis<'a, E, I>
impl<'a, E, I> Send for Analysis<'a, E, I>
impl<'a, E, I> Sync for Analysis<'a, E, I>
impl<'a, E, I> Unpin for Analysis<'a, E, I>
impl<'a, E, I> UnwindSafe for Analysis<'a, E, I>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more