* Added type check to get_ssa_* functions
| -rw-r--r-- | python/function.py | 10 | ||||
| -rw-r--r-- | python/lowlevelil.py | 8 |
diff --git a/python/function.py b/python/function.py index 18856ff2..0ee55f32 100644 --- a/python/function.py +++ b/python/function.py @@ -458,20 +458,20 @@ class Function(object): def get_low_level_il_at(self, addr, arch=None): """ - ``get_low_level_il_at`` gets the LowLevelIL instruction address corresponding to the given virtual address + ``get_low_level_il_at`` gets the LowLevelILInstruction corresponding to the given virtual address :param int addr: virtual address of the function to be queried :param Architecture arch: (optional) Architecture for the given function - :rtype: int + :rtype: LowLevelILInstruction :Example: >>> func = bv.functions[0] >>> func.get_low_level_il_at(func.start) - 0L + <il: push(rbp)> """ if arch is None: arch = self.arch - return core.BNGetLowLevelILForInstruction(self.handle, arch.handle, addr) + return self.low_level_il[core.BNGetLowLevelILForInstruction(self.handle, arch.handle, addr)] def get_low_level_il_exits_at(self, addr, arch=None): if arch is None: @@ -624,7 +624,7 @@ class Function(object): def get_lifted_il_at(self, addr, arch=None): if arch is None: arch = self.arch - return core.BNGetLiftedILForInstruction(self.handle, arch.handle, addr) + return self.lifted_il[core.BNGetLiftedILForInstruction(self.handle, arch.handle, addr)] def get_lifted_il_flag_uses_for_definition(self, i, flag): if isinstance(flag, str): diff --git a/python/lowlevelil.py b/python/lowlevelil.py index a737d95e..3634cca2 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -1478,12 +1478,16 @@ class LowLevelILFunction(object): return core.BNGetLowLevelILNonSSAInstructionIndex(self.handle, instr) def get_ssa_reg_definition(self, reg, index): + if isinstance(reg, str): + reg = self.arch.regs[reg].index result = core.BNGetLowLevelILSSARegisterDefinition(self.handle, reg, index) if result >= core.BNGetLowLevelILInstructionCount(self.handle): return None return result def get_ssa_flag_definition(self, flag, index): + if isinstance(flag, str): + flag = self.arch.get_flag_by_name(flag) result = core.BNGetLowLevelILSSAFlagDefinition(self.handle, flag, index) if result >= core.BNGetLowLevelILInstructionCount(self.handle): return None @@ -1496,6 +1500,8 @@ class LowLevelILFunction(object): return result def get_ssa_reg_uses(self, reg, index): + if isinstance(reg, str): + reg = self.arch.regs[reg].index count = ctypes.c_ulonglong() instrs = core.BNGetLowLevelILSSARegisterUses(self.handle, reg, index, count) result = [] @@ -1505,6 +1511,8 @@ class LowLevelILFunction(object): return result def get_ssa_flag_uses(self, flag, index): + if isinstance(flag, str): + flag = self.arch.get_flag_by_name(flag) count = ctypes.c_ulonglong() instrs = core.BNGetLowLevelILSSAFlagUses(self.handle, flag, index, count) result = [] |