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

Method ssa_vars

python/mediumlevelil.py:5597–5638  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

5595
5596 @property
5597 def ssa_vars(self) -> List[SSAVariable]:
5598 """This gets just the MLIL SSA variables - you may be interested in the union of `MediumLevelIlFunction.aliased_vars` and `MediumLevelIlFunction.source_function.parameter_vars` for all the variables used in the function"""
5599 if self.source_function is None:
5600 return []
5601
5602 if self.il_form in [
5603 FunctionGraphType.MediumLevelILSSAFormFunctionGraph,
5604 FunctionGraphType.MappedMediumLevelILSSAFormFunctionGraph
5605 ]:
5606 variable_count = ctypes.c_ulonglong()
5607 core_variables = core.BNGetMediumLevelILVariables(self.handle, variable_count)
5608 assert core_variables is not None, "core.BNGetMediumLevelILVariables returned None"
5609 try:
5610 result = []
5611 for var_i in range(variable_count.value):
5612 version_count = ctypes.c_ulonglong()
5613 versions = core.BNGetMediumLevelILVariableSSAVersions(
5614 self.handle, core_variables[var_i], version_count
5615 )
5616 assert versions is not None, "core.BNGetMediumLevelILVariableSSAVersions returned None"
5617 try:
5618 for version_i in range(version_count.value):
5619 result.append(
5620 SSAVariable(
5621 variable.Variable(
5622 self, core_variables[var_i].type, core_variables[var_i].index,
5623 core_variables[var_i].storage
5624 ), versions[version_i]
5625 )
5626 )
5627 finally:
5628 core.BNFreeILInstructionList(versions)
5629
5630 return result
5631 finally:
5632 core.BNFreeVariableList(core_variables)
5633 elif self.il_form in [
5634 FunctionGraphType.MediumLevelILFunctionGraph, FunctionGraphType.MappedMediumLevelILFunctionGraph
5635 ]:
5636 return self.ssa_form.ssa_vars
5637
5638 return []
5639
5640 def get_expr_type(self, expr_index: int) -> Optional['types.Type']:
5641 """

Callers

nothing calls this directly

Calls 3

VariableMethod · 0.80
SSAVariableClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected