From 2e5b893b79e053dbacd8a72cc900d1af1d825041 Mon Sep 17 00:00:00 2001 From: Mason Reed <35282038+emesare@users.noreply.github.com> Date: Mon, 15 Dec 2025 19:41:38 -0500 Subject: [Rust] Return Array in more debug info functions (#7744) --- rust/src/variable.rs | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'rust/src/variable.rs') diff --git a/rust/src/variable.rs b/rust/src/variable.rs index d224a45b..fe833f97 100644 --- a/rust/src/variable.rs +++ b/rust/src/variable.rs @@ -8,13 +8,13 @@ use crate::string::{raw_to_string, BnString}; use crate::types::Type; use binaryninjacore_sys::{ BNDataVariable, BNDataVariableAndName, BNFreeDataVariableAndName, BNFreeDataVariables, - BNFreeILInstructionList, BNFreeIndirectBranchList, BNFreeMergedVariableList, - BNFreePossibleValueSet, BNFreeStackVariableReferenceList, BNFreeUserVariableValues, - BNFreeVariableList, BNFreeVariableNameAndTypeList, BNFromVariableIdentifier, - BNIndirectBranchInfo, BNLookupTableEntry, BNMergedVariable, BNPossibleValueSet, - BNRegisterValue, BNRegisterValueType, BNStackVariableReference, BNToVariableIdentifier, - BNTypeWithConfidence, BNUserVariableValue, BNValueRange, BNVariable, BNVariableNameAndType, - BNVariableSourceType, + BNFreeDataVariablesAndName, BNFreeILInstructionList, BNFreeIndirectBranchList, + BNFreeMergedVariableList, BNFreePossibleValueSet, BNFreeStackVariableReferenceList, + BNFreeUserVariableValues, BNFreeVariableList, BNFreeVariableNameAndTypeList, + BNFromVariableIdentifier, BNIndirectBranchInfo, BNLookupTableEntry, BNMergedVariable, + BNPossibleValueSet, BNRegisterValue, BNRegisterValueType, BNStackVariableReference, + BNToVariableIdentifier, BNTypeWithConfidence, BNUserVariableValue, BNValueRange, BNVariable, + BNVariableNameAndType, BNVariableSourceType, }; use std::collections::HashSet; @@ -147,6 +147,22 @@ impl NamedDataVariableWithType { } } +impl CoreArrayProvider for NamedDataVariableWithType { + type Raw = BNDataVariableAndName; + type Context = (); + type Wrapped<'a> = NamedDataVariableWithType; +} + +unsafe impl CoreArrayProviderInner for NamedDataVariableWithType { + unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { + BNFreeDataVariablesAndName(raw, count) + } + + unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> { + Self::from_raw(raw) + } +} + #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct NamedVariableWithType { pub variable: Variable, -- cgit v1.3.1