summaryrefslogtreecommitdiff
path: root/python/function.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2017-08-26 22:23:12 -0400
committerPeter LaFosse <peter@vector35.com>2017-08-26 22:23:12 -0400
commitda388dd42cdee70facb084b3012214ca33014fa7 (patch)
treecad30eea655e91c03fc6f3ad94103707fd91c430 /python/function.py
parent71a1a997e9be461a841a0f801bd19a23ad62f106 (diff)
Adding Function level comment APIs
Diffstat (limited to 'python/function.py')
-rw-r--r--python/function.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/python/function.py b/python/function.py
index 4af95738..5daa7b2a 100644
--- a/python/function.py
+++ b/python/function.py
@@ -656,6 +656,16 @@ class Function(object):
result = core.BNGetFunctionGlobalPointerValue(self.handle)
return RegisterValue(self.arch, result.value, confidence = result.confidence)
+ @property
+ def comment(self):
+ """Gets the comment for the current function"""
+ return core.BNGetFunctionComment(self.handle)
+
+ @comment.setter
+ def comment(self, comment):
+ """Sets a comment for the current function"""
+ return core.BNSetFunctionComment(self.handle, comment)
+
def __iter__(self):
count = ctypes.c_ulonglong()
blocks = core.BNGetFunctionBasicBlockList(self.handle, count)
@@ -684,11 +694,22 @@ class Function(object):
def get_comment_at(self, addr):
return core.BNGetCommentForAddress(self.handle, addr)
- def set_comment_at(self, addr, comment):
+ def set_comment(self, addr, comment):
+ """Deprecated use set_comment_at instead"""
core.BNSetCommentForAddress(self.handle, addr, comment)
- def set_comment(self, addr, comment):
- """Deprecated"""
+ def set_comment_at(self, addr, comment):
+ """
+ ``set_comment_at`` sets a comment for the current function at the address specified
+
+ :param addr int: virtual address within the current function to apply the comment to
+ :param comment str: string comment to apply
+ :rtype: None
+ :Example:
+
+ >>> current_function.set_comment_at(here, "hi")
+
+ """
core.BNSetCommentForAddress(self.handle, addr, comment)
def get_low_level_il_at(self, addr, arch=None):