diff options
| author | Mason Reed <mason@vector35.com> | 2026-02-22 17:08:21 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-02-23 00:09:44 -0800 |
| commit | b18bdad6c94a8e234108d531f0c480c7104abebe (patch) | |
| tree | b0edb86cfae52c37635ef0b5cac491220bc3ef24 /plugins | |
| parent | dbd54d67a6d523f64615f653d82d8224cd09870a (diff) | |
[Rust] Misc documentation and cleanup
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/bntl_utils/src/dump.rs | 3 | ||||
| -rw-r--r-- | plugins/svd/tests/mapper.rs | 4 | ||||
| -rw-r--r-- | plugins/warp/src/processor.rs | 7 | ||||
| -rw-r--r-- | plugins/warp/tests/matcher.rs | 5 |
4 files changed, 11 insertions, 8 deletions
diff --git a/plugins/bntl_utils/src/dump.rs b/plugins/bntl_utils/src/dump.rs index 410f1cb1..c2e92498 100644 --- a/plugins/bntl_utils/src/dump.rs +++ b/plugins/bntl_utils/src/dump.rs @@ -47,8 +47,7 @@ impl TILDump { pub fn dump(&self, type_lib: &TypeLibrary) -> Result<String, TILDumpError> { let empty_file = FileMetadata::new(); - let empty_bv = BinaryView::from_data(&empty_file, &[]) - .map_err(|_| TILDumpError::ViewCreationFailed)?; + let empty_bv = BinaryView::from_data(&empty_file, &[]); let type_lib_plats = type_lib.platform_names(); let platform_name = type_lib_plats diff --git a/plugins/svd/tests/mapper.rs b/plugins/svd/tests/mapper.rs index 10f95c40..8af8c261 100644 --- a/plugins/svd/tests/mapper.rs +++ b/plugins/svd/tests/mapper.rs @@ -18,7 +18,7 @@ fn insta_snapshots() { let path = out_dir.join(file_name); let svd_str = std::fs::read_to_string(&path).expect("Failed to read svd file"); let device = svd_parser::parse(&svd_str).expect("Failed to parse svd file"); - let view = BinaryView::from_data(&FileMetadata::new(), &[]).expect("Failed to create view"); + let view = BinaryView::from_data(&FileMetadata::new(), &[]); let address_size = view.address_size(); DeviceMapper::new(LoadSettings::default(), address_size, device).map_to_view(&view); @@ -46,7 +46,7 @@ fn test_bitfield_unions() { let path = out_dir.join("ARM_Sample.svd"); let svd_str = std::fs::read_to_string(&path).expect("Failed to read svd file"); let device = svd_parser::parse(&svd_str).expect("Failed to parse svd file"); - let view = BinaryView::from_data(&FileMetadata::new(), &[]).expect("Failed to create view"); + let view = BinaryView::from_data(&FileMetadata::new(), &[]); let address_size = view.address_size(); let mapper = DeviceMapper::new(LoadSettings::default(), address_size, device.clone()); diff --git a/plugins/warp/src/processor.rs b/plugins/warp/src/processor.rs index e21a2efd..12403ed2 100644 --- a/plugins/warp/src/processor.rs +++ b/plugins/warp/src/processor.rs @@ -29,6 +29,7 @@ use binaryninja::rc::{Guard, Ref}; use crate::cache::cached_type_references; use crate::convert::platform_to_target; use crate::{build_function, INCLUDE_TAG_ICON, INCLUDE_TAG_NAME}; +use binaryninja::file_metadata::{SaveOption, SaveSettings}; use warp::chunk::{Chunk, ChunkKind, CompressionType}; use warp::r#type::chunk::TypeChunk; use warp::signature::chunk::SignatureChunk; @@ -645,7 +646,11 @@ impl WarpFileProcessor { if !view.file().is_database_backed() { // Update the cache. tracing::debug!("Saving analysis database to {:?}", file_cache_path); - if !view.file().create_database(&file_cache_path) { + let save_settings = SaveSettings::new().with_option(SaveOption::RemoveUndoData); + if !view + .file() + .create_database(&file_cache_path, &save_settings) + { // TODO: We might want to error here... tracing::warn!("Failed to save analysis database to {:?}", file_cache_path); } diff --git a/plugins/warp/tests/matcher.rs b/plugins/warp/tests/matcher.rs index 880112d0..d2d7a960 100644 --- a/plugins/warp/tests/matcher.rs +++ b/plugins/warp/tests/matcher.rs @@ -33,8 +33,7 @@ const MOCK_FUNCTION_BYTES: &[u8] = &[ fn create_mock_bn_function(_session: &Session) -> Ref<BNFunction> { let file = FileMetadata::new(); - let view = - BinaryView::from_data(&file, MOCK_FUNCTION_BYTES).expect("Failed to create mock view"); + let view = BinaryView::from_data(&file, MOCK_FUNCTION_BYTES); let platform = Platform::by_name("x86").unwrap(); // Add the constraint symbol so that the matcher picks it up, so we can test constraint matching. let constraint_symbol = @@ -160,7 +159,7 @@ fn test_add_type_to_view() { let _session = Session::new().expect("Failed to create session"); let file = FileMetadata::new(); - let view = BinaryView::from_data(&file, &[]).expect("Failed to create view"); + let view = BinaryView::from_data(&file, &[]); let arch = CoreArchitecture::by_name("x86").expect("Failed to get architecture"); // Try and add a NTR to the view, this should also add the referenced struct type. |
