From 571d4ed2f01c1117237b1a9684ad9b1d1ad8963a Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Mon, 26 Sep 2022 17:07:52 -0400 Subject: DebugInfo: make parseInfo have a progress callback This will enable us to have progress bars and cancellation of debuginfo application --- binaryninjaapi.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 3d29520f..70f8d45b 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1112,6 +1112,13 @@ namespace BinaryNinja { std::function SplitProgress( std::function originalFn, size_t subpart, std::vector subpartWeights); + struct ProgressContext + { + std::function callback; + }; + + bool ProgressCallback(void* ctxt, size_t current, size_t total); + std::string GetUniqueIdentifierString(); std::map GetMemoryUsageInfo(); @@ -11984,7 +11991,7 @@ namespace BinaryNinja { static std::vector> GetListForView(const Ref data); std::string GetName() const; - Ref Parse(Ref view, Ref existingDebugInfo = nullptr) const; + Ref Parse(Ref view, Ref existingDebugInfo = nullptr, std::function progress = {}) const; bool IsValidForView(const Ref view) const; }; @@ -11992,7 +11999,7 @@ namespace BinaryNinja { class CustomDebugInfoParser : public DebugInfoParser { static bool IsValidCallback(void* ctxt, BNBinaryView* view); - static bool ParseCallback(void* ctxt, BNDebugInfo* debugInfo, BNBinaryView* view); + static bool ParseCallback(void* ctxt, BNDebugInfo* debugInfo, BNBinaryView* view, bool (*progress)(void*, size_t, size_t), void* progressCtxt); BNDebugInfoParser* Register(const std::string& name); public: @@ -12000,7 +12007,7 @@ namespace BinaryNinja { virtual ~CustomDebugInfoParser() {} virtual bool IsValid(Ref) = 0; - virtual bool ParseInfo(Ref, Ref) = 0; + virtual bool ParseInfo(Ref, Ref, std::function) = 0; }; /*! -- cgit v1.3.1