diff options
| author | Brian Potchik <brian@vector35.com> | 2022-03-02 13:42:32 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2022-03-02 13:42:32 -0500 |
| commit | 5bddd6ff72cd1aff613f76b952ef35b31776fd2e (patch) | |
| tree | 4e8c7ad1c74ad4cff6e565c65db6a16081caf006 | |
| parent | a79ea22f3b271c8834f616403f2400b4597a9dc7 (diff) | |
Add function update request API.
| -rw-r--r-- | binaryninjaapi.h | 4 | ||||
| -rw-r--r-- | binaryninjacore.h | 15 | ||||
| -rw-r--r-- | function.cpp | 16 | ||||
| -rw-r--r-- | python/function.py | 25 |
4 files changed, 51 insertions, 9 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index d0feb2d1..411c9c9c 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -3852,7 +3852,9 @@ namespace BinaryNinja { Ref<Tag> CreateAutoFunctionTag(Ref<TagType> tagType, const std::string& data, bool unique = false); Ref<Tag> CreateUserFunctionTag(Ref<TagType> tagType, const std::string& data, bool unique = false); - void Reanalyze(); + void Reanalyze(BNFunctionUpdateType type = UserFunctionUpdate); + void MarkUpdatesRequired(BNFunctionUpdateType type = UserFunctionUpdate); + void MarkCallerUpdatesRequired(BNFunctionUpdateType type = UserFunctionUpdate); Ref<Workflow> GetWorkflow() const; diff --git a/binaryninjacore.h b/binaryninjacore.h index e72830a1..4783fed0 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -28,14 +28,14 @@ // 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 18 +#define BN_CURRENT_CORE_ABI_VERSION 19 // 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 // will require rebuilding. The minimum version is increased when there are // incompatible changes that break binary compatibility, such as changes to // existing types or functions. -#define BN_MINIMUM_CORE_ABI_VERSION 18 +#define BN_MINIMUM_CORE_ABI_VERSION 19 #ifdef __GNUC__ #ifdef BINARYNINJACORE_LIBRARY @@ -2182,6 +2182,13 @@ extern "C" BNPossibleValueSet value; }; + enum BNFunctionUpdateType + { + UserFunctionUpdate, + FullAutoFunctionUpdate, + IncrementalAutoFunctionUpdate + }; + enum BNWorkflowState { WorkflowInitial, @@ -4064,7 +4071,9 @@ extern "C" BINARYNINJACOREAPI void BNRegisterPlatformTypes(BNBinaryView* view, BNPlatform* platform); BINARYNINJACOREAPI void BNReanalyzeAllFunctions(BNBinaryView* view); - BINARYNINJACOREAPI void BNReanalyzeFunction(BNFunction* func); + BINARYNINJACOREAPI void BNReanalyzeFunction(BNFunction* func, BNFunctionUpdateType type); + BINARYNINJACOREAPI void BNMarkUpdatesRequired(BNFunction* func, BNFunctionUpdateType type); + BINARYNINJACOREAPI void BNMarkCallerUpdatesRequired(BNFunction* func, BNFunctionUpdateType type); BINARYNINJACOREAPI BNWorkflow* BNGetWorkflowForBinaryView(BNBinaryView* view); BINARYNINJACOREAPI BNWorkflow* BNGetWorkflowForFunction(BNFunction* func); diff --git a/function.cpp b/function.cpp index e962c1ba..fd6ea568 100644 --- a/function.cpp +++ b/function.cpp @@ -2176,9 +2176,21 @@ Confidence<RegisterValue> Function::GetRegisterValueAtExit(uint32_t reg) const } -void Function::Reanalyze() +void Function::Reanalyze(BNFunctionUpdateType type) { - BNReanalyzeFunction(m_object); + BNReanalyzeFunction(m_object, type); +} + + +void Function::MarkUpdatesRequired(BNFunctionUpdateType type) +{ + BNMarkUpdatesRequired(m_object, type); +} + + +void Function::MarkCallerUpdatesRequired(BNFunctionUpdateType type) +{ + BNMarkCallerUpdatesRequired(m_object, type); } diff --git a/python/function.py b/python/function.py index fbaa2b96..006677b8 100644 --- a/python/function.py +++ b/python/function.py @@ -28,7 +28,7 @@ from dataclasses import dataclass from . import _binaryninjacore as core from .enums import ( AnalysisSkipReason, FunctionGraphType, SymbolType, InstructionTextTokenType, HighlightStandardColor, - HighlightColorStyle, DisassemblyOption, IntegerDisplayType, FunctionAnalysisSkipOverride + HighlightColorStyle, DisassemblyOption, IntegerDisplayType, FunctionAnalysisSkipOverride, FunctionUpdateType ) from . import associateddatastore # Required in the main scope due to being an argument for _FunctionAssociatedDataStore @@ -2525,13 +2525,32 @@ class Function: display_type = IntegerDisplayType[display_type] core.BNSetIntegerConstantDisplayType(self.handle, arch.handle, instr_addr, value, operand, display_type) - def reanalyze(self) -> None: + def reanalyze(self, update_type: Optional[FunctionUpdateType] = FunctionUpdateType.UserFunctionUpdate) -> None: """ ``reanalyze`` causes this functions to be reanalyzed. This function does not wait for the analysis to finish. + :param enums.FunctionUpdateType update_type: (optional) Desired update type :rtype: None """ - core.BNReanalyzeFunction(self.handle) + core.BNReanalyzeFunction(self.handle, update_type) + + def mark_updates_required(self, update_type: Optional[FunctionUpdateType] = FunctionUpdateType.UserFunctionUpdate) -> None: + """ + ``mark_updates_required`` indicates that this function needs to be reanalyzed during the next update cycle + :param enums.FunctionUpdateType update_type: (optional) Desired update type + + :rtype: None + """ + core.BNMarkUpdatesRequired(self.handle, update_type) + + def mark_caller_updates_required(self, update_type: Optional[FunctionUpdateType] = FunctionUpdateType.UserFunctionUpdate) -> None: + """ + ``mark_caller_updates_required`` indicates that callers of this function need to be reanalyzed during the next update cycle + :param enums.FunctionUpdateType update_type: (optional) Desired update type + + :rtype: None + """ + core.BNMarkCallerUpdatesRequired(self.handle, update_type) def request_advanced_analysis_data(self) -> None: core.BNRequestAdvancedFunctionAnalysisData(self.handle) |
