summaryrefslogtreecommitdiff
path: root/python/function.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-02-06 15:00:04 -0500
committerGlenn Smith <glenn@vector35.com>2025-02-06 15:04:05 -0500
commit3355345145771291936738938721961916331716 (patch)
tree86c4e52556610081deb3bfc790bb01ac62906c99 /python/function.py
parent1473293c5e4463b5667e886b6e709582fc856872 (diff)
Add After variants for looking up variables at instructions
Fixes #6397
Diffstat (limited to 'python/function.py')
-rw-r--r--python/function.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py
index 14cc5e43..d4c7c92c 100644
--- a/python/function.py
+++ b/python/function.py
@@ -2638,6 +2638,18 @@ class Function:
core.BNFreeVariableNameAndType(found_var)
return result
+ def get_stack_var_at_frame_offset_after_instruction(
+ self, offset: int, addr: int, arch: Optional['architecture.Architecture'] = None
+ ) -> Optional['variable.Variable']:
+ if arch is None:
+ arch = self.arch
+ found_var = core.BNVariableNameAndType()
+ if not core.BNGetStackVariableAtFrameOffsetAfterInstruction(self.handle, arch.handle, addr, offset, found_var):
+ return None
+ result = variable.Variable.from_BNVariable(self, found_var.var)
+ core.BNFreeVariableNameAndType(found_var)
+ return result
+
def get_type_tokens(self, settings: Optional['DisassemblySettings'] = None) -> List['DisassemblyTextLine']:
_settings = None
if settings is not None: