diff options
| author | Mason Reed <mason@vector35.com> | 2025-02-14 23:35:40 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-02-24 20:08:01 -0500 |
| commit | a87f4888eddf804baed4df3de3ac81d737d78ed3 (patch) | |
| tree | 0fa5c8ad295e0cc5eaab2a6157e30ea1b39fe976 /rust/src/binary_view.rs | |
| parent | 57d04f2f88adad219e5d526b05bfea88de4818bd (diff) | |
Implement Rust MemoryMap
Also split out SegmentFlags and fix some UB with the section creation
Diffstat (limited to 'rust/src/binary_view.rs')
| -rw-r--r-- | rust/src/binary_view.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs index 396c04ce..aa5f47f5 100644 --- a/rust/src/binary_view.rs +++ b/rust/src/binary_view.rs @@ -26,6 +26,7 @@ use binaryninjacore_sys::*; use crate::architecture::{Architecture, CoreArchitecture}; use crate::base_detection::BaseAddressDetection; use crate::basic_block::BasicBlock; +use crate::binary_view::memory_map::MemoryMap; use crate::component::{Component, IntoComponentGuid}; use crate::confidence::Conf; use crate::data_buffer::DataBuffer; @@ -64,6 +65,8 @@ use std::ptr::NonNull; use std::{result, slice}; // TODO : general reorg of modules related to bv +pub mod memory_map; + pub type Result<R> = result::Result<R, ()>; pub type BinaryViewEventType = BNBinaryViewEventType; pub type AnalysisState = BNAnalysisState; @@ -870,7 +873,7 @@ pub trait BinaryViewExt: BinaryViewBase { unsafe { BNCancelBulkAddSegments(self.as_ref().handle) } } - fn add_section<S: BnStrCompatible>(&self, section: SectionBuilder<S>) { + fn add_section(&self, section: SectionBuilder) { section.create(self.as_ref()); } @@ -918,6 +921,10 @@ pub trait BinaryViewExt: BinaryViewBase { } } + fn memory_map(&self) -> MemoryMap { + MemoryMap::new(self.as_ref().to_owned()) + } + fn add_auto_function(&self, plat: &Platform, addr: u64) -> Option<Ref<Function>> { unsafe { let handle = BNAddFunctionForAnalysis( |
