summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-08-15 00:24:03 -0400
committerRusty Wagner <rusty@vector35.com>2017-08-15 18:30:13 -0400
commitec2d882e1a165b703e8fedaa81246dcdd91f50f3 (patch)
treea6d9f2aebca1618db3aea5faf14ea6ddb60b7002 /python/types.py
parent6bcb7bd30e5e6a8e69c875841f04245b8c3a0d7a (diff)
Add APIs to access and update portions of the function type, and added new APIs for global registers and implicit incoming state in calling conventions
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/python/types.py b/python/types.py
index 47d99bee..e297ddd2 100644
--- a/python/types.py
+++ b/python/types.py
@@ -279,7 +279,7 @@ class Type(object):
result = core.BNGetTypeCallingConvention(self.handle)
if not result.convention:
return None
- return callingconvention.CallingConvention(None, handle = result, confidence = result.confidence)
+ return callingconvention.CallingConvention(None, handle = result.convention, confidence = result.confidence)
@property
def parameters(self):
@@ -295,7 +295,8 @@ class Type(object):
@property
def has_variable_arguments(self):
"""Whether type has variable arguments (read-only)"""
- return core.BNTypeHasVariableArguments(self.handle)
+ result = core.BNTypeHasVariableArguments(self.handle)
+ return BoolWithConfidence(result.value, confidence = result.confidence)
@property
def can_return(self):
@@ -505,7 +506,7 @@ class Type(object):
return Type(core.BNCreateArrayType(type_conf, count))
@classmethod
- def function(self, ret, params, calling_convention=None, variable_arguments=False):
+ def function(self, ret, params, calling_convention=None, variable_arguments=None):
"""
``function`` class method for creating an function Type.
@@ -537,8 +538,17 @@ class Type(object):
conv_conf.convention = calling_convention.handle
conv_conf.confidence = calling_convention.confidence
+ if variable_arguments is None:
+ variable_arguments = BoolWithConfidence(False, confidence = 0)
+ elif not isinstance(variable_arguments, BoolWithConfidence):
+ variable_arguments = BoolWithConfidence(variable_arguments)
+
+ vararg_conf = core.BNBoolWithConfidence()
+ vararg_conf.value = variable_arguments.value
+ vararg_conf.confidence = variable_arguments.confidence
+
return Type(core.BNCreateFunctionType(ret_conf, conv_conf, param_buf, len(params),
- variable_arguments))
+ vararg_conf))
@classmethod
def generate_auto_type_id(self, source, name):