diff options
Diffstat (limited to 'python/variable.py')
| -rw-r--r-- | python/variable.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/variable.py b/python/variable.py index 2ab0a9fe..1ea4728e 100644 --- a/python/variable.py +++ b/python/variable.py @@ -834,6 +834,20 @@ class Variable(CoreVariable): core.BNSetFunctionVariableDeadStoreElimination(self._function.handle, self.to_BNVariable(), value) @property + def offset_to_next_variable(self) -> Optional[int]: + """returns number of bytes to the next variable on the stack""" + if self.source_type != VariableSourceType.StackVariableSourceType: + return None + + for i, var in enumerate(self._function.stack_layout): + if var == self: + if i+1 < len(self._function.stack_layout): + return abs(self.storage - self._function.stack_layout[i+1].storage) + else: + return abs(self.storage) + return None + + @property def function(self) -> 'binaryninja.function.Function': """returns the source Function object which this variable belongs to""" return self._function |
