Struct MediumLevelILFunction
pub struct MediumLevelILFunction { /* private fields */ }Source§
👎Deprecated: Use Function::create_user_stack_var instead
👎Deprecated: Use Function::delete_user_stack_var instead
👎Deprecated: Use Function::create_user_var instead
👎Deprecated: Use Function::delete_user_var instead
👎Deprecated: Use Function::is_var_user_defined instead
Source
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 setaddr- Address of the definition site of the variablevalue- Informed value of the variable
§Example
let user_var_val = mlil_fun.user_var_values().iter().next().unwrap();
let def_address = user_var_val.def_site.addr;
let var_value = PossibleValueSet::ConstantValue { value: 5 };
mlil_fun
.set_user_var_value(&user_var_val.variable, def_address, var_value, false)
.unwrap();Source
Clears a previously defined user variable value.
var- Variable for which the value was informeddef_addr- Address of the definition site of the variable
Source
Returns a map of current defined user variable values. Returns a Map of user current defined user variable values and their definition sites.
Source
Clear all user defined variable values.
👎Deprecated: Use Function::create_auto_stack_var instead
👎Deprecated: Use Function::delete_auto_stack_var instead
👎Deprecated: Use Function::create_auto_var instead
Source
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_idx = mlil_fun.var_refs(&mlil_var).get(0).expr_idx;Source
Retrieves variable references from a specified location or range within a medium-level IL function.
Passing in a length will query a range for variable references, instead of just the address
specified in location.
Source
Current IL Address
Source
Set the current IL Address
Source
Ends the function and computes the list of basic blocks.
NOTE: This should be called after updating MLIL.
Source
Generate SSA form given the current MLIL.
NOTE: This should be called after updating MLIL.
analyze_conditionals- whether to analyze conditionalshandle_aliases- whether to handle aliasesnon_aliased_vars- optional list of variables known to be not aliasedaliased_vars- optional list of variables known to be aliased
Source
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
Gets all the instructions that use the given SSA variable.
Source
Determines if variable is live at any point in the function
Source
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