MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / get_data_variables_by_name

Method get_data_variables_by_name

rust/src/debuginfo.rs:622–650  ·  view source on GitHub ↗

The tuple is (DebugInfoParserName, address, type)

(
        &self,
        name: S,
    )

Source from the content-addressed store, hash-verified

620
621 // The tuple is (DebugInfoParserName, address, type)
622 pub fn get_data_variables_by_name<S: BnStrCompatible>(
623 &self,
624 name: S,
625 ) -> Vec<(String, u64, Ref<Type>)> {
626 let name = name.into_bytes_with_nul();
627
628 let mut count: usize = 0;
629 let raw_variables_and_names = unsafe {
630 BNGetDebugDataVariablesByName(self.handle, name.as_ref().as_ptr() as *mut _, &mut count)
631 };
632
633 let variables_and_names: &[*mut BNDataVariableAndName] =
634 unsafe { std::slice::from_raw_parts(raw_variables_and_names as *mut _, count) };
635
636 let result = variables_and_names
637 .iter()
638 .take(count)
639 .map(|&variable_and_name| unsafe {
640 (
641 raw_to_string((*variable_and_name).name).unwrap(),
642 (*variable_and_name).address,
643 Type::from_raw((*variable_and_name).type_).to_owned(),
644 )
645 })
646 .collect();
647
648 unsafe { BNFreeDataVariablesAndName(raw_variables_and_names, count) };
649 result
650 }
651
652 /// The tuple is (DebugInfoParserName, TypeName, type)
653 pub fn get_data_variables_by_address(&self, address: u64) -> Vec<(String, String, Ref<Type>)> {

Callers

nothing calls this directly

Calls 6

raw_to_stringFunction · 0.85
into_bytes_with_nulMethod · 0.80
mapMethod · 0.80
as_refMethod · 0.45
iterMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected