pub struct Function { /* private fields */ }
Expand description
A function for Falcon IL. Provides location and context in a Program
to a
ControlFlowGraph
.
Implementations§
source§impl Function
impl Function
sourcepub fn new(address: u64, control_flow_graph: ControlFlowGraph) -> Function
pub fn new(address: u64, control_flow_graph: ControlFlowGraph) -> Function
Create a new Function
Parameters
address
- The address where we recovered this function.control_flow_graph
- AControlFlowGraph
capturing the semantics of this function.
sourcepub fn locations(&self) -> Vec<RefFunctionLocation<'_>> ⓘ
pub fn locations(&self) -> Vec<RefFunctionLocation<'_>> ⓘ
Create a Vec of every RefFunctionLocation for this function.
Convenient for analyses where we need to check every location in a function
sourcepub fn address(&self) -> u64
pub fn address(&self) -> u64
Get the address of this Function
.
The address returned will be the address set when this Function
was created,
which should be the virtual address where this Function
was found.
sourcepub fn block(&self, index: usize) -> Result<&Block, Error>
pub fn block(&self, index: usize) -> Result<&Block, Error>
Return a Block
from this Function
’s ControlFlowGraph
by index.
sourcepub fn block_mut(&mut self, index: usize) -> Result<&mut Block, Error>
pub fn block_mut(&mut self, index: usize) -> Result<&mut Block, Error>
Return a mutable reference to a Block
in this Function
sourcepub fn blocks_mut(&mut self) -> Vec<&mut Block> ⓘ
pub fn blocks_mut(&mut self) -> Vec<&mut Block> ⓘ
Return a Vec of mutable references to all Block
in this Function
sourcepub fn edge(&self, head: usize, tail: usize) -> Result<&Edge, Error>
pub fn edge(&self, head: usize, tail: usize) -> Result<&Edge, Error>
Return an Edge
from this Function
’s ControlFlowGraph
by index.
sourcepub fn control_flow_graph(&self) -> &ControlFlowGraph
pub fn control_flow_graph(&self) -> &ControlFlowGraph
Return the ControlFlowGraph
for this Function
.
sourcepub fn control_flow_graph_mut(&mut self) -> &mut ControlFlowGraph
pub fn control_flow_graph_mut(&mut self) -> &mut ControlFlowGraph
Return a mutable reference to the ControlFlowGraph
for this Function
.
sourcepub fn index(&self) -> Option<usize>
pub fn index(&self) -> Option<usize>
Return the index of this Function
. A Function
will have an index if
it is added to a Program
.