summaryrefslogtreecommitdiff
path: root/python/basicblock.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-02-17 23:22:17 -0500
committerRusty Wagner <rusty@vector35.com>2017-02-17 23:23:12 -0500
commitc46c3a9540f4d15eff8aa9660df69e374f7fd2f5 (patch)
tree5ca970d051db42fb40061273e7ccfc1ae14e1c01 /python/basicblock.py
parent431dad36edd8c55a0c32759c7b939a5d017d5c46 (diff)
Add dominator APIs
Diffstat (limited to 'python/basicblock.py')
-rw-r--r--python/basicblock.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/python/basicblock.py b/python/basicblock.py
index ebacb311..9d48d3cb 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -134,6 +134,36 @@ class BasicBlock(object):
return core.BNBasicBlockHasUndeterminedOutgoingEdges(self.handle)
@property
+ def dominators(self):
+ """List of dominators for this basic block (read-only)"""
+ count = ctypes.c_ulonglong()
+ blocks = core.BNGetBasicBlockDominators(self.handle, count)
+ result = []
+ for i in xrange(0, count.value):
+ result.append(BasicBlock(self.view, core.BNNewBasicBlockReference(blocks[i])))
+ core.BNFreeBasicBlockList(blocks, count.value)
+ return result
+
+ @property
+ def strict_dominators(self):
+ """List of strict dominators for this basic block (read-only)"""
+ count = ctypes.c_ulonglong()
+ blocks = core.BNGetBasicBlockStrictDominators(self.handle, count)
+ result = []
+ for i in xrange(0, count.value):
+ result.append(BasicBlock(self.view, core.BNNewBasicBlockReference(blocks[i])))
+ core.BNFreeBasicBlockList(blocks, count.value)
+ return result
+
+ @property
+ def immediate_dominator(self):
+ """Immediate dominator of this basic block (read-only)"""
+ result = core.BNGetBasicBlockImmediateDominator(self.handle)
+ if not result:
+ return None
+ return BasicBlock(self.view, result)
+
+ @property
def annotations(self):
"""List of automatic annotations for the start of this block (read-only)"""
return self.function.get_block_annotations(self.arch, self.start)