summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/__init__.py b/python/__init__.py
index 8ddb6262..821e3f41 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -2408,6 +2408,21 @@ class Function(object):
core.BNFreeIndirectBranchList(branches)
return result
+ def get_block_annotations(self, arch, addr):
+ count = ctypes.c_ulonglong(0)
+ lines = core.BNGetFunctionBlockAnnotations(self.handle, arch.handle, addr, count)
+ result = []
+ for i in xrange(0, count.value):
+ tokens = []
+ for j in xrange(0, lines[i].count):
+ token_type = core.BNInstructionTextTokenType_names[lines[i].tokens[j].type]
+ text = lines[i].tokens[j].text
+ value = lines[i].tokens[j].value
+ tokens.append(InstructionTextToken(token_type, text, value))
+ result.append(tokens)
+ core.BNFreeInstructionTextLines(lines, count.value)
+ return result
+
class BasicBlockEdge:
def __init__(self, branch_type, target, arch):
self.type = core.BNBranchType_names[branch_type]
@@ -2484,6 +2499,11 @@ class BasicBlock(object):
"""Whether basic block has undetermined outgoing edges (read-only)"""
return core.BNBasicBlockHasUndeterminedOutgoingEdges(self.handle)
+ @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)
+
def __setattr__(self, name, value):
try:
object.__setattr__(self,name,value)