diff options
| author | Brandon Miller <brandon@vector35.com> | 2026-05-22 15:44:53 -0400 |
|---|---|---|
| committer | Brandon Miller <brandon@vector35.com> | 2026-05-27 08:36:26 -0400 |
| commit | 8fbf9ca9c0c32c600008dc6d85cacf84276736f8 (patch) | |
| tree | dfac45c21a5ce7902cfedc96ecf4effdf4808832 /rust/src/binary_view.rs | |
| parent | 8bb4ab351a7a0f371ca758ed82ca50085e6c50fd (diff) | |
Rust APIs for custom function lifters
Diffstat (limited to 'rust/src/binary_view.rs')
| -rw-r--r-- | rust/src/binary_view.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs index c455635a..cda76ef2 100644 --- a/rust/src/binary_view.rs +++ b/rust/src/binary_view.rs @@ -1808,17 +1808,22 @@ impl BinaryView { address: u64, platform: &Platform, ) -> Option<Ref<Function>> { - self.add_auto_function_ext(address, platform, None) + self.add_auto_function_ext(address, platform, None, false) } /// Add an auto function at the given `address` with the `platform` and function type. /// + /// The `auto_discovered` flag is used to prevent or allow this created function to be deleted if + /// it is never used (the function has no xrefs), if you are confident that this is a valid function + /// set this to `false`. + /// /// NOTE: If the view's default platform is not set, this will set it to `platform`. pub fn add_auto_function_ext( &self, address: u64, platform: &Platform, func_type: Option<&Type>, + auto_discovered: bool, ) -> Option<Ref<Function>> { unsafe { let func_type = match func_type { @@ -1826,8 +1831,13 @@ impl BinaryView { None => std::ptr::null_mut(), }; - let handle = - BNAddFunctionForAnalysis(self.handle, platform.handle, address, true, func_type); + let handle = BNAddFunctionForAnalysis( + self.handle, + platform.handle, + address, + auto_discovered, + func_type, + ); if handle.is_null() { return None; |
