summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-06-10 01:37:39 -0400
committerGlenn Smith <glenn@vector35.com>2025-06-11 17:37:30 -0400
commit4559573522332364873709280012593875935285 (patch)
tree145dcf6b2c070554ac1c377f94bcc4f860f8e900
parent4677622997632557385187477331110706520731 (diff)
Expose Function::CheckForDebugReport
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--function.cpp6
-rw-r--r--python/function.py16
-rw-r--r--rust/src/function.rs13
5 files changed, 37 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index d0c8a660..ad16ca84 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -11415,6 +11415,7 @@ namespace BinaryNinja {
std::map<Variable, std::map<ArchAndAddr, Ref<FieldResolutionInfo>>> GetAllFieldResolutions();
void RequestDebugReport(const std::string& name);
+ bool CheckForDebugReport(const std::string& name);
/*! Get the name for a given label ID
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 88e30c38..99e10969 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -5505,6 +5505,7 @@ extern "C"
const BNArchitectureAndAddress* defSite);
BINARYNINJACOREAPI void BNRequestFunctionDebugReport(BNFunction* func, const char* name);
+ BINARYNINJACOREAPI bool BNFunctionCheckForDebugReport(BNFunction* func, const char* name);
BINARYNINJACOREAPI BNILReferenceSource* BNGetMediumLevelILVariableReferences(
BNFunction* func, BNVariable* var, size_t* count);
diff --git a/function.cpp b/function.cpp
index 6d026359..593085d2 100644
--- a/function.cpp
+++ b/function.cpp
@@ -2778,6 +2778,12 @@ void Function::RequestDebugReport(const string& name)
}
+bool Function::CheckForDebugReport(const string& name)
+{
+ return BNFunctionCheckForDebugReport(m_object, name.c_str());
+}
+
+
string Function::GetGotoLabelName(uint64_t labelId)
{
char* name = BNGetGotoLabelName(m_object, labelId);
diff --git a/python/function.py b/python/function.py
index ccecb992..d571bc55 100644
--- a/python/function.py
+++ b/python/function.py
@@ -3040,6 +3040,22 @@ class Function:
core.BNRequestFunctionDebugReport(self.handle, name)
self.view.update_analysis()
+ def check_for_debug_report(self, name: str) -> bool:
+ """
+ ``check_for_debug_report`` checks if a function has had a debug report requested
+ with the given name, and then, if one has been requested, clears the request internally
+ so that future calls to this function for that report will return False.
+
+ If a function has had a debug report requested, it is the caller of this function's
+ responsibility to actually generate and show the debug report.
+ You can use :py:func:`binaryninja.interaction.show_report_collection`
+ for showing a debug report from a workflow activity.
+
+ :param name: Name of the debug report
+ :return: True if the report has been requested (and not checked for yet)
+ """
+ return core.BNFunctionCheckForDebugReport(self.handle, name)
+
@property
def call_sites(self) -> List['binaryview.ReferenceSource']:
"""
diff --git a/rust/src/function.rs b/rust/src/function.rs
index 89ade8f8..e7e269dc 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -2235,6 +2235,19 @@ impl Function {
self.view().update_analysis()
}
+ ///Checks if a function has had a debug report requested with the given name, and then,
+ /// if one has been requested, clears the request internally so that future calls
+ /// to this function for that report will return False.
+ ///
+ /// If a function has had a debug report requested, it is the caller of this function's
+ /// responsibility to actually generate and show the debug report.
+ /// You can use [crate::interaction::report::ReportCollection::show]
+ /// for showing a debug report from a workflow activity.
+ pub fn check_for_debug_report(&self, name: &str) -> bool {
+ let name = std::ffi::CString::new(name.to_string()).unwrap();
+ unsafe { BNFunctionCheckForDebugReport(self.handle, name.as_ptr()) }
+ }
+
/// Whether function was automatically discovered s a result of some creation of a 'user' function.
/// 'user' functions may or may not have been created by a user through the or API. For instance the entry point
/// into a function is always created a 'user' function. 'user' functions should be considered the root of auto