summaryrefslogtreecommitdiff
path: root/python/callingconvention.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/callingconvention.py')
-rw-r--r--python/callingconvention.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/callingconvention.py b/python/callingconvention.py
index db473c53..21c8c95a 100644
--- a/python/callingconvention.py
+++ b/python/callingconvention.py
@@ -41,8 +41,10 @@ class CallingConvention(object):
_registered_calling_conventions = []
- def __init__(self, arch, handle = None, confidence = types.max_confidence):
+ def __init__(self, arch=None, name=None, handle=None, confidence=types.max_confidence):
if handle is None:
+ if arch is None or name is None:
+ raise ValueError("Must specify either handle or architecture and name")
self.arch = arch
self._pending_reg_lists = {}
self._cb = core.BNCustomCallingConvention()
@@ -56,7 +58,7 @@ class CallingConvention(object):
self._cb.getIntegerReturnValueRegister = self._cb.getIntegerReturnValueRegister.__class__(self._get_int_return_reg)
self._cb.getHighIntegerReturnValueRegister = self._cb.getHighIntegerReturnValueRegister.__class__(self._get_high_int_return_reg)
self._cb.getFloatReturnValueRegister = self._cb.getFloatReturnValueRegister.__class__(self._get_float_return_reg)
- self.handle = core.BNCreateCallingConvention(arch.handle, self.__class__.name, self._cb)
+ self.handle = core.BNCreateCallingConvention(arch.handle, name, self._cb)
self.__class__._registered_calling_conventions.append(self)
else:
self.handle = handle