diff options
Diffstat (limited to 'python/lowlevelil.py')
| -rw-r--r-- | python/lowlevelil.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 98bf4da6..137a2d77 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -2772,6 +2772,25 @@ class LowLevelILFunction: def basic_blocks(self) -> 'function.LowLevelILBasicBlockList': return function.LowLevelILBasicBlockList(self) + def get_basic_block_at(self, index: int) -> Optional['basicblock.BasicBlock']: + """ + ``get_basic_block_at`` returns the BasicBlock at the given LLIL instruction ``index``. + + :param int index: Index of the LLIL instruction of the BasicBlock to retrieve. + :Example: + >>> current_il_function.get_basic_block_at(current_il_index) + <llil block: x86@19-26> + """ + block = core.BNGetLowLevelILBasicBlockForInstruction(self.handle, index) + if not block: + return None + + view = None + if self._source_function is not None: + view = self._source_function.view + + return LowLevelILBasicBlock(block, self, view) + @property def instructions(self) -> Generator['LowLevelILInstruction', None, None]: """A generator of llil instructions of the current llil function""" |
