Skip to content

Commit

Permalink
add HighLevelILFunction::variables method
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed May 31, 2024
1 parent d9294d3 commit 10a8b3c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rust/src/hlil/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,17 @@ impl HighLevelILFunction {
pub fn is_variable_live_at(&self, variable: Variable, instr: &HighLevelILInstruction) -> bool {
unsafe { BNIsHighLevelILVarLiveAt(self.handle, &variable.raw(), instr.index) }
}

/// This gets just the HLIL variables - you may be interested in the union
/// of [crate::function::Function::parameter_variables] and
/// [crate::mlil::function::MediumLevelILFunction::aliased_variables] as well for all the
/// variables used in the function
pub fn variables(&self) -> Array<Variable> {
let mut count = 0;
let variables = unsafe { BNGetHighLevelILVariables(self.handle, &mut count) };
assert!(!variables.is_null());
unsafe { Array::new(variables, count, ()) }
}
}

impl ToOwned for HighLevelILFunction {
Expand Down

0 comments on commit 10a8b3c

Please sign in to comment.