feat: add BinaryDataNotification (55 callbacks) + Register/UnregisterDataNotification#40
Merged
Merged
Conversation
…DataNotification Closes parity gap #0. Mirrors Python BinaryDataNotification (binaryview.py:247) and the C BNBinaryDataNotification struct (55 callback slots), using the same delegate-rooting pattern as PR #39 (TypeArchive notifications): - Struct/BNBinaryDataNotification.cs: flesh out the empty stub into an abstract BinaryDataNotification base with 55 virtual methods (On*), each citing its Python source line. The six OnExternalLibrary*/OnExternalLocation* events have no Python equivalent and expose the struct slots directly. - Delegate/BinaryDataNotificationCallbacks.cs: 9 delegate types (shared by signature shape) + BinaryDataNotificationContext that roots 55 wrapper delegates, marshals each native callback into managed objects, and builds/frees the BNBinaryDataNotification struct. Borrowed handles are add-ref'd via the existing NewFromHandle factories; borrowed struct pointers (BNDataVariable*, BNTagReference*, BNDerivedString*) are read via PtrToStructure. Throwing overrides are swallowed (Python logs and continues). - Handle/BNBinaryView.cs: RegisterDataNotification/UnregisterDataNotification + per-view context map, replacing the two generator-emitted TODOs. Python's NotificationType opt-in filtering is not reproduced: all 55 slots are always wired (matching the TypeArchive approach). The notification_barrier slot is wired but driven by the core's notification loop, so it is not delivered in a static headless database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes parity gap #0.
Mirrors Python
BinaryDataNotification(binaryview.py:247) and the CBNBinaryDataNotificationstruct (55 callback slots), using the same delegate-rooting pattern as PR #39 (TypeArchive notifications).Changes
BinaryDataNotificationbase with 55 virtualOn*methods, each citing its Python source line. The sixOnExternalLibrary*/OnExternalLocation*events have no Python equivalent and expose the struct slots directly for completeness.BinaryDataNotificationContextthat roots 55 wrapper delegates, marshals each native callback into managed objects, and builds/frees theBNBinaryDataNotificationstruct. Borrowed handles are add-ref'd via the existingNewFromHandlefactories; borrowed struct pointers (BNDataVariable*,BNTagReference*,BNDerivedString*) are read viaPtrToStructure. Throwing overrides are swallowed (Python logs and continues).RegisterDataNotification/UnregisterDataNotification+ per-view context map, replacing the two generator-emitted TODOs.Design notes
NotificationTypeopt-in filtering is not reproduced: all 55 slots are always wired (matching the TypeArchive approach in PR feat: TypeArchive type-add/update/rename/delete notifications #39). Thenotification_barrierslot is wired but driven by the core's notification loop (active during analysis), so it is not delivered in a static headless database.Verification
dotnet build -c Release: clean, 0 warnings.BinaryDataNotificationTests:DefineUserType→OnTypeDefined(QualifiedName + Type payload)DefineUserDataVariable→OnDataVariableAdded(borrowedBNDataVariable*→ view-attachedDataVariable; type width proves theBNType*was wrapped)DefineAutoSymbol→OnSymbolAdded(handle payload)