diff options
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/debuginfo.rs | 16 | ||||
| -rw-r--r-- | rust/src/types.rs | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/rust/src/debuginfo.rs b/rust/src/debuginfo.rs index 36cbc5b7..fb108a21 100644 --- a/rust/src/debuginfo.rs +++ b/rust/src/debuginfo.rs @@ -791,6 +791,22 @@ impl DebugInfo { }, } } + + pub fn add_data_variable_info<S: BnStrCompatible>(&self, var: DataVariableAndName<S>) -> bool { + let name = var.name.into_bytes_with_nul(); + unsafe { + BNAddDebugDataVariableInfo( + self.handle, + &mut BNDataVariableAndName { + address: var.address, + type_: var.t.contents.handle, + name: name.as_ref().as_ptr() as *mut _, + autoDiscovered: var.auto_discovered, + typeConfidence: var.t.confidence, + }, + ) + } + } } unsafe impl RefCountable for DebugInfo { diff --git a/rust/src/types.rs b/rust/src/types.rs index 6bd85d0e..11934ceb 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -2179,6 +2179,15 @@ impl DataVariableAndName<String> { } impl<S: BnStrCompatible> DataVariableAndName<S> { + pub fn new(address: u64, t: Conf<Ref<Type>>, auto_discovered: bool, name: S) -> Self { + Self { + address, + t, + auto_discovered, + name, + } + } + pub fn type_with_confidence(&self) -> Conf<Ref<Type>> { Conf::new(self.t.contents.clone(), self.t.confidence) } |
