diff options
| author | Mason Reed <mason@vector35.com> | 2025-12-17 21:23:46 -0500 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-01-11 10:36:01 -0800 |
| commit | 168a3fd34824adc9c6a606cd144219701f15cccf (patch) | |
| tree | 9bbac31ece5ea6ab6627998d995a77f7f7e2f8e6 /plugins/workflow_objc/src/metadata | |
| parent | ca91bc1933976c62d24248f0f7c35af38451ff11 (diff) | |
[Rust] Replace `log` with `tracing`
- Added more documentation
- Replaced global named logger for plugins, fixing the issue when the CU has multiple (e.g. statically linked demo)
- Simplified some misc code
This is a breaking change, but I believe there is no better time to make it, we cannot continue to use the `log` crate, it is too limited for our needs.
Diffstat (limited to 'plugins/workflow_objc/src/metadata')
| -rw-r--r-- | plugins/workflow_objc/src/metadata/global_state.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/workflow_objc/src/metadata/global_state.rs b/plugins/workflow_objc/src/metadata/global_state.rs index 61104451..c6682a5f 100644 --- a/plugins/workflow_objc/src/metadata/global_state.rs +++ b/plugins/workflow_objc/src/metadata/global_state.rs @@ -1,10 +1,11 @@ +use binaryninja::file_metadata::SessionId; use binaryninja::{ binary_view::{BinaryView, BinaryViewBase, BinaryViewExt}, file_metadata::FileMetadata, metadata::Metadata, rc::Ref, settings::{QueryOptions, Settings}, - ObjectDestructor, + tracing, ObjectDestructor, }; use dashmap::DashMap; use once_cell::sync::Lazy; @@ -31,8 +32,8 @@ struct SelectorImplementations { sel_to_impl: HashMap<u64, Vec<u64>>, } -static VIEW_INFOS: Lazy<DashMap<usize, Arc<AnalysisInfo>>> = Lazy::new(DashMap::new); -static IGNORED_VIEWS: Lazy<DashMap<usize, bool>> = Lazy::new(DashMap::new); +static VIEW_INFOS: Lazy<DashMap<SessionId, Arc<AnalysisInfo>>> = Lazy::new(DashMap::new); +static IGNORED_VIEWS: Lazy<DashMap<SessionId, bool>> = Lazy::new(DashMap::new); struct ObjectLifetimeObserver; @@ -69,7 +70,7 @@ impl GlobalState { observer.register(); } - fn id(bv: &BinaryView) -> usize { + fn id(bv: &BinaryView) -> SessionId { bv.file().session_id() } @@ -159,7 +160,7 @@ impl AnalysisInfo { }; let version_meta = meta.get("version")?; if version_meta.get_unsigned_integer()? != 1 { - log::error!( + tracing::error!( "workflow_objc: Unexpected Objective-C metadata version. Expected 1, got {}.", version_meta.get_unsigned_integer()? ); @@ -192,7 +193,7 @@ impl AnalysisInfo { for item in &array { let item = item.get_array()?; if item.len() != 2 { - log::warn!( + tracing::warn!( "Expected selector implementation metadata to have 2 items, found {}", item.len() ); |
