diff options
| author | Mark Rowe <mark@vector35.com> | 2026-03-24 09:05:49 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2026-03-30 13:22:34 -0700 |
| commit | ddd7aa4e7cd5a1aa07a16c3895d1f91ebf49347b (patch) | |
| tree | 6e8c27306ed57334686b413fd0ec5882846b950a /python | |
| parent | 20adc82b8f85a78fe2cd6ddc2b3a8c78558999a5 (diff) | |
Add a hook to allow BinaryView subclasses to run code after snapshot data is applied
Snapshot data is applied when loading from a database, rebasing the
view, etc.
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 5c86e101..add0d02a 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3173,6 +3173,7 @@ class BinaryView: self._cb.isRelocatable = self._cb.isRelocatable.__class__(self._is_relocatable) self._cb.getAddressSize = self._cb.getAddressSize.__class__(self._get_address_size) self._cb.save = self._cb.save.__class__(self._save) + self._cb.onAfterSnapshotDataApplied = self._cb.onAfterSnapshotDataApplied.__class__(self._on_after_snapshot_data_applied) if file_metadata is None: raise Exception("Attempting to create a BinaryView with FileMetadata which is None") self._file = file_metadata @@ -4482,6 +4483,15 @@ class BinaryView: log_error_for_exception("Unhandled Python exception in BinaryView._save") return False + def _on_after_snapshot_data_applied(self, ctxt): + try: + self.perform_on_after_snapshot_data_applied() + except: + log_error_for_exception("Unhandled Python exception in BinaryView._on_after_snapshot_data_applied") + + def perform_on_after_snapshot_data_applied(self) -> None: + pass + def init(self) -> bool: return True |
