pub struct Analysis<'a> {
    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>>,
    /* private fields */
}
Expand description

Result of the executable analysis

Fields§

§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§

source§

impl<'a> Analysis<'a>

source

pub fn from_executable<C: ContextObject>( executable: &'a Executable<C> ) -> Result<Self, EbpfError>

Analyze an executable statically

source

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.

source

pub fn label_basic_blocks(&mut self)

Gives the basic blocks names

source

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

source

pub fn disassemble_instruction(&self, insn: &Insn) -> String

Generates assembler code for a single instruction

source

pub fn disassemble<W: Write>(&self, output: &mut W) -> Result<()>

Generates assembler code for the analyzed executable

source

pub fn disassemble_trace_log<W: Write>( &self, output: &mut W, trace_log: &[TraceLogEntry] ) -> Result<(), Error>

Use this method to print the trace log

source

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.

source

pub fn visualize_graphically<W: Write>( &self, output: &mut W, dynamic_analysis: Option<&DynamicAnalysis> ) -> Result<()>

Generates a graphviz DOT of the analyzed executable

source

pub fn control_flow_graph_tarjan(&mut self)

Finds the strongly connected components

Generates a topological order as by-product.

source

pub fn control_flow_graph_dominance_hierarchy(&mut self)

Finds the dominance hierarchy of the control-flow graph

Uses the Cooper-Harvey-Kennedy algorithm.

source

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

source

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> RefUnwindSafe for Analysis<'a>

§

impl<'a> Send for Analysis<'a>

§

impl<'a> Sync for Analysis<'a>

§

impl<'a> Unpin for Analysis<'a>

§

impl<'a> UnwindSafe for Analysis<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V