diff options
| author | Glenn Smith <glenn@vector35.com> | 2025-02-06 15:00:04 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-02-06 15:04:05 -0500 |
| commit | 3355345145771291936738938721961916331716 (patch) | |
| tree | 86c4e52556610081deb3bfc790bb01ac62906c99 /python/mediumlevelil.py | |
| parent | 1473293c5e4463b5667e886b6e709582fc856872 (diff) | |
Add After variants for looking up variables at instructions
Fixes #6397
Diffstat (limited to 'python/mediumlevelil.py')
| -rw-r--r-- | python/mediumlevelil.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 267076db..976c1a85 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -699,6 +699,11 @@ class MediumLevelILInstruction(BaseILInstruction): return core.BNGetMediumLevelILSSAMemoryVersionAtILInstruction(self.function.handle, self.instr_index) @property + def ssa_memory_version_after(self) -> int: + """Version of active memory contents in SSA form after this instruction""" + return core.BNGetMediumLevelILSSAMemoryVersionAfterILInstruction(self.function.handle, self.instr_index) + + @property def prefix_operands(self) -> List[MediumLevelILOperandType]: """All operands in the expression tree in prefix order""" result: List[MediumLevelILOperandType] = [MediumLevelILOperationAndSize(self.operation, self.size)] @@ -803,22 +808,42 @@ class MediumLevelILInstruction(BaseILInstruction): var_data = var.to_BNVariable() return core.BNGetMediumLevelILSSAVarVersionAtILInstruction(self.function.handle, var_data, self.instr_index) + def get_ssa_var_version_after(self, var: variable.Variable) -> int: + var_data = var.to_BNVariable() + return core.BNGetMediumLevelILSSAVarVersionAfterILInstruction(self.function.handle, var_data, self.instr_index) + def get_var_for_reg(self, reg: 'architecture.RegisterType') -> variable.Variable: reg = self.function.arch.get_reg_index(reg) result = core.BNGetMediumLevelILVariableForRegisterAtInstruction(self.function.handle, reg, self.instr_index) return variable.Variable.from_BNVariable(self.function, result) + def get_var_for_reg_after(self, reg: 'architecture.RegisterType') -> variable.Variable: + reg = self.function.arch.get_reg_index(reg) + result = core.BNGetMediumLevelILVariableForRegisterAfterInstruction(self.function.handle, reg, self.instr_index) + return variable.Variable.from_BNVariable(self.function, result) + def get_var_for_flag(self, flag: 'architecture.FlagType') -> variable.Variable: flag = self.function.arch.get_flag_index(flag) result = core.BNGetMediumLevelILVariableForFlagAtInstruction(self.function.handle, flag, self.instr_index) return variable.Variable.from_BNVariable(self.function, result) + def get_var_for_flag_after(self, flag: 'architecture.FlagType') -> variable.Variable: + flag = self.function.arch.get_flag_index(flag) + result = core.BNGetMediumLevelILVariableForFlagAfterInstruction(self.function.handle, flag, self.instr_index) + return variable.Variable.from_BNVariable(self.function, result) + def get_var_for_stack_location(self, offset: int) -> variable.Variable: result = core.BNGetMediumLevelILVariableForStackLocationAtInstruction( self.function.handle, offset, self.instr_index ) return variable.Variable.from_BNVariable(self.function, result) + def get_var_for_stack_location_after(self, offset: int) -> variable.Variable: + result = core.BNGetMediumLevelILVariableForStackLocationAfterInstruction( + self.function.handle, offset, self.instr_index + ) + return variable.Variable.from_BNVariable(self.function, result) + def get_reg_value(self, reg: 'architecture.RegisterType') -> 'variable.RegisterValue': reg = self.function.arch.get_reg_index(reg) value = core.BNGetMediumLevelILRegisterValueAtInstruction(self.function.handle, reg, self.instr_index) |
