From e7d9bb894f35b4f80d4f626d0f8348a800f3fe51 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 5 Nov 2021 13:18:09 -0400 Subject: Fix vars_written/vars_read/vars_address_taken --- python/mediumlevelil.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'python/mediumlevelil.py') diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 3ee5fc99..86927b0a 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -449,6 +449,10 @@ class MediumLevelILInstruction(ILInstruction): result.append(MediumLevelILOperationAndSize(self.operation, self.size)) return result + @property + def instruction_operands(self) -> List['MediumLevelILInstruction']: + return [i for i in self.operands if isinstance(i, MediumLevelILInstruction)] + @property def operands(self) -> List[MediumLevelILOperandType]: """Operands for the instruction""" @@ -470,6 +474,14 @@ class MediumLevelILInstruction(ILInstruction): result += operand.vars_read return result + @property + def vars_address_taken(self) -> List[Union[variable.Variable, SSAVariable]]: + """Non-unique list of variables whose address is taken by instruction""" + result = [] + for operand in self.instruction_operands: + result.extend(operand.vars_address_taken) + return result + @property def expr_type(self) -> Optional['types.Type']: """Type of expression""" @@ -909,6 +921,10 @@ class MediumLevelILAddress_of(MediumLevelILInstruction): def operands(self) -> List[variable.Variable]: return [self.src] + @property + def vars_address_taken(self) -> List[variable.Variable]: + return [self.src] + @dataclass(frozen=True, repr=False) class MediumLevelILConst(MediumLevelILConstBase): -- cgit v1.3.1