summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2021-10-21 18:27:06 +0800
committerXusheng <xusheng@vector35.com>2021-10-28 15:08:53 +0800
commit927390bc14ccd6739a62c2a291e50a4a3ce4d0b0 (patch)
treea628e18289034040005afd0a5c450fd8bea99e0f /python
parentc6f170d1541c53a5b2a9821b31f77612d0b8559f (diff)
Smartly update the TypeView
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py10
-rw-r--r--python/examples/notification_callbacks.py3
2 files changed, 13 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 65a005b7..3ef879ef 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -181,6 +181,8 @@ class BinaryDataNotification:
def type_ref_changed(self, view:'BinaryView', name:'_types.QualifiedName', type:'_types.Type') -> None:
pass
+ def type_field_ref_changed(self, view:'BinaryView', name:'_types.QualifiedName', offset: int) -> None:
+ pass
class StringReference:
_decodings = {
@@ -417,6 +419,7 @@ class BinaryDataNotificationCallbacks:
self._cb.typeDefined = self._cb.typeDefined.__class__(self._type_defined)
self._cb.typeUndefined = self._cb.typeUndefined.__class__(self._type_undefined)
self._cb.typeReferenceChanged = self._cb.typeReferenceChanged.__class__(self._type_ref_changed)
+ self._cb.typeFieldReferenceChanged = self._cb.typeFieldReferenceChanged.__class__(self._type_field_ref_changed)
def _register(self) -> None:
core.BNRegisterDataNotification(self._view.handle, self._cb)
@@ -618,6 +621,13 @@ class BinaryDataNotificationCallbacks:
except:
log_error(traceback.format_exc())
+ def _type_field_ref_changed(self, ctxt, view:core.BNBinaryView, name:str, offset:int) -> None:
+ try:
+ qualified_name = _types.QualifiedName._from_core_struct(name[0])
+ self._notify.type_field_ref_changed(self._view, qualified_name, offset)
+ except:
+ log_error(traceback.format_exc())
+
@property
def view(self) -> 'BinaryView':
return self._view
diff --git a/python/examples/notification_callbacks.py b/python/examples/notification_callbacks.py
index e299aa06..f51df6e3 100644
--- a/python/examples/notification_callbacks.py
+++ b/python/examples/notification_callbacks.py
@@ -97,4 +97,7 @@ class DemoNotification(BinaryDataNotification):
def type_ref_changed(self, *args):
log.log_info(inspect.stack()[0][3] + str(args))
+ def type_field_ref_changed(self, *args):
+ log.log_info(inspect.stack()[0][3] + str(args))
+
PluginCommand.register("Register Notification", "", reg_notif)