diff options
| author | Mason Reed <mason@vector35.com> | 2026-02-22 17:16:52 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-02-23 00:09:44 -0800 |
| commit | f3e0bf4ab35d50b11b2dbde41a699ab7497208d1 (patch) | |
| tree | 660c94b4dd609b28b77c5ba2daabfa893cecefa2 /plugins/bntl_utils/src | |
| parent | b18bdad6c94a8e234108d531f0c480c7104abebe (diff) | |
[BNTL] Misc improvements
Diffstat (limited to 'plugins/bntl_utils/src')
| -rw-r--r-- | plugins/bntl_utils/src/command/validate.rs | 2 | ||||
| -rw-r--r-- | plugins/bntl_utils/src/process.rs | 30 | ||||
| -rw-r--r-- | plugins/bntl_utils/src/tbd.rs | 2 |
3 files changed, 22 insertions, 12 deletions
diff --git a/plugins/bntl_utils/src/command/validate.rs b/plugins/bntl_utils/src/command/validate.rs index a0507974..b95699e0 100644 --- a/plugins/bntl_utils/src/command/validate.rs +++ b/plugins/bntl_utils/src/command/validate.rs @@ -1,7 +1,7 @@ use crate::command::{InputDirectoryField, OutputDirectoryField}; use crate::helper::path_to_type_libraries; use crate::validate::TypeLibValidater; -use binaryninja::binary_view::{BinaryView, BinaryViewExt}; +use binaryninja::binary_view::BinaryView; use binaryninja::command::Command; use binaryninja::interaction::Form; use binaryninja::platform::Platform; diff --git a/plugins/bntl_utils/src/process.rs b/plugins/bntl_utils/src/process.rs index b81986af..3f4aec69 100644 --- a/plugins/bntl_utils/src/process.rs +++ b/plugins/bntl_utils/src/process.rs @@ -354,12 +354,12 @@ impl ProcessedData { (QualifiedName, CoreArchitecture), Vec<Ref<TypeLibrary>>, > = HashMap::new(); - for merged_type_library in &self.type_libraries { - for named_type in &merged_type_library.named_types() { + for tl in &self.type_libraries { + for named_type in &tl.named_types() { mapped_named_types - .entry((named_type.name.clone(), merged_type_library.arch())) + .entry((named_type.name.clone(), tl.arch())) .or_default() - .push(merged_type_library.clone()); + .push(tl.clone()); } } @@ -553,12 +553,16 @@ impl TypeLibProcessor { .filter_map(|res| match res { Ok(result) => Some(Ok(result)), Err(ProcessingError::SkippedFile(path)) => { - tracing::debug!("Skipping project root file: {:?}", path); + tracing::debug!("Skipping project file: {:?}", path); None } Err(ProcessingError::Cancelled) => Some(Err(ProcessingError::Cancelled)), + Err(ProcessingError::NoPathToProjectFile(path)) => { + tracing::warn!("Project file not downloaded: {:?}", path); + None + } Err(e) => { - tracing::error!("Project root file processing error: {:?}", e); + tracing::error!("Project file processing error: {:?}", e); None } }) @@ -588,12 +592,16 @@ impl TypeLibProcessor { .filter_map(|res| match res { Ok(result) => Some(Ok(result)), Err(ProcessingError::SkippedFile(path)) => { - tracing::debug!("Skipping project directory file: {:?}", path); + tracing::debug!("Skipping project file: {:?}", path); None } Err(ProcessingError::Cancelled) => Some(Err(ProcessingError::Cancelled)), + Err(ProcessingError::NoPathToProjectFile(path)) => { + tracing::warn!("Project file not downloaded: {:?}", path); + None + } Err(e) => { - tracing::error!("Project folder file processing error: {:?}", e); + tracing::error!("Project file processing error: {:?}", e); None } }) @@ -1093,13 +1101,13 @@ pub fn is_parsable(path: &Path) -> bool { if path.extension() == Some(OsStr::new("pdb")) { return false; } - let mut metadata = FileMetadata::with_file_path(path); - let Ok(view) = BinaryView::from_path(&metadata, path) else { + let metadata = FileMetadata::with_file_path(path); + let Ok(view) = BinaryView::from_metadata(&metadata) else { return false; }; // If any view type parses this file, consider it for this source. // All files will have a "Raw" file type, so we account for that. - BinaryViewType::list_valid_types_for(&view).len() > 1 + BinaryViewType::valid_types_for_data(&view).len() > 1 } #[cfg(test)] diff --git a/plugins/bntl_utils/src/tbd.rs b/plugins/bntl_utils/src/tbd.rs index 9075a8dc..01855c13 100644 --- a/plugins/bntl_utils/src/tbd.rs +++ b/plugins/bntl_utils/src/tbd.rs @@ -1,3 +1,5 @@ +//! Parse Apples TBD file format, which gives information about where source symbols are located. + use binaryninja::architecture::CoreArchitecture; use binaryninja::platform::Platform; use binaryninja::rc::Ref; |
