diff options
| author | Peter LaFosse <peter@vector35.com> | 2021-11-05 22:11:51 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2021-11-05 22:12:03 -0400 |
| commit | 719ec9860158123d229dd729993834c66b13d8c9 (patch) | |
| tree | 6f5d37c61eca79f8d8682115cd6939e17bf68bdd /python/lowlevelil.py | |
| parent | afe2b869b0bc8ea2b4969163899d495d46c85fef (diff) | |
Turn some apis back into Lists for ease of use, improve __repr__ for list and mapping containers
Diffstat (limited to 'python/lowlevelil.py')
| -rw-r--r-- | python/lowlevelil.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 313feec4..3bf8a592 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -2783,29 +2783,25 @@ class LowLevelILFunction: """Number of temporary flags (read-only)""" return core.BNGetLowLevelILTemporaryFlagCount(self.handle) - @property - def basic_blocks(self) -> Generator['LowLevelILBasicBlock', None, None]: - """list of LowLevelILBasicBlock objects (read-only)""" + def _basic_block_list(self): count = ctypes.c_ulonglong() blocks = core.BNGetLowLevelILBasicBlockList(self.handle, count) assert blocks is not None, "core.BNGetLowLevelILBasicBlockList returned None" - view = None - if self._source_function is not None: - view = self._source_function.view - try: - for i in range(0, count.value): - core_block = core.BNNewBasicBlockReference(blocks[i]) - assert core_block is not None, "core.BNNewBasicBlockReference returned None" - yield LowLevelILBasicBlock(core_block, self, view) - finally: - core.BNFreeBasicBlockList(blocks, count.value) + return (count, blocks) + + def _instantiate_block(self, handle): + return LowLevelILBasicBlock(handle, self, self.view) + + @property + def basic_blocks(self) -> 'function.BasicBlockList': + """function.BasicBlockList of LowLevelILBasicBlock objects (read-only)""" + return function.BasicBlockList(self) @property def instructions(self) -> Generator['LowLevelILInstruction', None, None]: """A generator of llil instructions of the current llil function""" for block in self.basic_blocks: - for i in block: - yield i + yield from block @property def ssa_form(self) -> 'LowLevelILFunction': @@ -2863,6 +2859,10 @@ class LowLevelILFunction: self._source_function = value @property + def view(self) -> 'binaryview.BinaryView': + return self.source_function.view + + @property def il_form(self) -> FunctionGraphType: if len(list(self.basic_blocks)) < 1: return FunctionGraphType.InvalidILViewType |
