summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2025-06-30 10:31:08 -0400
committerMark Rowe <mark@vector35.com>2025-07-03 09:10:13 -0700
commitb26a85dda211a0f1f00eecc37441e1725c5ef898 (patch)
tree0f4157d209c00b93c8ba1d9a2e93f342209b924a /python/binaryview.py
parente96a7a078a9909fc1212861c9669e6af0b034e46 (diff)
Expose Add/RemoveDataReference and ensure BinaryViews use this API instead of the _user_ variant
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 16c2dbfb..da2423ac 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -5735,6 +5735,33 @@ class BinaryView:
core.BNFreeTypeReferences(refs, count.value)
return result
+ def add_data_ref(self, from_addr: int, to_addr: int) -> None:
+ """
+ ``add_data_ref`` adds an auto data cross-reference (xref) from the address ``from_addr`` to the address ``to_addr``.
+
+ :param int from_addr: the reference's source virtual address.
+ :param int to_addr: the reference's destination virtual address.
+ :rtype: None
+
+ .. note:: It is intended to be used from within workflows or binary view initialization.
+ """
+ core.BNAddUserDataReference(self.handle, from_addr, to_addr)
+
+ def remove_data_ref(self, from_addr: int, to_addr: int) -> None:
+ """
+ ``remove_data_ref`` removes an auto data cross-reference (xref) from the address ``from_addr`` to the address ``to_addr``.
+ This function will only remove ones generated during autoanalysis.
+ If the reference does not exist, no action is performed.
+
+ :param int from_addr: the reference's source virtual address.
+ :param int to_addr: the reference's destination virtual address.
+ :rtype: None
+
+ .. note:: It is intended to be used from within workflows or other reoccurring analysis tasks. Removed \
+ references will be re-created whenever auto analysis is re-run for the
+ """
+ core.BNRemoveDataReference(self.handle, from_addr, to_addr)
+
def add_user_data_ref(self, from_addr: int, to_addr: int) -> None:
"""
``add_user_data_ref`` adds a user-specified data cross-reference (xref) from the address ``from_addr`` to the address ``to_addr``.