summaryrefslogtreecommitdiff
path: root/rust/src/binaryview.rs
diff options
context:
space:
mode:
authorZichuan Li <34680029+river-li@users.noreply.github.com>2024-06-12 13:19:57 -0400
committerZichuan Li <34680029+river-li@users.noreply.github.com>2024-06-19 13:06:04 -0400
commitaa9c28e91b5c2ef6ab0e2aff7e44f8a16de998f7 (patch)
tree9c2c52940f227a9b1640d09119615d0365f3d906 /rust/src/binaryview.rs
parent89060ca7644244b3fba94bf746db588e707e7c8d (diff)
Add data_variable_at_address and fixed the type propagation issue in riscv
Diffstat (limited to 'rust/src/binaryview.rs')
-rw-r--r--rust/src/binaryview.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs
index 8d7a2db4..bf14580c 100644
--- a/rust/src/binaryview.rs
+++ b/rust/src/binaryview.rs
@@ -564,6 +564,17 @@ pub trait BinaryViewExt: BinaryViewBase {
}
}
+ fn data_variable_at_address(&self, addr: u64) -> Option<Ref<DataVariable>> {
+ let dv = BNDataVariable::default();
+ unsafe {
+ if BNGetDataVariableAtAddress(self.as_ref().handle, addr, std::mem::transmute(&dv)) {
+ Some(DataVariable(dv).to_owned())
+ } else {
+ None
+ }
+ }
+ }
+
fn define_auto_data_var<'a, T: Into<Conf<&'a Type>>>(&self, addr: u64, ty: T) {
unsafe {
BNDefineDataVariable(self.as_ref().handle, addr, &mut ty.into().into());