summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2021-01-14 22:07:19 -0500
committerGlenn Smith <glenn@vector35.com>2021-01-21 00:06:22 -0500
commit0245b2c84223be520fdfce4e5afdabbdfbe95ee7 (patch)
treef421696cdbc72ab4a62c2074acc1fc87312203e9 /python
parentf8feaa587bcba564ef96955a57121764a0fb0573 (diff)
Let calling conventions opt out of heuristics
Diffstat (limited to 'python')
-rw-r--r--python/callingconvention.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/python/callingconvention.py b/python/callingconvention.py
index 5e4c0dac..aaf86239 100644
--- a/python/callingconvention.py
+++ b/python/callingconvention.py
@@ -40,6 +40,7 @@ class CallingConvention(object):
arg_regs_share_index = False
stack_reserved_for_arg_regs = False
stack_adjusted_on_return = False
+ eligible_for_heuristics = True
int_return_reg = None
high_int_return_reg = None
float_return_reg = None
@@ -65,6 +66,7 @@ class CallingConvention(object):
self._cb.areArgumentRegistersSharedIndex = self._cb.areArgumentRegistersSharedIndex.__class__(self._arg_regs_share_index)
self._cb.isStackReservedForArgumentRegisters = self._cb.isStackReservedForArgumentRegisters.__class__(self._stack_reserved_for_arg_regs)
self._cb.isStackAdjustedOnReturn = self._cb.isStackAdjustedOnReturn.__class__(self._stack_adjusted_on_return)
+ self._cb.isEligibleForHeuristics = self._cb.isEligibleForHeuristics.__class__(self._eligible_for_heuristics)
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)
@@ -83,6 +85,7 @@ class CallingConvention(object):
self.__dict__["arg_regs_share_index"] = core.BNAreArgumentRegistersSharedIndex(self.handle)
self.__dict__["stack_reserved_for_arg_regs"] = core.BNIsStackReservedForArgumentRegisters(self.handle)
self.__dict__["stack_adjusted_on_return"] = core.BNIsStackAdjustedOnReturn(self.handle)
+ self.__dict__["eligible_for_heuristics"] = core.BNIsEligibleForHeuristics(self.handle)
count = ctypes.c_ulonglong()
regs = core.BNGetCallerSavedRegisters(self.handle, count)
@@ -268,6 +271,13 @@ class CallingConvention(object):
log.log_error(traceback.format_exc())
return False
+ def _eligible_for_heuristics(self, ctxt):
+ try:
+ return self.__class__.eligible_for_heuristics
+ except:
+ log.log_error(traceback.format_exc())
+ return False
+
def _get_int_return_reg(self, ctxt):
try:
return self.arch.regs[self.__class__.int_return_reg].index