pub struct MediumLevelILFunction { /* private fields */ }

Implementations§

source§

impl MediumLevelILFunction

source

pub fn instruction_at<L: Into<Location>>( &self, loc: L ) -> Option<MediumLevelILInstruction>

source

pub fn instruction_from_idx(&self, expr_idx: usize) -> MediumLevelILInstruction

source

pub fn lifted_instruction_from_idx( &self, expr_idx: usize ) -> MediumLevelILLiftedInstruction

source

pub fn instruction_from_instruction_idx( &self, instr_idx: usize ) -> MediumLevelILInstruction

source

pub fn lifted_instruction_from_instruction_idx( &self, instr_idx: usize ) -> MediumLevelILLiftedInstruction

source

pub fn instruction_count(&self) -> usize

source

pub fn ssa_form(&self) -> MediumLevelILFunction

source

pub fn get_function(&self) -> Ref<Function>

source

pub fn basic_blocks(&self) -> Array<BasicBlock<MediumLevelILBlock>>

source

pub fn get_var_definitions<'a>( &'a self, var: &Variable ) -> MediumLevelILInstructionList<'a>

source

pub fn create_user_stack_var<'a, S: BnStrCompatible, C: Into<Conf<&'a Type>>>( self, offset: i64, var_type: C, name: S )

source

pub fn delete_user_stack_var(self, offset: i64)

source

pub fn create_user_var<'a, S: BnStrCompatible, C: Into<Conf<&'a Type>>>( &self, var: &Variable, var_type: C, name: S, ignore_disjoint_uses: bool )

source

pub fn delete_user_var(&self, var: &Variable)

source

pub fn is_var_user_defined(&self, var: &Variable) -> bool

source

pub fn set_user_var_value( &self, var: &Variable, addr: u64, value: PossibleValueSet ) -> Result<(), ()>

Allows the user to specify a PossibleValueSet value for an MLIL variable at its definition site.

.. warning:: Setting the variable value, triggers a reanalysis of the function and allows the dataflow to compute and propagate values which depend on the current variable. This implies that branch conditions whose values can be determined statically will be computed, leading to potential branch elimination at the HLIL layer.

  • var - Variable for which the value is to be set
  • addr - Address of the definition site of the variable
  • value - Informed value of the variable
§Example
let (mlil_var, arch_addr, _val) = mlil_fun.user_var_values().all().next().unwrap();
let def_address = arch_addr.address;
let var_value = PossibleValueSet::ConstantValue{value: 5};
mlil_fun.set_user_var_value(&mlil_var, def_address, var_value).unwrap();
source

pub fn clear_user_var_value(&self, var: &Variable, addr: u64) -> Result<(), ()>

Clears a previously defined user variable value.

  • var - Variable for which the value was informed
  • def_addr - Address of the definition site of the variable
source

pub fn user_var_values(&self) -> UserVariableValues

Returns a map of current defined user variable values. Returns a Map of user current defined user variable values and their definition sites.

source

pub fn clear_user_var_values(&self) -> Result<(), ()>

Clear all user defined variable values.

source

pub fn create_auto_stack_var<'a, T: Into<Conf<&'a Type>>, S: BnStrCompatible>( &self, offset: i64, var_type: T, name: S )

source

pub fn delete_auto_stack_var(&self, offset: i64)

source

pub fn create_auto_var<'a, S: BnStrCompatible, C: Into<Conf<&'a Type>>>( &self, var: &Variable, var_type: C, name: S, ignore_disjoint_uses: bool )

source

pub fn var_refs(&self, var: &Variable) -> Array<ILReferenceSource>

Returns a list of ILReferenceSource objects (IL xrefs or cross-references) that reference the given variable. The variable is a local variable that can be either on the stack, in a register, or in a flag. This function is related to get_hlil_var_refs(), which returns variable references collected from HLIL. The two can be different in several cases, e.g., multiple variables in MLIL can be merged into a single variable in HLIL.

  • var - Variable for which to query the xref
§Example
let instr = mlil_fun.var_refs(&mlil_var).get(0).expr();
source

pub fn var_refs_from( &self, addr: u64, length: Option<u64>, arch: Option<CoreArchitecture> ) -> Array<VariableReferenceSource>

Returns a list of variables referenced by code in the function func, of the architecture arch, and at the address addr. If no function is specified, references from all functions and containing the address will be returned. If no architecture is specified, the architecture of the function will be used. This function is related to get_hlil_var_refs_from(), which returns variable references collected from HLIL. The two can be different in several cases, e.g., multiple variables in MLIL can be merged into a single variable in HLIL.

  • addr - virtual address to query for variable references
  • length - optional length of query
  • arch - optional architecture of query
source

pub fn current_address(&self) -> u64

Current IL Address

source

pub fn set_current_address(&self, value: u64, arch: Option<CoreArchitecture>)

Set the current IL Address

source

pub fn basic_block_containing( &self, instruction: &MediumLevelILInstruction ) -> Option<BasicBlock<MediumLevelILBlock>>

Returns the BasicBlock at the given MLIL instruction.

source

pub fn finalize(&self)

ends the function and computes the list of basic blocks.

source

pub fn generate_ssa_form( &self, analyze_conditionals: bool, handle_aliases: bool, known_not_aliases: impl IntoIterator<Item = Variable>, known_aliases: impl IntoIterator<Item = Variable> )

Generate SSA form given the current MLIL

  • analyze_conditionals - whether or not to analyze conditionals
  • handle_aliases - whether or not to handle aliases
  • known_not_aliases - optional list of variables known to be not aliased
  • known_aliases - optional list of variables known to be aliased
source

pub fn ssa_variable_definition( &self, var: SSAVariable ) -> Option<MediumLevelILInstruction>

Gets the instruction that contains the given SSA variable’s definition.

Since SSA variables can only be defined once, this will return the single instruction where that occurs. For SSA variable version 0s, which don’t have definitions, this will return None instead.

source

pub fn ssa_memory_definition( &self, version: usize ) -> Option<MediumLevelILInstruction>

source

pub fn ssa_variable_uses( &self, ssa_var: SSAVariable ) -> Array<MediumLevelILInstruction>

Gets all the instructions that use the given SSA variable.

source

pub fn ssa_memory_uses(&self, version: usize) -> Array<MediumLevelILInstruction>

source

pub fn is_ssa_variable_live(&self, ssa_var: SSAVariable) -> bool

determines if ssa_var is live at any point in the function

source

pub fn variable_definitions( &self, variable: Variable ) -> Array<MediumLevelILInstruction>

source

pub fn variable_uses( &self, variable: Variable ) -> Array<MediumLevelILInstruction>

source

pub fn live_instruction_for_variable( &self, variable: Variable, include_last_user: bool ) -> Array<MediumLevelILInstruction>

Computes the list of instructions for which var is live. If include_last_use is false, the last use of the variable will not be included in the list (this allows for easier computation of overlaps in liveness between two variables). If the variable is never used, this function will return an empty list.

var - the variable to query include_last_use - whether to include the last use of the variable in the list of instructions

source

pub fn ssa_variable_value(&self, ssa_var: SSAVariable) -> RegisterValue

source

pub fn create_graph(&self, settings: Option<DisassemblySettings>) -> FlowGraph

source

pub fn variables(&self) -> Array<Variable>

This gets just the MLIL variables - you may be interested in the union of MediumLevelILFunction::aliased_variables and crate::function::Function::parameter_variables for all the variables used in the function

source

pub fn aliased_variables(&self) -> Array<Variable>

This returns a list of Variables that are taken reference to and used elsewhere. You may also wish to consider MediumLevelILFunction::variables and crate::function::Function::parameter_variables

source

pub fn ssa_variables(&self) -> Array<Array<SSAVariable>>

This gets just the MLIL SSA variables - you may be interested in the union of MediumLevelILFunction::aliased_variables and crate::function::Function::parameter_variables for all the variables used in the function.

Trait Implementations§

source§

impl Debug for MediumLevelILFunction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for MediumLevelILFunction

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for MediumLevelILFunction

source§

fn eq(&self, rhs: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToOwned for MediumLevelILFunction

§

type Owned = Ref<MediumLevelILFunction>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for MediumLevelILFunction

source§

impl Send for MediumLevelILFunction

source§

impl Sync for MediumLevelILFunction

Auto Trait Implementations§

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.