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

Method get_ssa_var_definition

python/highlevelil.py:2760–2775  ·  view source on GitHub ↗

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.

(self, ssa_var: Union['mediumlevelil.SSAVariable', HighLevelILVarSsa])

Source from the content-addressed store, hash-verified

2758 return core.BNGetHighLevelILNonSSAInstructionIndex(self.handle, instr)
2759
2760 def get_ssa_var_definition(self, ssa_var: Union['mediumlevelil.SSAVariable', HighLevelILVarSsa]) -> Optional[HighLevelILInstruction]:
2761 """
2762 Gets the instruction that contains the given SSA variable's definition.
2763
2764 Since SSA variables can only be defined once, this will return the single instruction where that occurs.
2765 For SSA variable version 0s, which don't have definitions, this will return None instead.
2766 """
2767 if isinstance(ssa_var, HighLevelILVarSsa):
2768 ssa_var = ssa_var.var
2769 if not isinstance(ssa_var, mediumlevelil.SSAVariable):
2770 raise ValueError("Expected SSAVariable")
2771 var_data = ssa_var.var.to_BNVariable()
2772 result = core.BNGetHighLevelILSSAVarDefinition(self.handle, var_data, ssa_var.version)
2773 if result >= core.BNGetHighLevelILExprCount(self.handle):
2774 return None
2775 return HighLevelILInstruction.create(self, ExpressionIndex(result))
2776
2777 def get_ssa_memory_definition(self, version: int) -> Optional[HighLevelILInstruction]:
2778 result = core.BNGetHighLevelILSSAMemoryDefinition(self.handle, version)

Callers 1

collect_call_paramsFunction · 0.45

Calls 2

to_BNVariableMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected