diff options
| author | Glenn Smith <glenn@vector35.com> | 2025-02-06 15:00:04 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-02-06 15:04:05 -0500 |
| commit | 3355345145771291936738938721961916331716 (patch) | |
| tree | 86c4e52556610081deb3bfc790bb01ac62906c99 /rust/src/function.rs | |
| parent | 1473293c5e4463b5667e886b6e709582fc856872 (diff) | |
Add After variants for looking up variables at instructions
Fixes #6397
Diffstat (limited to 'rust/src/function.rs')
| -rw-r--r-- | rust/src/function.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs index f122aeff..b438520a 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -1944,6 +1944,35 @@ impl Function { Some((var, name, var_type)) } + pub fn stack_var_at_frame_offset_after_instruction( + &self, + addr: u64, + offset: i64, + arch: Option<CoreArchitecture>, + ) -> Option<(Variable, BnString, Conf<Ref<Type>>)> { + let arch = arch.unwrap_or_else(|| self.arch()); + let mut found_value = BNVariableNameAndType::default(); + let found = unsafe { + BNGetStackVariableAtFrameOffsetAfterInstruction( + self.handle, + arch.handle, + addr, + offset, + &mut found_value, + ) + }; + if !found { + return None; + } + let var = Variable::from(found_value.var); + let name = unsafe { BnString::from_raw(found_value.name) }; + let var_type = Conf::new( + unsafe { Type::ref_from_raw(found_value.type_) }, + found_value.typeConfidence, + ); + Some((var, name, var_type)) + } + pub fn stack_variables_referenced_by( &self, addr: u64, |
