From 818dc318a974b5a5053720e55084b0671017b814 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Tue, 7 May 2024 12:16:13 -0400 Subject: fix def_sites and use_sites 👀 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/mediumlevelil.py | 19 +++++++++++++------ python/variable.py | 5 +++++ 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'python') diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 6971e120..bd13afa2 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -80,25 +80,32 @@ class SSAVariable: @property def function(self) -> 'function.Function': + """returns the source Function object which this variable belongs to""" return self.var.function + @property + def il_function(self) -> 'function.ILFunctionType': + """returns the il Function object which this variable belongs to""" + return self.var._il_function + @property def dead_store_elimination(self) -> DeadStoreElimination: + """returns the dead store elimination setting for this variable (read-only)""" return self.var.dead_store_elimination @property - def def_site(self) -> Optional['MediumLevelILInstruction']: + def def_site(self) -> Optional[Union['MediumLevelILInstruction', 'highlevelil.HighLevelILInstruction']]: """ - Gets the MediumLevelILInstruction where this SSAVariable is defined. + Gets the IL instructions where this SSAVariable is defined. """ - return self.function.mlil.get_ssa_var_definition(self) + return self.il_function.get_ssa_var_definition(self) @property - def use_sites(self) -> List['MediumLevelILInstruction']: + def use_sites(self) -> List[Union['MediumLevelILInstruction', 'highlevelil.HighLevelILInstruction']]: """ - Gets the list of MediumLevelILInstructions where this SSAVariable is used inside of this function. + Gets the list of IL instructions where this SSAVariable is used inside of this function. """ - return self.function.mlil.get_ssa_var_uses(self) + return self.il_function.get_ssa_var_uses(self) class MediumLevelILLabel: diff --git a/python/variable.py b/python/variable.py index 75e95712..3ca4bb1c 100644 --- a/python/variable.py +++ b/python/variable.py @@ -886,6 +886,11 @@ class Variable(CoreVariable): """returns the source Function object which this variable belongs to""" return self._function + @property + def il_function(self) -> 'function.ILFunctionType': + """returns the IL Function object which this variable belongs to""" + return self.var._il_function + def set_name_async(self, name: Optional[str]) -> None: """ ``set_name_async`` provides a way to asynchronously set the name of a variable. This method should be used -- cgit v1.3.1