MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ssa_vars

Method ssa_vars

python/highlevelil.py:4635–4670  ·  view source on GitHub ↗

This gets just the HLIL SSA variables - you may be interested in the union of `HighLevelIlFunction.source_function.parameter_vars` and `HighLevelIlFunction.aliased_vars` for all the variables used in the function

(self)

Source from the content-addressed store, hash-verified

4633
4634 @property
4635 def ssa_vars(self) -> List["mediumlevelil.SSAVariable"]:
4636 """This gets just the HLIL SSA variables - you may be interested in the union of `HighLevelIlFunction.source_function.parameter_vars` and `HighLevelIlFunction.aliased_vars` for all the variables used in the function"""
4637 if self.source_function is None:
4638 return []
4639
4640 if self.il_form == FunctionGraphType.HighLevelILSSAFormFunctionGraph:
4641 variable_count = ctypes.c_ulonglong()
4642 core_variables = core.BNGetHighLevelILVariables(self.handle, variable_count)
4643 assert core_variables is not None, "core.BNGetHighLevelILVariables returned None"
4644 try:
4645 result = []
4646 for var_i in range(variable_count.value):
4647 version_count = ctypes.c_ulonglong()
4648 versions = core.BNGetHighLevelILVariableSSAVersions(
4649 self.handle, core_variables[var_i], version_count
4650 )
4651 assert versions is not None, "core.BNGetHighLevelILVariableSSAVersions returned None"
4652 try:
4653 for version_i in range(version_count.value):
4654 result.append(
4655 mediumlevelil.SSAVariable(
4656 variable.Variable(
4657 self, core_variables[var_i].type, core_variables[var_i].index,
4658 core_variables[var_i].storage
4659 ), versions[version_i]
4660 )
4661 )
4662 finally:
4663 core.BNFreeILInstructionList(versions)
4664 return result
4665 finally:
4666 core.BNFreeVariableList(core_variables)
4667 elif self.il_form == FunctionGraphType.HighLevelILFunctionGraph:
4668 return self.ssa_form.ssa_vars
4669
4670 return []
4671
4672 def get_medium_level_il_expr_index(self, expr: ExpressionIndex) -> Optional['mediumlevelil.ExpressionIndex']:
4673 medium_il = self.medium_level_il

Callers

nothing calls this directly

Calls 3

SSAVariableMethod · 0.80
VariableMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected