summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-08-08 16:57:59 +0800
committerXusheng <xusheng@vector35.com>2024-08-13 15:17:23 +0800
commit2e31fd204efbbb035981088a5cb7d3890034b98a (patch)
tree4ce89b4bc8a32829081df633fe4679a434c4db51
parentc6623fa5f2682f506d2d399d1b12547a195565f7 (diff)
Add a way to disable function analysis update and use it to supress analysis update during debugger launch
-rw-r--r--binaryninjaapi.h3
-rw-r--r--binaryninjacore.h2
-rw-r--r--binaryview.cpp12
-rw-r--r--python/binaryview.py21
4 files changed, 38 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index bf1421fd..eed15ac4 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -5038,6 +5038,9 @@ namespace BinaryNinja {
*/
void SetAnalysisHold(bool enable);
+ bool GetFunctionAnalysisUpdateDisabled();
+ void SetFunctionAnalysisUpdateDisabled(bool disabled);
+
/*! start the analysis running and dont return till it is complete
Analysis of BinaryViews does not occur automatically, the user must start analysis by calling either
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 0d321838..f06ca4e2 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -4253,6 +4253,8 @@ extern "C"
BINARYNINJACOREAPI void BNRemoveUserFunction(BNBinaryView* view, BNFunction* func);
BINARYNINJACOREAPI bool BNHasInitialAnalysis(BNBinaryView* view);
BINARYNINJACOREAPI void BNSetAnalysisHold(BNBinaryView* view, bool enable);
+ BINARYNINJACOREAPI bool BNGetFunctionAnalysisUpdateDisabled(BNBinaryView* view);
+ BINARYNINJACOREAPI void BNSetFunctionAnalysisUpdateDisabled(BNBinaryView* view, bool disabled);
BINARYNINJACOREAPI void BNUpdateAnalysisAndWait(BNBinaryView* view);
BINARYNINJACOREAPI void BNUpdateAnalysis(BNBinaryView* view);
BINARYNINJACOREAPI void BNAbortAnalysis(BNBinaryView* view);
diff --git a/binaryview.cpp b/binaryview.cpp
index 3eea7241..2f24904d 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -2010,6 +2010,18 @@ void BinaryView::SetAnalysisHold(bool enable)
}
+bool BinaryView::GetFunctionAnalysisUpdateDisabled()
+{
+ return BNGetFunctionAnalysisUpdateDisabled(m_object);
+}
+
+
+void BinaryView::SetFunctionAnalysisUpdateDisabled(bool disabled)
+{
+ BNSetFunctionAnalysisUpdateDisabled(m_object, disabled);
+}
+
+
void BinaryView::UpdateAnalysisAndWait()
{
BNUpdateAnalysisAndWait(m_object);
diff --git a/python/binaryview.py b/python/binaryview.py
index cb067db6..960476d6 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -4599,6 +4599,27 @@ class BinaryView:
"""
core.BNSetAnalysisHold(self.handle, enable)
+ def get_function_analysis_update_disabled(self) -> bool:
+ """
+ Returns True when functions are prevented from being marked as updates required, False otherwise.
+ :return:
+ """
+ return core.BNGetFunctionAnalysisUpdateDisabled(self.handle)
+
+ def set_function_analysis_update_disabled(self, disabled: bool) -> None:
+ """
+ ``set_function_analysis_update_disabled`` prevents any function from being marked as updates required, so that
+ they would NOT be re-analyzed when the analysis is updated. The main difference between this API and
+ ``set_analysis_hold`` is that ``set_analysis_hold`` only temporarily holds the analysis, and the functions
+ are still arranged to be updated when the hold is turned off. However, with
+ ``set_function_analysis_update_disabled``, functions would not be put into the analysis queue at all.
+
+ Use with caution -- in most cases, this is NOT what you want, and you should use ``set_analysis_hold`` instead.
+ :param disabled:
+ :return:
+ """
+ core.BNSetFunctionAnalysisUpdateDisabled(self.handle, disabled)
+
def update_analysis(self) -> None:
"""
``update_analysis`` asynchronously starts the analysis running and returns immediately.