diff options
| author | Brandon Miller <brandon@vector35.com> | 2025-09-25 08:55:34 -0400 |
|---|---|---|
| committer | Brandon Miller <brandon@vector35.com> | 2025-09-29 07:07:41 -0400 |
| commit | 9a9d7d98c2b49c734771397a8d37aca0279dfa21 (patch) | |
| tree | 7925d31daeeb265e58995bc392f0960a58c7a065 /rust/src/function.rs | |
| parent | 63e37dfb1185552135e397a786e92cd8669880a8 (diff) | |
Rust APIs needed for guided analysis mode
Required for implementing guided analysis mode in custom
implementations of analyze_basic_blocks
Diffstat (limited to 'rust/src/function.rs')
| -rw-r--r-- | rust/src/function.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/src/function.rs b/rust/src/function.rs index 692eb817..1a4add05 100644 --- a/rust/src/function.rs +++ b/rust/src/function.rs @@ -49,6 +49,7 @@ use crate::variable::{ StackVariableReference, Variable, }; use crate::workflow::Workflow; +use std::collections::HashSet; use std::ffi::CStr; use std::fmt::{Debug, Formatter}; use std::ptr::NonNull; @@ -2586,6 +2587,21 @@ impl Function { let key = key.to_cstr(); unsafe { BNFunctionRemoveMetadata(self.handle, key.as_ptr()) }; } + + pub fn guided_source_blocks(&self) -> HashSet<ArchAndAddr> { + let mut count = 0; + let raw = unsafe { BNGetGuidedSourceBlocks(self.handle, &mut count) }; + if raw.is_null() || count == 0 { + return HashSet::new(); + } + + (0..count) + .map(|i| { + let raw = unsafe { std::ptr::read(raw.add(i)) }; + ArchAndAddr::from(raw) + }) + .collect::<HashSet<_>>() + } } impl Debug for Function { |
