diff options
Diffstat (limited to 'rust/src/variable.rs')
| -rw-r--r-- | rust/src/variable.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rust/src/variable.rs b/rust/src/variable.rs index 1921f950..dd7f4cf5 100644 --- a/rust/src/variable.rs +++ b/rust/src/variable.rs @@ -1,5 +1,6 @@ #![allow(unused)] +use crate::architecture::{Architecture, CoreArchitecture, CoreRegister, RegisterId}; use crate::confidence::Conf; use crate::function::{Function, Location}; use crate::rc::{CoreArrayProvider, CoreArrayProviderInner, Ref}; @@ -387,6 +388,16 @@ impl Variable { let raw = BNVariable::from(*self); unsafe { BNToVariableIdentifier(&raw) } } + + pub fn to_register(&self, arch: CoreArchitecture) -> Option<CoreRegister> { + match self.ty { + VariableSourceType::RegisterVariableSourceType => { + arch.register_from_id(RegisterId(self.storage as u32)) + } + VariableSourceType::StackVariableSourceType => None, + VariableSourceType::FlagVariableSourceType => None, + } + } } impl From<BNVariable> for Variable { |
