diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2023-02-13 11:12:25 -0500 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2023-02-13 11:12:25 -0500 |
| commit | 229d6f2e760dd3c03df8bc1dcf25fbfa70b1f801 (patch) | |
| tree | 8de2e26b7c6c813f78e96d4c690221c266e62d1f /python | |
| parent | 17daee849c666ffa5535c158754d53ab37bf763f (diff) | |
add new function type property, prepare deprecation for function_type
Diffstat (limited to 'python')
| -rw-r--r-- | python/function.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py index 0c411764..d065f454 100644 --- a/python/function.py +++ b/python/function.py @@ -960,6 +960,9 @@ class Function: return None return highlevelil.HighLevelILFunction(self.arch, result, self) + #@deprecation.deprecated(details="Use .type instead.") + # Uncomment, move below the property decorator, + # and mark deprecated after the next stable @property def function_type(self) -> 'types.FunctionType': """ @@ -978,6 +981,23 @@ class Function: self.set_user_type(value) @property + def type(self) -> 'types.FunctionType': + """ + Function type object, can be set with either a string representing the function prototype + (`str(function)` shows examples) or a :py:class:`Type` object + """ + return types.FunctionType(core.BNGetFunctionType(self.handle), platform=self.platform) + + @type.setter + def type(self, value: Union['types.FunctionType', str]) -> None: # type: ignore + if isinstance(value, str): + (parsed_value, new_name) = self.view.parse_type_string(value) + self.name = str(new_name) + self.set_user_type(parsed_value) + else: + self.set_user_type(value) + + @property def stack_layout(self) -> List['variable.Variable']: """List of function stack variables (read-only)""" count = ctypes.c_ulonglong() |
