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

Function cb_assemble

rust/src/architecture.rs:2974–3008  ·  view source on GitHub ↗
(
        ctxt: *mut c_void,
        code: *const c_char,
        addr: u64,
        buffer: *mut BNDataBuffer,
        errors: *mut *mut c_char,
    )

Source from the content-addressed store, hash-verified

2972 }
2973
2974 extern "C" fn cb_assemble<A>(
2975 ctxt: *mut c_void,
2976 code: *const c_char,
2977 addr: u64,
2978 buffer: *mut BNDataBuffer,
2979 errors: *mut *mut c_char,
2980 ) -> bool
2981 where
2982 A: 'static + Architecture<Handle = CustomArchitectureHandle<A>> + Send + Sync,
2983 {
2984 let custom_arch = unsafe { &*(ctxt as *mut A) };
2985 let code = raw_to_string(code).unwrap_or("".into());
2986 let mut buffer = DataBuffer::from_raw(buffer);
2987
2988 let result = match custom_arch.assemble(&code, addr) {
2989 Ok(result) => {
2990 buffer.set_data(&result);
2991 unsafe {
2992 *errors = BnString::into_raw(BnString::new(""));
2993 }
2994 true
2995 }
2996 Err(result) => {
2997 unsafe {
2998 *errors = BnString::into_raw(BnString::new(result));
2999 }
3000 false
3001 }
3002 };
3003
3004 // Caller owns the data buffer, don't free it
3005 std::mem::forget(buffer);
3006
3007 result
3008 }
3009
3010 extern "C" fn cb_is_never_branch_patch_available<A>(
3011 ctxt: *mut c_void,

Callers

nothing calls this directly

Calls 3

raw_to_stringFunction · 0.85
assembleMethod · 0.45
set_dataMethod · 0.45

Tested by

no test coverage detected