diff options
| author | Rusty Wagner <rusty@vector35.com> | 2016-09-10 00:36:27 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2016-09-10 00:36:27 -0400 |
| commit | 6d3fe290eb20e31a33e929933c01d2ca3eb43da1 (patch) | |
| tree | 5adc7c8dd595eff99cfcbeb7b689aae19bd46221 /python/__init__.py | |
| parent | 6be6ee30e5973fa4d5f29cebdeafdf05c3f4251e (diff) | |
Add API for list of basic blocks starting at an address
Diffstat (limited to 'python/__init__.py')
| -rw-r--r-- | python/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/python/__init__.py b/python/__init__.py index 7978fd2c..33202a2c 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -2288,6 +2288,22 @@ class BinaryView(object): core.BNFreeBasicBlockList(blocks, count.value) return result + def get_basic_blocks_starting_at(self, addr): + """ + ``get_basic_blocks_at`` get a list of :py:Class:`BasicBlock` objects which start at the provided virtual address. + + :param int addr: virtual address of BasicBlock desired + :return: a list of :py:Class:`BasicBlock` objects + :rtype: list(BasicBlock) + """ + count = ctypes.c_ulonglong(0) + blocks = core.BNGetBasicBlocksStartingAtAddress(self.handle, addr, count) + result = [] + for i in xrange(0, count.value): + result.append(BasicBlock(self, core.BNNewBasicBlockReference(blocks[i]))) + core.BNFreeBasicBlockList(blocks, count.value) + return result + def get_recent_basic_block_at(self, addr): block = core.BNGetRecentBasicBlockForAddress(self.handle, addr) if block is None: |
