diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 11 | ||||
| -rw-r--r-- | python/examples/notification_callbacks.py | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 4b1ebb1f..9dd321c1 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -127,6 +127,9 @@ class BinaryDataNotification(object): def type_undefined(self, view, name, type): pass + def type_ref_changed(self, view, name, type): + pass + _decodings = { StringType.AsciiString: "ascii", StringType.Utf8String: "utf-8", @@ -525,6 +528,7 @@ class BinaryDataNotificationCallbacks(object): self._cb.stringRemoved = self._cb.stringRemoved.__class__(self._string_removed) 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) def _register(self): core.BNRegisterDataNotification(self._view.handle, self._cb) @@ -714,6 +718,13 @@ class BinaryDataNotificationCallbacks(object): except: log.log_error(traceback.format_exc()) + def _type_ref_changed(self, ctxt, view, name, type_obj): + try: + qualified_name = types.QualifiedName._from_core_struct(name[0]) + self._notify.type_ref_changed(self._view, qualified_name, types.Type(core.BNNewTypeReference(type_obj), platform = self._view.platform)) + except: + log.log_error(traceback.format_exc()) + @property def view(self): """ """ diff --git a/python/examples/notification_callbacks.py b/python/examples/notification_callbacks.py index 3f1a2d41..e299aa06 100644 --- a/python/examples/notification_callbacks.py +++ b/python/examples/notification_callbacks.py @@ -94,4 +94,7 @@ class DemoNotification(BinaryDataNotification): def type_undefined(self, *args): log.log_info(inspect.stack()[0][3] + str(args)) + def type_ref_changed(self, *args): + log.log_info(inspect.stack()[0][3] + str(args)) + PluginCommand.register("Register Notification", "", reg_notif) |
