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

Method demangle

rust/src/demangle.rs:195–233  ·  view source on GitHub ↗
(
        &self,
        arch: &CoreArchitecture,
        name: S,
        view: Option<&BinaryView>,
    )

Source from the content-addressed store, hash-verified

193 }
194
195 pub fn demangle<S: BnStrCompatible>(
196 &self,
197 arch: &CoreArchitecture,
198 name: S,
199 view: Option<&BinaryView>,
200 ) -> Option<(QualifiedName, Option<Ref<Type>>)> {
201 let name_bytes = name.into_bytes_with_nul();
202
203 let mut out_type = std::ptr::null_mut();
204 let mut out_var_name = BNQualifiedName::default();
205
206 let view_ptr = match view {
207 Some(v) => v.handle,
208 None => std::ptr::null_mut(),
209 };
210
211 let res = unsafe {
212 BNDemanglerDemangle(
213 self.handle,
214 arch.handle,
215 name_bytes.as_ref().as_ptr() as *const _,
216 &mut out_type,
217 &mut out_var_name,
218 view_ptr,
219 )
220 };
221
222 match res {
223 true => {
224 let var_type = match out_type.is_null() {
225 true => None,
226 false => Some(unsafe { Type::ref_from_raw(out_type) }),
227 };
228
229 Some((QualifiedName::from_owned_raw(out_var_name), var_type))
230 }
231 false => None,
232 }
233 }
234
235 pub fn name(&self) -> BnString {
236 unsafe { BnString::from_raw(BNGetDemanglerName(self.handle)) }

Callers

nothing calls this directly

Calls 2

into_bytes_with_nulMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected