summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-07-29 13:48:01 -0400
committerBrian Potchik <brian@vector35.com>2025-07-29 13:48:01 -0400
commit5244be17ac0b2c600cc95c70ec33bde568986d90 (patch)
tree568e4fcfb9015141b3b149272d200ba0dd634dae
parentc2a48b1ff770c092a9745eaa28092b89159beb4f (diff)
Add support for declarative downstream dependencies to workflow system.
-rw-r--r--binaryninjacore.h15
-rw-r--r--plugins/efi_resolver/src/Plugin.cpp3
-rw-r--r--plugins/rtti/plugin.cpp7
-rw-r--r--plugins/warp/src/plugin/workflow.rs7
-rw-r--r--python/binaryview.py2
5 files changed, 23 insertions, 11 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 852ee230..a1766bf8 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -37,7 +37,7 @@
// Current ABI version for linking to the core. This is incremented any time
// there are changes to the API that affect linking, including new functions,
// new types, or modifications to existing functions or types.
-#define BN_CURRENT_CORE_ABI_VERSION 126
+#define BN_CURRENT_CORE_ABI_VERSION 127
// Minimum ABI version that is supported for loading of plugins. Plugins that
// are linked to an ABI version less than this will not be able to load and
@@ -2731,12 +2731,13 @@ extern "C"
typedef enum BNAnalysisState
{
- InitialState,
- HoldState,
- IdleState,
- DisassembleState,
- AnalyzeState,
- ExtendedAnalyzeState
+ InitialState, // Entry point before any analysis begins
+ HoldState, // Module-level analysis is deferred; On-demand function analysis is permitted
+ IdleState, // No active analysis; system is idle and ready
+ DiscoveryState, // Context gathering and auxiliary data preparation
+ DisassembleState, // Instruction decoding and control flow discovery
+ AnalyzeState, // Core semantic and structural analysis
+ ExtendedAnalyzeState // Supplemental analysis: sweeping, type resolution, and pattern matching
} BNAnalysisState;
typedef struct BNActiveAnalysisInfo
diff --git a/plugins/efi_resolver/src/Plugin.cpp b/plugins/efi_resolver/src/Plugin.cpp
index 9d5a69ce..e26ec171 100644
--- a/plugins/efi_resolver/src/Plugin.cpp
+++ b/plugins/efi_resolver/src/Plugin.cpp
@@ -70,6 +70,9 @@ extern "C"
"eligibility": {
"runOnce": true,
"auto": {}
+ },
+ "dependencies": {
+ "downstream": ["core.module.update"]
}
})~", &RunWorkflow);
diff --git a/plugins/rtti/plugin.cpp b/plugins/rtti/plugin.cpp
index 0fbfbce2..d94be592 100644
--- a/plugins/rtti/plugin.cpp
+++ b/plugins/rtti/plugin.cpp
@@ -115,13 +115,16 @@ extern "C" {
"eligibility": {
"runOnce": true,
"auto": {}
+ },
+ "dependencies": {
+ "downstream": ["core.module.update"]
}
- })~", &VFTAnalysis, {"core.module.update"});
+ })~", &VFTAnalysis);
// Run rtti before debug info is applied.
rttiMetaWorkflow->Insert("core.module.loadDebugInfo", "analysis.rtti.rttiAnalysis");
// Run vft after functions have analyzed (so that the virtual functions have analyzed)
- rttiMetaWorkflow->Insert("core.module.deleteUnusedAutoFunctions", "analysis.rtti.vftAnalysis");
+ rttiMetaWorkflow->InsertAfter("core.module.extendedAnalysis", "analysis.rtti.vftAnalysis");
Workflow::RegisterWorkflow(rttiMetaWorkflow);
return true;
diff --git a/plugins/warp/src/plugin/workflow.rs b/plugins/warp/src/plugin/workflow.rs
index 56823de4..6a30606e 100644
--- a/plugins/warp/src/plugin/workflow.rs
+++ b/plugins/warp/src/plugin/workflow.rs
@@ -40,6 +40,9 @@ const MATCHER_ACTIVITY_CONFIG: &str = r#"{
"eligibility": {
"auto": {},
"runOnce": true
+ },
+ "dependencies": {
+ "downstream": ["core.module.update"]
}
}"#;
@@ -288,10 +291,10 @@ pub fn insert_workflow() {
let matcher_activity = Activity::new_with_action(MATCHER_ACTIVITY_CONFIG, matcher_activity);
// Matcher activity must have core.module.update as subactivity otherwise analysis will sometimes never retrigger.
module_meta_workflow
- .register_activity_with_subactivities(&matcher_activity, vec!["core.module.update"])
+ .register_activity(&matcher_activity)
.unwrap();
module_meta_workflow.insert(
- "core.module.deleteUnusedAutoFunctions",
+ "core.module.finishUpdate",
[MATCHER_ACTIVITY_NAME],
);
module_meta_workflow.register().unwrap();
diff --git a/python/binaryview.py b/python/binaryview.py
index 3805807a..c50fdf06 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -656,6 +656,8 @@ class AnalysisProgress:
return "Hold"
if self.state == AnalysisState.IdleState:
return "Idle"
+ if self.state == AnalysisState.DiscoveryState:
+ return "Discovery"
if self.state == AnalysisState.DisassembleState:
return "Disassembling (%d/%d)" % (self.count, self.total)
if self.state == AnalysisState.AnalyzeState: