summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2024-04-09 20:52:36 -0400
committerBrian Potchik <brian@vector35.com>2024-04-09 20:52:36 -0400
commitcb4f924f561769b4ff7597d266664c5136e66ccb (patch)
treed815747c604449a8afed4ab83d82c7128574dff7
parent6a3028665578a9d22f564ab8c57c4adbf086131d (diff)
Various fixes for recently added BinaryDataNotifications.
-rw-r--r--binaryninjaapi.h20
-rw-r--r--binaryninjacore.h4
-rw-r--r--python/binaryview.py23
-rw-r--r--ui/notificationsdispatcher.h37
4 files changed, 63 insertions, 21 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 83d42e0c..4b1a2b25 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -3160,11 +3160,11 @@ namespace BinaryNinja {
ComponentDataVariableAdded = 1ULL << 37,
ComponentDataVariableRemoved = 1ULL << 38,
ExternalLibraryAdded = 1ULL << 39,
- ExternalLibraryUpdated = 1ULL << 40,
- ExternalLibraryRemoved = 1ULL << 41,
+ ExternalLibraryRemoved = 1ULL << 40,
+ ExternalLibraryUpdated = 1ULL << 41,
ExternalLocationAdded = 1ULL << 42,
- ExternalLocationUpdated = 1ULL << 43,
- ExternalLocationRemoved = 1ULL << 44,
+ ExternalLocationRemoved = 1ULL << 43,
+ ExternalLocationUpdated = 1ULL << 44,
TypeArchiveAttached = 1ULL << 45,
TypeArchiveDetached = 1ULL << 46,
TypeArchiveConnected = 1ULL << 47,
@@ -3187,6 +3187,10 @@ namespace BinaryNinja {
SectionLifetime = SectionAdded | SectionRemoved,
SectionUpdates = SectionLifetime | SectionUpdated,
ComponentUpdates = ComponentNameUpdated | ComponentAdded | ComponentRemoved | ComponentMoved | ComponentFunctionAdded | ComponentFunctionRemoved | ComponentDataVariableAdded | ComponentDataVariableRemoved,
+ ExternalLibraryLifetime = ExternalLibraryAdded | ExternalLibraryRemoved,
+ ExternalLibraryUpdates = ExternalLibraryLifetime | ExternalLibraryUpdated,
+ ExternalLocationLifetime = ExternalLocationAdded | ExternalLocationRemoved,
+ ExternalLocationUpdates = ExternalLocationLifetime | ExternalLocationUpdated,
TypeArchiveUpdates = TypeArchiveAttached | TypeArchiveDetached | TypeArchiveConnected | TypeArchiveDisconnected
};
@@ -3483,13 +3487,13 @@ namespace BinaryNinja {
(void)library;
}
- virtual void OnExternalLibraryUpdated(BinaryView* data, ExternalLibrary* library)
+ virtual void OnExternalLibraryRemoved(BinaryView* data, ExternalLibrary* library)
{
(void)data;
(void)library;
}
- virtual void OnExternalLibraryRemoved(BinaryView* data, ExternalLibrary* library)
+ virtual void OnExternalLibraryUpdated(BinaryView* data, ExternalLibrary* library)
{
(void)data;
(void)library;
@@ -3501,13 +3505,13 @@ namespace BinaryNinja {
(void)location;
}
- virtual void OnExternalLocationUpdated(BinaryView* data, ExternalLocation* location)
+ virtual void OnExternalLocationRemoved(BinaryView* data, ExternalLocation* location)
{
(void)data;
(void)location;
}
- virtual void OnExternalLocationRemoved(BinaryView* data, ExternalLocation* location)
+ virtual void OnExternalLocationUpdated(BinaryView* data, ExternalLocation* location)
{
(void)data;
(void)location;
diff --git a/binaryninjacore.h b/binaryninjacore.h
index d3729695..72e5c9a4 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -37,14 +37,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 58
+#define BN_CURRENT_CORE_ABI_VERSION 59
// 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 58
+#define BN_MINIMUM_CORE_ABI_VERSION 59
#ifdef __GNUC__
#ifdef BINARYNINJACORE_LIBRARY
diff --git a/python/binaryview.py b/python/binaryview.py
index 0f1f77c2..a281a460 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -175,10 +175,17 @@ class NotificationType(IntFlag):
ComponentFunctionRemoved = 1 << 36
ComponentDataVariableAdded = 1 << 37
ComponentDataVariableRemoved = 1 << 38
- TypeArchiveAttached = 1 << 39
- TypeArchiveDetached = 1 << 40
- TypeArchiveConnected = 1 << 41
- TypeArchiveDisconnected = 1 << 42
+ ExternalLibraryAdded = 1 << 39
+ ExternalLibraryRemoved = 1 << 40
+ ExternalLibraryUpdated = 1 << 41
+ ExternalLocationAdded = 1 << 42
+ ExternalLocationRemoved = 1 << 43
+ ExternalLocationUpdated = 1 << 44
+ TypeArchiveAttached = 1 << 45
+ TypeArchiveDetached = 1 << 46
+ TypeArchiveConnected = 1 << 47
+ TypeArchiveDisconnected = 1 << 48
+
BinaryDataUpdates = DataWritten | DataInserted | DataRemoved
FunctionLifetime = FunctionAdded | FunctionRemoved
FunctionUpdates = FunctionLifetime | FunctionUpdated
@@ -195,8 +202,12 @@ class NotificationType(IntFlag):
SegmentUpdates = SegmentLifetime | SegmentUpdated
SectionLifetime = SectionAdded | SectionRemoved
SectionUpdates = SectionLifetime | SectionUpdated
- ComponentUpdates = (ComponentAdded | ComponentRemoved | ComponentMoved | ComponentFunctionAdded | ComponentFunctionRemoved | ComponentDataVariableAdded | ComponentDataVariableRemoved)
- TypeArchiveUpdates = (TypeArchiveAttached | TypeArchiveDetached | TypeArchiveConnected | TypeArchiveDisconnected)
+ ComponentUpdates = ComponentAdded | ComponentRemoved | ComponentMoved | ComponentFunctionAdded | ComponentFunctionRemoved | ComponentDataVariableAdded | ComponentDataVariableRemoved
+ ExternalLibraryLifetime = ExternalLibraryAdded | ExternalLibraryRemoved
+ ExternalLibraryUpdates = ExternalLibraryLifetime | ExternalLibraryUpdated
+ ExternalLocationLifetime = ExternalLocationAdded | ExternalLocationRemoved
+ ExternalLocationUpdates = ExternalLocationLifetime | ExternalLocationUpdated
+ TypeArchiveUpdates = TypeArchiveAttached | TypeArchiveDetached | TypeArchiveConnected | TypeArchiveDisconnected
class BinaryDataNotification:
diff --git a/ui/notificationsdispatcher.h b/ui/notificationsdispatcher.h
index 05ad0081..a65e2dac 100644
--- a/ui/notificationsdispatcher.h
+++ b/ui/notificationsdispatcher.h
@@ -109,6 +109,15 @@ public:
ComponentInfo(BinaryNinja::Component* component, const BinaryNinja::DataVariable& dataVar) : component(component), dataVar(dataVar) {};
};
+ struct TypeArchiveInfo
+ {
+ std::string id;
+ std::string path;
+
+ TypeArchiveInfo() {};
+ TypeArchiveInfo(const std::string& id, const std::string& path) : id(id), path(path) {};
+ };
+
private:
using NotificationType = BinaryNinja::BinaryDataNotification::NotificationType;
using NotificationTypes = BinaryNinja::BinaryDataNotification::NotificationTypes;
@@ -117,21 +126,26 @@ private:
SymbolRef m_symbol;
std::unique_ptr<SymbolInfo> m_symbolInfo;
std::variant<std::monostate, BinaryDataChangeInfo, FunctionRef, BinaryNinja::DataVariable, TagTypeRef,
- BinaryNinja::TagReference, StringInfo, TypeChangeInfo, SegmentRef, SectionRef, ComponentInfo> m_object;
+ BinaryNinja::TagReference, StringInfo, TypeChangeInfo, SegmentRef, SectionRef, ComponentInfo,
+ ExternalLibraryRef, ExternalLocationRef, TypeArchiveInfo, TypeArchiveRef> m_object;
public:
NotificationEvent(NotificationType source): m_source(source) { }
NotificationEvent(NotificationType source, BinaryNinja::Symbol* symbol): m_source(source), m_symbol(symbol) { }
- NotificationEvent(NotificationType source, const BinaryDataChangeInfo& binaryDataChange): m_source(source), m_object(binaryDataChange) { }
+ NotificationEvent(NotificationType source, BinaryDataChangeInfo&& binaryDataChange): m_source(source), m_object(std::move(binaryDataChange)) { }
NotificationEvent(NotificationType source, BinaryNinja::Function* function): m_source(source), m_object(function) { }
NotificationEvent(NotificationType source, const BinaryNinja::DataVariable& dataVariable): m_source(source), m_object(dataVariable) { }
NotificationEvent(NotificationType source, BinaryNinja::TagType* tagType): m_source(source), m_object(tagType) { }
NotificationEvent(NotificationType source, const BinaryNinja::TagReference& tagRef): m_source(source), m_object(tagRef) { }
- NotificationEvent(NotificationType source, const StringInfo& stringInfo): m_source(source), m_object(stringInfo) { }
- NotificationEvent(NotificationType source, const TypeChangeInfo& typeChangeInfo): m_source(source), m_object(typeChangeInfo) { }
+ NotificationEvent(NotificationType source, StringInfo&& stringInfo): m_source(source), m_object(std::move(stringInfo)) { }
+ NotificationEvent(NotificationType source, TypeChangeInfo&& typeChangeInfo): m_source(source), m_object(std::move(typeChangeInfo)) { }
NotificationEvent(NotificationType source, BinaryNinja::Segment* segment): m_source(source), m_object(segment) { }
NotificationEvent(NotificationType source, BinaryNinja::Section* section): m_source(source), m_object(section) { }
- NotificationEvent(NotificationType source, const ComponentInfo& componentInfo): m_source(source), m_object(componentInfo) { }
+ NotificationEvent(NotificationType source, ComponentInfo&& componentInfo): m_source(source), m_object(std::move(componentInfo)) { }
+ NotificationEvent(NotificationType source, BinaryNinja::ExternalLibrary* library): m_source(source), m_object(library) { }
+ NotificationEvent(NotificationType source, BinaryNinja::ExternalLocation* location): m_source(source), m_object(location) { }
+ NotificationEvent(NotificationType source, TypeArchiveInfo&& typeArchiveInfo): m_source(source), m_object(std::move(typeArchiveInfo)) { }
+ NotificationEvent(NotificationType source, BinaryNinja::TypeArchive* archive): m_source(source), m_object(archive) { }
void cacheSymbolInfo();
SymbolInfo* getSymbolInfo() const { return m_symbolInfo.get(); }
@@ -270,6 +284,19 @@ public:
void OnComponentFunctionRemoved(BinaryNinja::BinaryView* view, BinaryNinja::Component* component, BinaryNinja::Function* func) override;
void OnComponentDataVariableAdded(BinaryNinja::BinaryView* view, BinaryNinja::Component* component, const BinaryNinja::DataVariable& var) override;
void OnComponentDataVariableRemoved(BinaryNinja::BinaryView* view, BinaryNinja::Component* component, const BinaryNinja::DataVariable& var) override;
+
+ void OnExternalLibraryAdded(BinaryNinja::BinaryView* data, BinaryNinja::ExternalLibrary* library) override;
+ void OnExternalLibraryRemoved(BinaryNinja::BinaryView* data, BinaryNinja::ExternalLibrary* library) override;
+ void OnExternalLibraryUpdated(BinaryNinja::BinaryView* data, BinaryNinja::ExternalLibrary* library) override;
+
+ void OnExternalLocationAdded(BinaryNinja::BinaryView* data, BinaryNinja::ExternalLocation* location) override;
+ void OnExternalLocationRemoved(BinaryNinja::BinaryView* data, BinaryNinja::ExternalLocation* location) override;
+ void OnExternalLocationUpdated(BinaryNinja::BinaryView* data, BinaryNinja::ExternalLocation* location) override;
+
+ void OnTypeArchiveAttached(BinaryNinja::BinaryView* data, const std::string& id, const std::string& path) override;
+ void OnTypeArchiveDetached(BinaryNinja::BinaryView* data, const std::string& id, const std::string& path) override;
+ void OnTypeArchiveConnected(BinaryNinja::BinaryView* data, BinaryNinja::TypeArchive* archive) override;
+ void OnTypeArchiveDisconnected(BinaryNinja::BinaryView* data, BinaryNinja::TypeArchive* archive) override;
};