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

Method basic_block_containing

rust/src/function.rs:433–447  ·  view source on GitHub ↗

Returns the BasicBlock that contains the given address `addr`. `addr` - Address of the BasicBlock to retrieve. `arch` - Architecture of the basic block if different from the Function's self.arch # Example ```no_run # use binaryninja::function::Function; # let fun: Function = todo!(); let blocks = fun.basic_block_containing(0x1000, None); ```

(
        &self,
        addr: u64,
        arch: Option<CoreArchitecture>,
    )

Source from the content-addressed store, hash-verified

431 /// let blocks = fun.basic_block_containing(0x1000, None);
432 /// ```
433 pub fn basic_block_containing(
434 &self,
435 addr: u64,
436 arch: Option<CoreArchitecture>,
437 ) -> Option<Ref<BasicBlock<NativeBlock>>> {
438 let arch = arch.unwrap_or_else(|| self.arch());
439 unsafe {
440 let basic_block_ptr = BNGetFunctionBasicBlockAtAddress(self.handle, arch.handle, addr);
441 let context = NativeBlock { _priv: () };
442 match basic_block_ptr.is_null() {
443 false => Some(BasicBlock::ref_from_raw(basic_block_ptr, context)),
444 true => None,
445 }
446 }
447 }
448
449 pub fn block_annotations(
450 &self,

Callers

nothing calls this directly

Calls 1

archMethod · 0.45

Tested by

no test coverage detected